@vidtreo/recorder-wc 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vidtreo-recorder.js +50 -27
- package/package.json +2 -2
package/dist/vidtreo-recorder.js
CHANGED
|
@@ -7354,7 +7354,9 @@ class RecorderWorker {
|
|
|
7354
7354
|
const keyFrameIntervalSeconds = config.keyFrameInterval / fps;
|
|
7355
7355
|
const videoSourceOptions = {
|
|
7356
7356
|
codec: config.codec,
|
|
7357
|
-
|
|
7357
|
+
width: config.width,
|
|
7358
|
+
height: config.height,
|
|
7359
|
+
sizeChangeBehavior: "contain",
|
|
7358
7360
|
bitrateMode: "variable",
|
|
7359
7361
|
latencyMode: "quality",
|
|
7360
7362
|
contentHint: "detail",
|
|
@@ -8093,7 +8095,7 @@ class RecorderWorker {
|
|
|
8093
8095
|
}
|
|
8094
8096
|
}
|
|
8095
8097
|
new RecorderWorker;
|
|
8096
|
-
`],{type:`application/javascript`});return qd=URL.createObjectURL(e),qd}var Yd=class{constructor(){this.worker=null,this.chunks=[],this.totalSize=0,this.isActive=!1,this.videoTrackClone=null,this.audioTrackClone=null,this.isMuted=!1,this.currentVideoTrack=null,this.isPaused=!1,this.overlayConfig=null,this.readyPromiseResolve=null,this.setupWorker()}setupWorker(){if(typeof Worker>`u`)throw W.error(`[WorkerProcessor] Web Workers are not supported`),Error(`Web Workers are not supported`);try{W.debug(`[WorkerProcessor] Setting up worker`);let e=Jd();W.debug(`[WorkerProcessor] Worker URL created`,{urlType:typeof e,isBlobUrl:e.startsWith(`blob:`)}),this.worker=new Worker(e,{type:`classic`}),W.debug(`[WorkerProcessor] Worker created successfully`),this.worker.onmessage=this.handleWorkerMessage.bind(this),this.worker.onerror=this.handleWorkerError.bind(this),W.debug(`[WorkerProcessor] Worker event handlers attached`)}catch(e){let t=e instanceof Error?e.message:String(e);throw W.error(`[WorkerProcessor] Failed to create worker:`,e),Error(`Failed to create worker: ${t}`)}}handleWorkerMessage(e){let t=e.data;switch(t.type){case`ready`:W.debug(`[WorkerProcessor] Worker ready`),this.readyPromiseResolve&&=(this.readyPromiseResolve(),null);break;case`error`:W.error(`[WorkerProcessor] Worker error:`,t.error),this.onError&&this.onError(Error(t.error));break;case`chunk`:this.chunks.push({data:t.data,position:t.position}),this.totalSize=Math.max(this.totalSize,t.position+t.data.length);break;case`bufferUpdate`:this.onBufferUpdate&&this.onBufferUpdate(t.size,t.formatted);break;case`stateChange`:W.debug(`[WorkerProcessor] State changed:`,t.state),this.isPaused=t.state===`paused`;break;default:W.warn(`[WorkerProcessor] Unknown response type:`,t)}}handleWorkerError(e){W.error(`[WorkerProcessor] Worker error event:`,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error:e.error}),this.onError&&this.onError(Error(e.message||`Unknown worker error`))}async startProcessing(e,t,n){if(!this.worker)throw Error(`Worker not initialized`);if(this.isActive)throw Error(`Processing already active`);this.isActive=!0,this.isMuted=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0,this.overlayConfig=n||null;let r=t.format||`mp4`,i=t.audioCodec||id(r),a=Wd(e),o=t.codec||await Kd(t.width,t.height,t.bitrate);W.debug(`[WorkerProcessor] Starting processing`,{isScreenCapture:a,fps:t.fps,codec:o,bitrate:t.bitrate});let s={width:t.width,height:t.height,fps:t.fps,bitrate:Gd(t.bitrate),audioCodec:i,audioBitrate:t.audioBitrate,codec:o,keyFrameInterval:5,format:r},c=e.getVideoTracks(),l=e.getAudioTracks();W.debug(`[WorkerProcessor] Preparing to start processing`,{videoTracksCount:c.length,audioTracksCount:l.length,hasWorker:!!this.worker});let u=null,d=null;if(c.length>0){this.stopCurrentVideoTrack();let e=c[0];u=this.cloneVideoTrack(e),this.currentVideoTrack=u}if(l.length>0){let e=l[0];d=this.cloneAudioTrack(e)}W.debug(`[WorkerProcessor] Track details`,{hasVideoTrack:!!u,videoTrackId:u?.id,videoTrackKind:u?.kind,videoTrackReadyState:u?.readyState,hasAudioTrack:!!d,audioTrackId:d?.id,audioTrackKind:d?.kind,audioTrackReadyState:d?.readyState});let f=u===null?null:new MediaStreamTrackProcessor({track:u}).readable,p=d===null?null:new MediaStreamTrackProcessor({track:d}).readable,m={type:`start`,videoStream:f,audioStream:p,config:s,overlayConfig:this.overlayConfig||void 0},h=[];f&&h.push(f),p&&h.push(p),W.debug(`[WorkerProcessor] Posting message to worker`,{transferablesCount:h.length,messageType:m.type});let g=new Promise(e=>{this.readyPromiseResolve=e});try{this.worker.postMessage(m,h),W.debug(`[WorkerProcessor] Message posted successfully`),await g,W.debug(`[WorkerProcessor] Worker confirmed ready`)}catch(e){throw W.error(`[WorkerProcessor] Failed to post message:`,e),this.readyPromiseResolve=null,e}}pause(){this.worker&&this.isActive&&this.worker.postMessage({type:`pause`})}resume(){this.isWorkerActive()&&this.worker&&this.worker.postMessage({type:`resume`})}isWorkerActive(){return!!(this.worker&&this.isActive)}toggleMute(){this.isMuted=!this.isMuted,this.onMuteStateChange&&this.onMuteStateChange(this.isMuted),this.isWorkerActive()&&this.worker&&this.worker.postMessage({type:`toggleMute`})}switchVideoSource(e){if(!(this.isWorkerActive()&&this.worker))return W.debug(`[WorkerProcessor] Cannot switch source - worker not active`,{hasWorker:!!this.worker,isActive:this.isActive}),Promise.resolve();let t=e.getVideoTracks();if(W.debug(`[WorkerProcessor] Switching video source`,{videoTracksCount:t.length}),t.length===0)return W.warn(`[WorkerProcessor] No video tracks in new stream`),Promise.resolve();let n=Wd(e);W.debug(`[WorkerProcessor] Source type detected`,{isScreenCapture:n,targetFps:30}),this.worker.postMessage({type:`updateFps`,fps:30});let r={type:`updateSourceType`,isScreenCapture:n};this.worker.postMessage(r);let i=t[0];this.stopCurrentVideoTrack();let a=this.cloneVideoTrack(i);W.debug(`[WorkerProcessor] New video track details`,{trackId:a.id,trackKind:a.kind,trackReadyState:a.readyState}),this.currentVideoTrack=a;let o={type:`switchSource`,videoStream:new MediaStreamTrackProcessor({track:a}).readable};try{W.debug(`[WorkerProcessor] Posting switch source message`);let e=[];return o.videoStream&&e.push(o.videoStream),this.worker.postMessage(o,e),W.debug(`[WorkerProcessor] Switch source message posted`),new Promise(e=>{setTimeout(()=>{e()},0)})}catch(e){throw W.error(`[WorkerProcessor] Failed to switch source:`,e),e}}finalize(){if(!this.isWorkerActive())throw Error(`Processing not active`);return new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Finalize timeout`))},3e4),r=i=>{let a=i.data;a.type===`stateChange`&&a.state===`stopped`?(this.worker&&this.worker.removeEventListener(`message`,r),clearTimeout(n),this.isActive=!1,e(this.createBlobFromChunks())):a.type===`error`&&(this.worker&&this.worker.removeEventListener(`message`,r),clearTimeout(n),t(Error(a.error)))};this.worker&&(this.worker.addEventListener(`message`,r),this.worker.postMessage({type:`stop`}))})}createBlobFromChunks(){let e=[...this.chunks].sort((e,t)=>e.position-t.position),t=new ArrayBuffer(this.totalSize),n=new Uint8Array(t);for(let t of e)n.set(t.data,t.position);return{blob:new Blob([t],{type:`video/mp4`}),totalSize:this.totalSize}}cancel(){return this.worker&&this.isActive&&this.worker.postMessage({type:`stop`}),this.isActive=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0,Promise.resolve()}getBufferSize(){return this.totalSize}getMutedState(){return this.isMuted}updateTabVisibility(e,t){if(!(this.isWorkerActive()&&this.worker)){W.warn(`[WorkerProcessor] Cannot update visibility - worker not active`,{isActive:this.isActive,hasWorker:!!this.worker});return}W.debug(`[WorkerProcessor] Sending visibility update to worker`,{isHidden:e,timestamp:t,timestampSeconds:t/1e3});let n={type:`updateVisibility`,isHidden:e,timestamp:t};this.worker.postMessage(n)}updateSourceType(e){if(!(this.isWorkerActive()&&this.worker)){W.warn(`[WorkerProcessor] Cannot update source type - worker not active`,{isActive:this.isActive,hasWorker:!!this.worker});return}W.debug(`[WorkerProcessor] Sending source type update to worker`,{isScreenCapture:e});let t={type:`updateSourceType`,isScreenCapture:e};this.worker.postMessage(t)}isPausedState(){return this.isPaused}getClonedAudioTrack(){return this.audioTrackClone}getAudioStreamForAnalysis(){return this.audioTrackClone?new MediaStream([this.audioTrackClone]):null}setOnBufferUpdate(e){this.onBufferUpdate=e}setOnError(e){this.onError=e}setOnMuteStateChange(e){this.onMuteStateChange=e}cloneVideoTrack(e){if(W.debug(`[WorkerProcessor] Original video track:`,{id:e.id,kind:e.kind,readyState:e.readyState,hasClone:typeof e.clone==`function`}),typeof e.clone==`function`)try{let t=e.clone();return this.videoTrackClone=t,W.debug(`[WorkerProcessor] Video track cloned successfully:`,{id:t.id,kind:t.kind,readyState:t.readyState}),t}catch(e){throw W.error(`[WorkerProcessor] Failed to clone video track:`,e),Error(`Failed to clone video track: ${e instanceof Error?e.message:String(e)}`)}return W.warn(`[WorkerProcessor] Video track clone() not available, using original`),this.videoTrackClone=e,e}cloneAudioTrack(e){if(W.debug(`[WorkerProcessor] Original audio track:`,{id:e.id,kind:e.kind,readyState:e.readyState,hasClone:typeof e.clone==`function`}),typeof e.clone==`function`)try{let t=e.clone();return this.audioTrackClone=t,W.debug(`[WorkerProcessor] Audio track cloned successfully:`,{id:t.id,kind:t.kind,readyState:t.readyState}),t}catch(e){throw W.error(`[WorkerProcessor] Failed to clone audio track:`,e),Error(`Failed to clone audio track: ${e instanceof Error?e.message:String(e)}`)}return W.warn(`[WorkerProcessor] Audio track clone() not available, using original`),this.audioTrackClone=e,e}stopCurrentVideoTrack(){this.currentVideoTrack&&this.currentVideoTrack.readyState===`live`&&this.currentVideoTrack.stop(),this.currentVideoTrack=null}cleanup(){this.worker&&=(this.worker.terminate(),null),qd&&=(URL.revokeObjectURL(qd),null),this.isActive=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0}static isSupported(){return typeof Worker<`u`&&typeof MediaStreamTrackProcessor<`u`&&typeof VideoFrame<`u`&&typeof AudioData<`u`&&typeof OffscreenCanvas<`u`}},Xd=class{constructor(){if(this.currentVideoStream=null,!Yd.isSupported())throw Error(`Web Workers are required for video processing. Please use a modern browser that supports Web Workers, MediaStreamTrackProcessor, VideoFrame, and AudioData APIs.`);try{this.workerProcessor=new Yd,W.debug(`[StreamProcessor] Using worker-based processing`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to initialize worker: ${t}. Web Workers are required for video processing.`)}}async startProcessing(e,t,n){this.workerProcessor.setOnBufferUpdate((e,t)=>{W.debug(`[StreamProcessor] Buffer update:`,{size:e,formatted:t})}),this.workerProcessor.setOnError(e=>{W.error(`[StreamProcessor] Worker error:`,e)}),this.currentVideoStream=e,await this.workerProcessor.startProcessing(e,t,n)}updateTabVisibility(e,t){this.workerProcessor.updateTabVisibility(e,t)}updateSourceType(e){this.workerProcessor.updateSourceType(e)}pause(){this.workerProcessor.pause()}resume(){this.workerProcessor.resume()}isPausedState(){return this.workerProcessor.isPausedState()}async finalize(){return W.debug(`[StreamProcessor] finalize called`),await this.workerProcessor.finalize()}toggleMute(){this.workerProcessor.toggleMute()}isMutedState(){return this.workerProcessor.getMutedState()}getClonedAudioTrack(){return this.workerProcessor.getClonedAudioTrack()}getAudioStreamForAnalysis(){return this.workerProcessor.getAudioStreamForAnalysis()}async switchVideoSource(e){await this.workerProcessor.switchVideoSource(e),this.currentVideoStream=e,this.onSourceChange&&this.onSourceChange(e)}getCurrentVideoSource(){return this.currentVideoStream}getBufferSize(){return this.workerProcessor.getBufferSize()}setOnMuteStateChange(e){this.workerProcessor.setOnMuteStateChange(e)}setOnSourceChange(e){this.onSourceChange=e}async cancel(){await this.workerProcessor.cancel(),this.workerProcessor.cleanup(),this.currentVideoStream=null}};let Zd=1e3,Qd=`recording`,$d=`idle`;var ef=class{constructor(e,t){this.recordingState=$d,this.countdownDuration=5e3,this.countdownRemaining=0,this.countdownTimeoutId=null,this.countdownIntervalId=null,this.countdownStartTime=null,this.isPaused=!1,this.maxRecordingTime=null,this.maxTimeTimer=null,this.recordingSeconds=0,this.recordingIntervalId=null,this.pauseStartTime=null,this.totalPausedTime=0,this.streamProcessor=null,this.originalCameraStream=null,this.enableTabVisibilityOverlay=!1,this.streamManager=e,this.callbacks=t}setCountdownDuration(e){this.countdownDuration=e}setMaxRecordingTime(e){this.maxRecordingTime=e}setTabVisibilityOverlayConfig(e,t){this.enableTabVisibilityOverlay=e,this.tabVisibilityOverlayText=t}getRecordingState(){return this.recordingState}isPausedState(){return this.isPaused}getRecordingSeconds(){return this.recordingSeconds}getStreamProcessor(){return this.streamProcessor}updateSourceType(e){this.recordingState!==Qd||!this.streamProcessor||this.streamProcessor.updateSourceType(e)}setOriginalCameraStream(e){this.originalCameraStream=e}getOriginalCameraStream(){return this.originalCameraStream}async startRecording(){try{this.callbacks.onClearUploadStatus(),this.countdownDuration>0?this.startCountdown():await this.doStartRecording()}catch(e){this.handleError(e),this.recordingState=$d,this.cancelCountdown()}}startCountdown(){this.recordingState=`countdown`,this.countdownRemaining=Math.ceil(this.countdownDuration/Zd),this.countdownStartTime=Date.now(),this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining),this.countdownIntervalId=window.setInterval(()=>{if(!this.countdownStartTime)return;let e=Date.now()-this.countdownStartTime;this.countdownRemaining=Math.max(0,Math.ceil((this.countdownDuration-e)/Zd)),this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining)},100),this.countdownTimeoutId=window.setTimeout(async()=>{await this.doStartRecording().catch(()=>{})},this.countdownDuration)}async doStartRecording(){W.debug(`[RecordingManager] doStartRecording called`),this.cancelCountdown(),this.recordingState=Qd,this.callbacks.onStateChange(this.recordingState),this.resetRecordingState();let e=this.streamManager.getStream();if(W.debug(`[RecordingManager] Current stream:`,{hasStream:!!e,audioTracks:e?.getAudioTracks().length||0,videoTracks:e?.getVideoTracks().length||0}),!e){W.warn(`[RecordingManager] No stream available`),this.handleError(Error(`No stream available for recording`)),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}this.originalCameraStream=e,W.debug(`[RecordingManager] Creating new StreamProcessor`),this.streamProcessor=new Xd,W.debug(`[RecordingManager] StreamProcessor created:`,!!this.streamProcessor);let t=await this.callbacks.onGetConfig().then(e=>({config:e,error:null})).catch(e=>({config:null,error:e}));if(t.error){this.handleError(t.error),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}if(!t.config){this.handleError(Error(`Failed to get recording config`)),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}W.debug(`[RecordingManager] Starting recording with stream manager`);let n=await this.streamManager.startRecording(this.streamProcessor,t.config,this.enableTabVisibilityOverlay,this.tabVisibilityOverlayText).then(()=>(W.info(`[RecordingManager] Recording started successfully`),null)).catch(e=>(W.error(`[RecordingManager] Error starting recording:`,e),e));if(n){this.handleError(n),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}this.startRecordingTimer(),this.maxRecordingTime&&this.maxRecordingTime>0&&(this.maxTimeTimer=window.setTimeout(async()=>{this.recordingState===Qd&&await this.stopRecording()},this.maxRecordingTime))}async stopRecording(){W.debug(`[RecordingManager] stopRecording called`);try{this.cancelCountdown(),this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.clearTimer(this.maxTimeTimer,clearTimeout),this.maxTimeTimer=null,this.resetPauseState(),this.callbacks.onStopAudioTracking(),W.debug(`[RecordingManager] Stopping recording in stream manager`);let e=(await this.streamManager.stopRecording()).blob;return W.info(`[RecordingManager] Recording stopped, blob size:`,e.size),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState),this.recordingSeconds=0,this.streamProcessor=null,this.callbacks.onRecordingComplete(e),e}catch(e){throw this.handleError(e),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState),e}}pauseRecording(){this.recordingState!==Qd||this.isPaused||(this.streamManager.pauseRecording(),this.isPaused=!0,this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.pauseStartTime=Date.now())}resumeRecording(){this.recordingState!==Qd||!this.isPaused||(this.streamManager.resumeRecording(),this.isPaused=!1,this.updatePausedDuration(),this.startRecordingTimer())}cancelCountdown(){this.clearTimer(this.countdownTimeoutId,clearTimeout),this.countdownTimeoutId=null,this.clearTimer(this.countdownIntervalId,clearInterval),this.countdownIntervalId=null,this.recordingState=$d,this.countdownRemaining=0,this.countdownStartTime=null,this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining)}cleanup(){this.cancelCountdown(),this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.clearTimer(this.maxTimeTimer,clearTimeout),this.maxTimeTimer=null}resetRecordingState(){this.isPaused=!1,this.recordingSeconds=0,this.totalPausedTime=0,this.pauseStartTime=null}resetPauseState(){this.isPaused=!1,this.pauseStartTime=null,this.totalPausedTime=0}updatePausedDuration(){if(this.pauseStartTime===null)throw Error(`Pause start time not set`);let e=Date.now()-this.pauseStartTime;this.totalPausedTime+=e,this.pauseStartTime=null}startRecordingTimer(){this.recordingIntervalId===null&&(this.recordingIntervalId=window.setInterval(()=>{this.recordingSeconds+=1,this.callbacks.onTimerUpdate(Fd(this.recordingSeconds))},1e3))}clearTimer(e,t){e!==null&&t(e)}handleError(e){let t=e instanceof Error?e:Error(i(e));this.callbacks.onError(t)}};let tf=()=>{},nf=()=>{},rf=()=>{},af=()=>{},of=e=>{},sf=(e,t)=>{},cf=e=>{},lf=e=>{},uf=e=>{},df=()=>{},ff=e=>{};function pf(){return{onProgress:tf,onSuccess:nf,onError:rf,onClearStatus:af}}var mf=class{constructor(e={}){this.uploadService=null,this.uploadQueueManager=null,this.isInitialized=!1,this.enableTabVisibilityOverlay=!1,this.callbacks=e,this.streamManager=new Vd,this.configManager=new fd,this.storageManager=new bd,this.deviceManager=new pd(this.streamManager,e.device),this.audioLevelAnalyzer=new a,this.uploadService=new Ud,this.uploadCallbacks=e.upload?e.upload:pf();let t=this.createRecordingCallbacks(e);this.recordingManager=new ef(this.streamManager,t);let n=this.createSourceSwitchCallbacks(e);this.sourceSwitchManager=new Od(this.streamManager,n),e.stream&&(this.streamManager.on(`streamstart`,({stream:t})=>{W.debug(`[RecorderController] streamstart event received, calling callback`),e.stream?.onStreamStart&&e.stream.onStreamStart(t)}),this.streamManager.on(`streamstop`,()=>{W.debug(`[RecorderController] streamstop event received, calling callback`),e.stream?.onStreamStop&&e.stream.onStreamStop()}),this.streamManager.on(`error`,({error:t})=>{W.error(`[RecorderController] stream error event received, calling callback`,t),e.stream?.onError&&e.stream.onError(t)}))}async initialize(e){if(this.isInitialized)return;e.apiKey&&e.backendUrl&&await this.configManager.initialize(e.apiKey,e.backendUrl),e.countdownDuration!==void 0&&this.recordingManager.setCountdownDuration(e.countdownDuration),e.maxRecordingTime!==void 0&&this.recordingManager.setMaxRecordingTime(e.maxRecordingTime),e.enableTabVisibilityOverlay!==void 0&&(this.enableTabVisibilityOverlay=e.enableTabVisibilityOverlay),e.tabVisibilityOverlayText!==void 0&&(this.tabVisibilityOverlayText=e.tabVisibilityOverlayText),this.recordingManager.setTabVisibilityOverlayConfig(this.enableTabVisibilityOverlay,this.tabVisibilityOverlayText);let t=this.callbacks.onStorageCleanupError??ff;await this.storageManager.initialize(t);let n=this.storageManager.getStorageService();n&&this.uploadService&&(this.uploadQueueManager=new Hd(n,this.uploadService),this.uploadQueueManager.setCallbacks({onUploadProgress:(e,t)=>{this.uploadCallbacks.onProgress(t)},onUploadComplete:(e,t)=>{this.uploadCallbacks.onSuccess(t)},onUploadError:(e,t)=>{this.uploadCallbacks.onError(t)}})),this.isInitialized=!0}async startStream(){W.debug(`[RecorderController] startStream called`),await this.streamManager.startStream(),W.debug(`[RecorderController] startStream completed`)}async stopStream(){await this.streamManager.stopStream()}switchVideoDevice(e){return this.streamManager.switchVideoDevice(e)}switchAudioDevice(e){return this.streamManager.switchAudioDevice(e)}async startRecording(){await this.recordingManager.startRecording()}async stopRecording(){let e=await this.recordingManager.stopRecording();return await this.sourceSwitchManager.handleRecordingStop().catch(()=>{throw Error(`Source switch cleanup failed`)}),e}getTabVisibilityOverlayConfig(){return{enabled:this.enableTabVisibilityOverlay,text:this.tabVisibilityOverlayText}}pauseRecording(){this.recordingManager.pauseRecording()}resumeRecording(){this.recordingManager.resumeRecording()}async switchSource(e){await this.sourceSwitchManager.toggleSource()}setCameraDevice(e){this.deviceManager.setCameraDevice(e)}setMicDevice(e){this.deviceManager.setMicDevice(e)}getAvailableDevices(){return this.deviceManager.getAvailableDevices()}muteAudio(){this.streamManager.muteAudio()}unmuteAudio(){this.streamManager.unmuteAudio()}toggleMute(){this.streamManager.toggleMute()}getIsMuted(){return this.streamManager.isMuted()}startAudioLevelTracking(e,t){if(!t)throw Error(`Audio level callbacks are required`);return this.audioLevelAnalyzer.startTracking(e,t,()=>this.streamManager.isMuted()),Promise.resolve()}stopAudioLevelTracking(){this.audioLevelAnalyzer.stopTracking()}getAudioLevel(){return this.audioLevelAnalyzer.getAudioLevel()}async uploadVideo(e,t,n,r){if(!this.uploadQueueManager)throw Error(`Upload queue manager not initialized`);this.uploadCallbacks.onClearStatus();let i=await md(e),a=Object.keys(r).length>0?r:void 0;await this.uploadQueueManager.queueUpload({blob:e,apiKey:t,backendUrl:n,filename:`recording-${Date.now()}.mp4`,duration:i,metadata:void 0,userMetadata:a})}getStream(){return this.streamManager.getStream()}getRecordingState(){return this.recordingManager.getRecordingState()}isPaused(){return this.recordingManager.isPausedState()}getCurrentSourceType(){return this.sourceSwitchManager.getCurrentSourceType()}getOriginalCameraStream(){return this.sourceSwitchManager.getOriginalCameraStream()}getStreamManager(){return this.streamManager}getAudioStreamForAnalysis(){return this.streamManager.getAudioStreamForAnalysis()}getDeviceManager(){return this.deviceManager}getConfig(){return this.configManager.getConfig()}getUploadService(){return this.uploadService}isRecording(){return this.streamManager.isRecording()}isActive(){return this.streamManager.isActive()}cleanup(){this.storageManager.destroy(),this.recordingManager.cleanup(),this.audioLevelAnalyzer.stopTracking(),this.sourceSwitchManager.cleanup()}createRecordingCallbacks(e){let t=e.recording;return{onStateChange:t?.onStateChange??of,onCountdownUpdate:t?.onCountdownUpdate??sf,onTimerUpdate:t?.onTimerUpdate??cf,onError:t?.onError??lf,onRecordingComplete:t?.onRecordingComplete??uf,onClearUploadStatus:t?.onClearUploadStatus??df,onStopAudioTracking:()=>{this.audioLevelAnalyzer.stopTracking()},onGetConfig:()=>this.configManager.getConfig()}}createSourceSwitchCallbacks(e){let t=e.sourceSwitch;return{onSourceChange:t?.onSourceChange,onPreviewUpdate:t?.onPreviewUpdate,onError:t?.onError,onTransitionStart:t?.onTransitionStart,onTransitionEnd:t?.onTransitionEnd,onScreenSelectionStart:()=>{this.isRecording()&&this.recordingManager.updateSourceType(!0)},onScreenSelectionEnd:()=>{this.isRecording()&&this.recordingManager.updateSourceType(!1)},getSelectedCameraDeviceId:()=>this.deviceManager.getSelectedCameraDeviceId(),getSelectedMicDeviceId:()=>this.deviceManager.getSelectedMicDeviceId()}}},hf=`2.0.7`,gf=500,_f=`user-agent`,vf=``,yf=`?`,G={FUNCTION:`function`,OBJECT:`object`,STRING:`string`,UNDEFINED:`undefined`},bf=`browser`,xf=`cpu`,Sf=`device`,Cf=`engine`,wf=`os`,Tf=`result`,K=`name`,q=`type`,J=`vendor`,Y=`version`,Ef=`architecture`,Df=`major`,X=`model`,Of=`console`,Z=`mobile`,Q=`tablet`,$=`smarttv`,kf=`wearable`,Af=`xr`,jf=`embedded`,Mf=`inapp`,Nf=`brands`,Pf=`formFactors`,Ff=`fullVersionList`,If=`platform`,Lf=`platformVersion`,Rf=`bitness`,zf=`sec-ch-ua`,Bf=zf+`-full-version-list`,Vf=zf+`-arch`,Hf=zf+`-`+Rf,Uf=zf+`-form-factors`,Wf=zf+`-`+Z,Gf=zf+`-`+X,Kf=zf+`-`+If,qf=Kf+`-version`,Jf=[Nf,Ff,Z,X,If,Lf,Ef,Pf,Rf],Yf=`Amazon`,Xf=`Apple`,Zf=`ASUS`,Qf=`BlackBerry`,$f=`Google`,ep=`Huawei`,tp=`Lenovo`,np=`Honor`,rp=`LG`,ip=`Microsoft`,ap=`Motorola`,op=`Nvidia`,sp=`OnePlus`,cp=`OPPO`,lp=`Samsung`,up=`Sharp`,dp=`Sony`,fp=`Xiaomi`,pp=`Zebra`,mp=`Chrome`,hp=`Chromium`,gp=`Chromecast`,_p=`Edge`,vp=`Firefox`,yp=`Opera`,bp=`Facebook`,xp=`Sogou`,Sp=`Mobile `,Cp=` Browser`,wp=`Windows`,Tp=typeof window!==G.UNDEFINED&&window.navigator?window.navigator:void 0,Ep=Tp&&Tp.userAgentData?Tp.userAgentData:void 0,Dp=function(e,t){var n={},r=t;if(!Ap(t))for(var i in r={},t)for(var a in t[i])r[a]=t[i][a].concat(r[a]?r[a]:[]);for(var o in e)n[o]=r[o]&&r[o].length%2==0?r[o].concat(e[o]):e[o];return n},Op=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},kp=function(e,t){if(typeof e===G.OBJECT&&e.length>0){for(var n in e)if(Np(t)==Np(e[n]))return!0;return!1}return jp(e)?Np(t)==Np(e):!1},Ap=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Ap(e[n]):!1)},jp=function(e){return typeof e===G.STRING},Mp=function(e){if(e){for(var t=[],n=Ip(/\\?\"/g,e).split(`,`),r=0;r<n.length;r++)if(n[r].indexOf(`;`)>-1){var i=Rp(n[r]).split(`;v=`);t[r]={brand:i[0],version:i[1]}}else t[r]=Rp(n[r]);return t}},Np=function(e){return jp(e)?e.toLowerCase():e},Pp=function(e){return jp(e)?Ip(/[^\d\.]/g,e).split(`.`)[0]:void 0},Fp=function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n==G.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Ip=function(e,t){return jp(t)?t.replace(e,vf):t},Lp=function(e){return Ip(/\\?\"/g,e)},Rp=function(e,t){return e=Ip(/^\s\s*/,String(e)),typeof t===G.UNDEFINED?e:e.substring(0,t)},zp=function(e,t){if(!(!e||!t))for(var n=0,r,i,a,o,s,c;n<t.length&&!s;){var l=t[n],u=t[n+1];for(r=i=0;r<l.length&&!s&&l[r];)if(s=l[r++].exec(e),s)for(a=0;a<u.length;a++)c=s[++i],o=u[a],typeof o===G.OBJECT&&o.length>0?o.length===2?typeof o[1]==G.FUNCTION?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===G.FUNCTION&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=c?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:o.length==3?this[o[0]]=c?c.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=c?o[3].apply(this,[c.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=c||void 0;n+=2}},Bp=function(e,t){for(var n in t)if(typeof t[n]===G.OBJECT&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(kp(t[n][r],e))return n===yf?void 0:n}else if(kp(t[n],e))return n===yf?void 0:n;return t.hasOwnProperty(`*`)?t[`*`]:e},Vp={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},Hp={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},Up={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},Wp={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Y,[K,Sp+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[Y,[K,_p+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Y,[K,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[K,Y],[/opios[\/ ]+([\w\.]+)/i],[Y,[K,yp+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Y,[K,yp+` GX`]],[/\bopr\/([\w\.]+)/i],[Y,[K,yp]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Y,[K,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Y,[K,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[K,Y],[/quark(?:pc)?\/([-\w\.]+)/i],[Y,[K,`Quark`]],[/\bddg\/([\w\.]+)/i],[Y,[K,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Y,[K,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Y,[K,`WeChat`]],[/konqueror\/([\w\.]+)/i],[Y,[K,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Y,[K,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[Y,[K,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[Y,[K,`Smart `+tp+Cp]],[/(avast|avg)\/([\w\.]+)/i],[[K,/(.+)/,`$1 Secure`+Cp],Y],[/\bfocus\/([\w\.]+)/i],[Y,[K,vp+` Focus`]],[/\bopt\/([\w\.]+)/i],[Y,[K,yp+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[Y,[K,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[Y,[K,`Dolphin`]],[/coast\/([\w\.]+)/i],[Y,[K,yp+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[Y,[K,`MIUI`+Cp]],[/fxios\/([\w\.-]+)/i],[Y,[K,Sp+vp]],[/\bqihoobrowser\/?([\w\.]*)/i],[Y,[K,`360`]],[/\b(qq)\/([\w\.]+)/i],[[K,/(.+)/,`$1Browser`],Y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[K,/(.+)/,`$1`+Cp],Y],[/samsungbrowser\/([\w\.]+)/i],[Y,[K,lp+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[Y,[K,xp+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[K,xp+` Mobile`],Y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[K,Y],[/(lbbrowser|rekonq|steam(?= (clie|tenf|gameo)))/i],[K],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Y,K],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[K,bp],Y,[q,Mf]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[K,Y,[q,Mf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Y,[K,`GSA`],[q,Mf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Y,[K,`TikTok`],[q,Mf]],[/\[(linkedin)app\]/i],[K,[q,Mf]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[K,/(.+)/,`Zalo`],Y,[q,Mf]],[/(chromium)[\/ ]([-\w\.]+)/i],[K,Y],[/headlesschrome(?:\/([\w\.]+)| )/i],[Y,[K,mp+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[Y,[K,_p+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[K,mp+` WebView`],Y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Y,[K,`Android`+Cp]],[/chrome\/([\w\.]+) mobile/i],[Y,[K,Sp+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[K,Y],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Y,[K,Sp+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[K,Sp+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[Y,K],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[K,[Y,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[K,Y],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[K,Sp+vp],Y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[K,`Netscape`],Y],[/(wolvic|librewolf)\/([\w\.]+)/i],[K,Y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Y,[K,vp+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[K,[Y,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[K,[Y,/[^\d\.]+./,vf]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Ef,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Ef,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Ef,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Ef,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Ef,`arm`]],[/ sun4\w[;\)]/i],[[Ef,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[Ef,/ower/,vf,Np]],[/mc680.0/i],[[Ef,`68k`]],[/winnt.+\[axp/i],[[Ef,`alpha`]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[X,[J,lp],[q,Q]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[X,[J,lp],[q,Z]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[X,[J,Xf],[q,Z]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[X,[J,Xf],[q,Q]],[/(macintosh);/i],[X,[J,Xf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[X,[J,up],[q,Z]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[X,[J,np],[q,Q]],[/honor([-\w ]+)[;\)]/i],[X,[J,np],[q,Z]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[X,[J,ep],[q,Q]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[X,[J,ep],[q,Z]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[X,/_/g,` `],[J,fp],[q,Q]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[X,/_/g,` `],[J,fp],[q,Z]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[X,[J,sp],[q,Z]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[X,[J,cp],[q,Z]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[X,[J,Bp,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":cp}],[q,Q]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[X,[J,`BLU`],[q,Z]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[X,[J,`Vivo`],[q,Z]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[X,[J,`Realme`],[q,Z]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[X,[J,tp],[q,Q]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[X,[J,tp],[q,Z]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[X,[J,ap],[q,Z]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[X,[J,ap],[q,Q]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[X,[J,rp],[q,Q]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[X,[J,rp],[q,Z]],[/(nokia) (t[12][01])/i],[J,X,[q,Q]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[X,/_/g,` `],[q,Z],[J,`Nokia`]],[/(pixel (c|tablet))\b/i],[X,[J,$f],[q,Q]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[X,[J,$f],[q,Z]],[/(google) (pixelbook( go)?)/i],[J,X],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[X,[J,dp],[q,Z]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[X,`Xperia Tablet`],[J,dp],[q,Q]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[X,[J,Yf],[q,Q]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[X,/(.+)/g,`Fire Phone $1`],[J,Yf],[q,Z]],[/(playbook);[-\w\),; ]+(rim)/i],[X,J,[q,Q]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[X,[J,Qf],[q,Z]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[X,[J,Zf],[q,Q]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[X,[J,Zf],[q,Z]],[/(nexus 9)/i],[X,[J,`HTC`],[q,Q]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[J,[X,/_/g,` `],[q,Z]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[X,[J,`TCL`],[q,Q]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[X,[J,`TCL`],[q,Z]],[/(itel) ((\w+))/i],[[J,Np],X,[q,Bp,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[X,[J,`Acer`],[q,Q]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[X,[J,`Meizu`],[q,Z]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[X,[J,`Ulefone`],[q,Z]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[X,[J,`Energizer`],[q,Z]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[X,[J,`Cat`],[q,Z]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[X,[J,`Smartfren`],[q,Z]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[X,[J,`Nothing`],[q,Z]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[X,[J,`Archos`],[q,Q]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[X,[J,`Archos`],[q,Z]],[/; (n159v)/i],[X,[J,`HMD`],[q,Z]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[J,X,[q,Q]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[J,X,[q,Z]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[J,X,[q,Q]],[/(surface duo)/i],[X,[J,ip],[q,Q]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[X,[J,`Fairphone`],[q,Z]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[X,[J,op],[q,Q]],[/(sprint) (\w+)/i],[J,X,[q,Z]],[/(kin\.[onetw]{3})/i],[[X,/\./g,` `],[J,ip],[q,Z]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[X,[J,pp],[q,Q]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[X,[J,pp],[q,Z]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[J,[q,$]],[/hbbtv.+maple;(\d+)/i],[[X,/^/,`SmartTV`],[J,lp],[q,$]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[J,X,[q,$]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[J,rp],[q,$]],[/(apple) ?tv/i],[J,[X,Xf+` TV`],[q,$]],[/crkey.*devicetype\/chromecast/i],[[X,gp+` Third Generation`],[J,$f],[q,$]],[/crkey.*devicetype\/([^/]*)/i],[[X,/^/,`Chromecast `],[J,$f],[q,$]],[/fuchsia.*crkey/i],[[X,gp+` Nest Hub`],[J,$f],[q,$]],[/crkey/i],[[X,gp],[J,$f],[q,$]],[/(portaltv)/i],[X,[J,bp],[q,$]],[/droid.+aft(\w+)( bui|\))/i],[X,[J,Yf],[q,$]],[/(shield \w+ tv)/i],[X,[J,op],[q,$]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[X,[J,up],[q,$]],[/(bravia[\w ]+)( bui|\))/i],[X,[J,dp],[q,$]],[/(mi(tv|box)-?\w+) bui/i],[X,[J,fp],[q,$]],[/Hbbtv.*(technisat) (.*);/i],[J,X,[q,$]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[J,/.+\/(\w+)/,`$1`,Bp,{LG:`lge`}],[X,Rp],[q,$]],[/(playstation \w+)/i],[X,[J,dp],[q,Of]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[X,[J,ip],[q,Of]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[J,Bp,{Nvidia:`Shield`,Anbernic:`RGCUBE`,Logitech:`GR0006`}],X,[q,Of]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[X,[J,lp],[q,kf]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[J,X,[q,kf]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[X,[J,cp],[q,kf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[X,[J,Xf],[q,kf]],[/(opwwe\d{3})/i],[X,[J,sp],[q,kf]],[/(moto 360)/i],[X,[J,ap],[q,kf]],[/(smartwatch 3)/i],[X,[J,dp],[q,kf]],[/(g watch r)/i],[X,[J,rp],[q,kf]],[/droid.+; (wt63?0{2,3})\)/i],[X,[J,pp],[q,kf]],[/droid.+; (glass) \d/i],[X,[J,$f],[q,Af]],[/(pico) ([\w ]+) os\d/i],[J,X,[q,Af]],[/(quest( \d| pro)?s?).+vr/i],[X,[J,bp],[q,Af]],[/mobile vr; rv.+firefox/i],[[q,Af]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[J,[q,jf]],[/(aeobc)\b/i],[X,[J,Yf],[q,jf]],[/(homepod).+mac os/i],[X,[J,Xf],[q,jf]],[/windows iot/i],[[q,jf]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[X,[q,$]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[q,$]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[X,[q,Bp,{mobile:`Mobile`,xr:`VR`,"*":Q}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[q,Q]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[q,Z]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[X,[J,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Y,[K,_p+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[K,Y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Y,[K,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[K,Y],[/ladybird\//i],[[K,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Y,K]],os:[[/(windows nt) (6\.[23]); arm/i],[[K,/N/,`R`],[Y,Bp,Vp]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[K,Y],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[Y,/(;|\))/g,``,Bp,Vp],[K,wp]],[/(windows ce)\/?([\d\.]*)/i],[K,Y],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[Y,/_/g,`.`],[K,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[K,`macOS`],[Y,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[Y,[K,gp+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[Y,[K,gp+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Y,[K,gp+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[Y,[K,gp+` Linux`]],[/crkey\/([\d\.]+)/i],[Y,[K,gp]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[Y,K],[/(ubuntu) ([\w\.]+) like android/i],[[K,/(.+)/,`$1 Touch`],Y],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[K,Y],[/\(bb(10);/i],[Y,[K,Qf]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[Y,[K,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Y,[K,vp+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[Y,[K,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[Y,Bp,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[K,`webOS`]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Y,[K,`watchOS`]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[K,`Chrome OS`],Y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[K,Y],[/(sunos) ?([\d\.]*)/i],[[K,`Solaris`],Y],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[K,Y]]},Gp=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Fp.call(e.init,[[bf,[K,Y,Df,q]],[xf,[Ef]],[Sf,[q,X,J]],[Cf,[K,Y]],[wf,[K,Y]]]),Fp.call(e.isIgnore,[[bf,[Y,Df]],[Cf,[Y]],[wf,[Y]]]),Fp.call(e.isIgnoreRgx,[[bf,/ ?browser$/i],[wf,/ ?os$/i]]),Fp.call(e.toString,[[bf,[K,Y]],[xf,[Ef]],[Sf,[J,X]],[Cf,[K,Y]],[wf,[K,Y]]]),e})(),Kp=function(e,t){var n=Gp.init[t],r=Gp.isIgnore[t]||0,i=Gp.isIgnoreRgx[t]||0,a=Gp.toString[t]||0;function o(){Fp.call(this,n)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return Ep?Ep.getHighEntropyValues(Jf).then(function(t){return e.setCH(new qp(t,!1)).parseCH().get()}):e.parseCH().get()},o.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Tf&&(o.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!kp(r,n)&&Np(i?Ip(i,this[n]):this[n])==Np(i?Ip(i,e):e)){if(t=!0,e!=G.UNDEFINED)break}else if(e==G.UNDEFINED&&t){t=!t;break}return t},o.prototype.toString=function(){var e=vf;for(var t in a)typeof this[a[t]]!==G.UNDEFINED&&(e+=(e?` `:vf)+this[a[t]]);return e||G.UNDEFINED}),o.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:o.prototype.is,toString:o.prototype.toString,withClientHints:o.prototype.withClientHints,withFeatureCheck:o.prototype.withFeatureCheck};var r=new n;return e(r),r},new o};function qp(e,t){if(e||={},Fp.call(this,Jf),t)Fp.call(this,[[Nf,Mp(e[zf])],[Ff,Mp(e[Bf])],[Z,/\?1/.test(e[Wf])],[X,Lp(e[Gf])],[If,Lp(e[Kf])],[Lf,Lp(e[qf])],[Ef,Lp(e[Vf])],[Pf,Mp(e[Uf])],[Rf,Lp(e[Hf])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==G.UNDEFINED&&(this[n]=e[n])}function Jp(e,t,n,r){return Fp.call(this,[[`itemType`,e],[`ua`,t],[`uaCH`,r],[`rgxMap`,n],[`data`,Kp(this,e)]]),this}Jp.prototype.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},Jp.prototype.set=function(e,t){return this.data[e]=t,this},Jp.prototype.setCH=function(e){return this.uaCH=e,this},Jp.prototype.detectFeature=function(){if(Tp&&Tp.userAgent==this.ua)switch(this.itemType){case bf:Tp.brave&&typeof Tp.brave.isBrave==G.FUNCTION&&this.set(K,`Brave`);break;case Sf:!this.get(q)&&Ep&&Ep[Z]&&this.set(q,Z),this.get(X)==`Macintosh`&&Tp&&typeof Tp.standalone!==G.UNDEFINED&&Tp.maxTouchPoints&&Tp.maxTouchPoints>2&&this.set(X,`iPad`).set(q,Q);break;case wf:!this.get(K)&&Ep&&Ep[If]&&this.set(K,Ep[If]);break;case Tf:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(bf,t(bf)).set(xf,t(xf)).set(Sf,t(Sf)).set(Cf,t(Cf)).set(wf,t(wf))}return this},Jp.prototype.parseUA=function(){switch(this.itemType!=Tf&&zp.call(this.data,this.ua,this.rgxMap),this.itemType){case bf:this.set(Df,Pp(this.get(Y)));break;case wf:if(this.get(K)==`iOS`&&this.get(Y)==`18.6`){var e=/\) Version\/([\d\.]+)/.exec(this.ua);e&&parseInt(e[1].substring(0,2),10)>=26&&this.set(Y,e[1])}break}return this},Jp.prototype.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case bf:case Cf:var n=e[Ff]||e[Nf],r;if(n)for(var i=0;i<n.length;i++){var a=n[i].brand||n[i],o=n[i].version;this.itemType==bf&&!/not.a.brand/i.test(a)&&(!r||/Chrom/.test(r)&&a!=hp||r==_p&&/WebView2/.test(a))&&(a=Bp(a,Up),r=this.get(K),r&&!/Chrom/.test(r)&&/Chrom/.test(a)||this.set(K,a).set(Y,o).set(Df,Pp(o)),r=a),this.itemType==Cf&&a==hp&&this.set(Y,o)}break;case xf:var s=e[Ef];s&&(s&&e[Rf]==`64`&&(s+=`64`),zp.call(this.data,s+`;`,t));break;case Sf:if(e[Z]&&this.set(q,Z),e[X]&&(this.set(X,e[X]),!this.get(q)||!this.get(J))){var c={};zp.call(c,`droid 9; `+e[X]+`)`,t),!this.get(q)&&c.type&&this.set(q,c.type),!this.get(J)&&c.vendor&&this.set(J,c.vendor)}if(e[Pf]){var l;if(typeof e[Pf]!=`string`)for(var u=0;!l&&u<e[Pf].length;)l=Bp(e[Pf][u++],Hp);else l=Bp(e[Pf],Hp);this.set(q,l)}break;case wf:var d=e[If];if(d){var f=e[Lf];d==wp&&(f=parseInt(Pp(f),10)>=13?`11`:`10`),this.set(K,d).set(Y,f)}this.get(K)==wp&&e[X]==`Xbox`&&this.set(K,`Xbox`).set(Y,void 0);break;case Tf:var p=this.data,m=function(t){return p[t].getItem().setCH(e).parseCH().get()};this.set(bf,m(bf)).set(xf,m(xf)).set(Sf,m(Sf)).set(Cf,m(Cf)).set(wf,m(wf))}return this};function Yp(e,t,n){if(typeof e===G.OBJECT?(Ap(e,!0)?(typeof t===G.OBJECT&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===G.STRING&&!Ap(t,!0)&&(n=t,t=void 0),n)if(typeof n.append===G.FUNCTION){var r={};n.forEach(function(e,t){r[String(t).toLowerCase()]=e}),n=r}else{var i={};for(var a in n)n.hasOwnProperty(a)&&(i[String(a).toLowerCase()]=n[a]);n=i}if(!(this instanceof Yp))return new Yp(e,t,n).getResult();var o=typeof e===G.STRING?e:n&&n[_f]?n[_f]:Tp&&Tp.userAgent?Tp.userAgent:vf,s=new qp(n,!0),c=t?Dp(Wp,t):Wp,l=function(e){return e==Tf?function(){return new Jp(e,o,c,s).set(`ua`,o).set(bf,this.getBrowser()).set(xf,this.getCPU()).set(Sf,this.getDevice()).set(Cf,this.getEngine()).set(wf,this.getOS()).get()}:function(){return new Jp(e,o,c[e],s).parseUA().get()}};return Fp.call(this,[[`getBrowser`,l(bf)],[`getCPU`,l(xf)],[`getDevice`,l(Sf)],[`getEngine`,l(Cf)],[`getOS`,l(wf)],[`getResult`,l(Tf)],[`getUA`,function(){return o}],[`setUA`,function(e){return jp(e)&&(o=Rp(e,gf)),this}]]).setUA(o),this}Yp.VERSION=hf,Yp.BROWSER=Op([K,Y,Df,q]),Yp.CPU=Op([Ef]),Yp.DEVICE=Op([X,J,q,Of,Z,$,Q,kf,jf]),Yp.ENGINE=Yp.OS=Op([K,Y]);function Xp(e){return{recording:{onStateChange:t=>{e.updateState({recordingState:t})},onCountdownUpdate:(t,n)=>{e.updateState({recordingState:t,countdown:n})},onTimerUpdate:t=>{e.updateState({timer:t})},onError:t=>{e.updateState({error:i(t)})},onRecordingComplete:t=>{e.updateState({countdown:null})},onClearUploadStatus:()=>{e.updateState({uploadProgress:null})},onStopAudioTracking:()=>{},onGetConfig:()=>{if(!e.controller)throw Error(`Controller not initialized`);return e.isDemo?Promise.resolve(od(`mp4`)):e.controller.getConfig()}},sourceSwitch:{onSourceChange:e=>Promise.resolve(),onPreviewUpdate:t=>(e.updateState({stream:t}),Promise.resolve()),onError:t=>{e.updateState({error:i(t)})},onTransitionStart:t=>{e.updateState({transitionMessage:t})},onTransitionEnd:()=>{e.updateState({transitionMessage:null})}},storage:{onUploadProgress:()=>{},onUploadComplete:()=>{},onUploadError:()=>{}},onStorageCleanupError:e=>{console.error(e)}}}function Zp(e,t){let n=(e=>e===``||e===`default`?null:e)(t);return e.setCameraDevice(n),e.switchVideoDevice(n)}function Qp(e,t){let n=(e=>e===``||e===`default`?null:e)(t);return e.setMicDevice(n),e.switchAudioDevice(n)}async function $p(e,t=`camera`){e.isActive()||await e.startStream(),t!==e.getCurrentSourceType()&&await e.switchSource(t),await e.startRecording()}async function em(e,t,n,r){let i=await e.stopRecording();if(t)return i;throw Error("Upload implementation needs `UploadServiceWrapper` access which should be passed here or handled in main component.")}function tm(e){e.pauseRecording()}function nm(e){e.resumeRecording()}async function rm(e,t){await e.switchSource(t)}function im(e){return e.toggleMute(),e.getIsMuted()}function am(e){if(!e)return;let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`recording-${Date.now()}.mp4`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}var om=class{constructor(e){if(this.proxyEndpoint=e.proxyEndpoint,this.proxyEndpoint)throw Error(`Proxy mode not yet implemented`);this.service=new Ud}uploadVideo(e,t){if(this.proxyEndpoint)throw Error(`Proxy mode not yet implemented`);return this.service.uploadVideo(e,t)}};let sm=()=>`
|
|
8098
|
+
`],{type:`application/javascript`});return qd=URL.createObjectURL(e),qd}var Yd=class{constructor(){this.worker=null,this.chunks=[],this.totalSize=0,this.isActive=!1,this.videoTrackClone=null,this.audioTrackClone=null,this.isMuted=!1,this.currentVideoTrack=null,this.isPaused=!1,this.overlayConfig=null,this.readyPromiseResolve=null,this.setupWorker()}setupWorker(){if(typeof Worker>`u`)throw W.error(`[WorkerProcessor] Web Workers are not supported`),Error(`Web Workers are not supported`);try{W.debug(`[WorkerProcessor] Setting up worker`);let e=Jd();W.debug(`[WorkerProcessor] Worker URL created`,{urlType:typeof e,isBlobUrl:e.startsWith(`blob:`)}),this.worker=new Worker(e,{type:`classic`}),W.debug(`[WorkerProcessor] Worker created successfully`),this.worker.onmessage=this.handleWorkerMessage.bind(this),this.worker.onerror=this.handleWorkerError.bind(this),W.debug(`[WorkerProcessor] Worker event handlers attached`)}catch(e){let t=e instanceof Error?e.message:String(e);throw W.error(`[WorkerProcessor] Failed to create worker:`,e),Error(`Failed to create worker: ${t}`)}}handleWorkerMessage(e){let t=e.data;switch(t.type){case`ready`:W.debug(`[WorkerProcessor] Worker ready`),this.readyPromiseResolve&&=(this.readyPromiseResolve(),null);break;case`error`:W.error(`[WorkerProcessor] Worker error:`,t.error),this.onError&&this.onError(Error(t.error));break;case`chunk`:this.chunks.push({data:t.data,position:t.position}),this.totalSize=Math.max(this.totalSize,t.position+t.data.length);break;case`bufferUpdate`:this.onBufferUpdate&&this.onBufferUpdate(t.size,t.formatted);break;case`stateChange`:W.debug(`[WorkerProcessor] State changed:`,t.state),this.isPaused=t.state===`paused`;break;default:W.warn(`[WorkerProcessor] Unknown response type:`,t)}}handleWorkerError(e){W.error(`[WorkerProcessor] Worker error event:`,{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error:e.error}),this.onError&&this.onError(Error(e.message||`Unknown worker error`))}async startProcessing(e,t,n){if(!this.worker)throw Error(`Worker not initialized`);if(this.isActive)throw Error(`Processing already active`);this.isActive=!0,this.isMuted=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0,this.overlayConfig=n||null;let r=t.format||`mp4`,i=t.audioCodec||id(r),a=Wd(e),o=t.codec||await Kd(t.width,t.height,t.bitrate);W.debug(`[WorkerProcessor] Starting processing`,{isScreenCapture:a,fps:t.fps,codec:o,bitrate:t.bitrate});let s={width:t.width,height:t.height,fps:t.fps,bitrate:Gd(t.bitrate),audioCodec:i,audioBitrate:t.audioBitrate,codec:o,keyFrameInterval:5,format:r},c=e.getVideoTracks(),l=e.getAudioTracks();W.debug(`[WorkerProcessor] Preparing to start processing`,{videoTracksCount:c.length,audioTracksCount:l.length,hasWorker:!!this.worker});let u=null,d=null;if(c.length>0){this.stopCurrentVideoTrack();let e=c[0];u=this.cloneVideoTrack(e),this.currentVideoTrack=u}if(l.length>0){let e=l[0];d=this.cloneAudioTrack(e)}W.debug(`[WorkerProcessor] Track details`,{hasVideoTrack:!!u,videoTrackId:u?.id,videoTrackKind:u?.kind,videoTrackReadyState:u?.readyState,hasAudioTrack:!!d,audioTrackId:d?.id,audioTrackKind:d?.kind,audioTrackReadyState:d?.readyState});let f=u===null?null:new MediaStreamTrackProcessor({track:u}).readable,p=d===null?null:new MediaStreamTrackProcessor({track:d}).readable,m={type:`start`,videoStream:f,audioStream:p,config:s,overlayConfig:this.overlayConfig||void 0},h=[];f&&h.push(f),p&&h.push(p),W.debug(`[WorkerProcessor] Posting message to worker`,{transferablesCount:h.length,messageType:m.type});let g=new Promise(e=>{this.readyPromiseResolve=e});try{this.worker.postMessage(m,h),W.debug(`[WorkerProcessor] Message posted successfully`),await g,W.debug(`[WorkerProcessor] Worker confirmed ready`)}catch(e){throw W.error(`[WorkerProcessor] Failed to post message:`,e),this.readyPromiseResolve=null,e}}pause(){this.worker&&this.isActive&&this.worker.postMessage({type:`pause`})}resume(){this.isWorkerActive()&&this.worker&&this.worker.postMessage({type:`resume`})}isWorkerActive(){return!!(this.worker&&this.isActive)}toggleMute(){this.isMuted=!this.isMuted,this.onMuteStateChange&&this.onMuteStateChange(this.isMuted),this.isWorkerActive()&&this.worker&&this.worker.postMessage({type:`toggleMute`})}switchVideoSource(e){if(!(this.isWorkerActive()&&this.worker))return W.debug(`[WorkerProcessor] Cannot switch source - worker not active`,{hasWorker:!!this.worker,isActive:this.isActive}),Promise.resolve();let t=e.getVideoTracks();if(W.debug(`[WorkerProcessor] Switching video source`,{videoTracksCount:t.length}),t.length===0)return W.warn(`[WorkerProcessor] No video tracks in new stream`),Promise.resolve();let n=Wd(e);W.debug(`[WorkerProcessor] Source type detected`,{isScreenCapture:n,targetFps:30}),this.worker.postMessage({type:`updateFps`,fps:30});let r={type:`updateSourceType`,isScreenCapture:n};this.worker.postMessage(r);let i=t[0];this.stopCurrentVideoTrack();let a=this.cloneVideoTrack(i);W.debug(`[WorkerProcessor] New video track details`,{trackId:a.id,trackKind:a.kind,trackReadyState:a.readyState}),this.currentVideoTrack=a;let o={type:`switchSource`,videoStream:new MediaStreamTrackProcessor({track:a}).readable};try{W.debug(`[WorkerProcessor] Posting switch source message`);let e=[];return o.videoStream&&e.push(o.videoStream),this.worker.postMessage(o,e),W.debug(`[WorkerProcessor] Switch source message posted`),new Promise(e=>{setTimeout(()=>{e()},0)})}catch(e){throw W.error(`[WorkerProcessor] Failed to switch source:`,e),e}}finalize(){if(!this.isWorkerActive())throw Error(`Processing not active`);return new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Finalize timeout`))},3e4),r=i=>{let a=i.data;a.type===`stateChange`&&a.state===`stopped`?(this.worker&&this.worker.removeEventListener(`message`,r),clearTimeout(n),this.isActive=!1,e(this.createBlobFromChunks())):a.type===`error`&&(this.worker&&this.worker.removeEventListener(`message`,r),clearTimeout(n),t(Error(a.error)))};this.worker&&(this.worker.addEventListener(`message`,r),this.worker.postMessage({type:`stop`}))})}createBlobFromChunks(){let e=[...this.chunks].sort((e,t)=>e.position-t.position),t=new ArrayBuffer(this.totalSize),n=new Uint8Array(t);for(let t of e)n.set(t.data,t.position);return{blob:new Blob([t],{type:`video/mp4`}),totalSize:this.totalSize}}cancel(){return this.worker&&this.isActive&&this.worker.postMessage({type:`stop`}),this.isActive=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0,Promise.resolve()}getBufferSize(){return this.totalSize}getMutedState(){return this.isMuted}updateTabVisibility(e,t){if(!(this.isWorkerActive()&&this.worker)){W.warn(`[WorkerProcessor] Cannot update visibility - worker not active`,{isActive:this.isActive,hasWorker:!!this.worker});return}W.debug(`[WorkerProcessor] Sending visibility update to worker`,{isHidden:e,timestamp:t,timestampSeconds:t/1e3});let n={type:`updateVisibility`,isHidden:e,timestamp:t};this.worker.postMessage(n)}updateSourceType(e){if(!(this.isWorkerActive()&&this.worker)){W.warn(`[WorkerProcessor] Cannot update source type - worker not active`,{isActive:this.isActive,hasWorker:!!this.worker});return}W.debug(`[WorkerProcessor] Sending source type update to worker`,{isScreenCapture:e});let t={type:`updateSourceType`,isScreenCapture:e};this.worker.postMessage(t)}isPausedState(){return this.isPaused}getClonedAudioTrack(){return this.audioTrackClone}getAudioStreamForAnalysis(){return this.audioTrackClone?new MediaStream([this.audioTrackClone]):null}setOnBufferUpdate(e){this.onBufferUpdate=e}setOnError(e){this.onError=e}setOnMuteStateChange(e){this.onMuteStateChange=e}cloneVideoTrack(e){if(W.debug(`[WorkerProcessor] Original video track:`,{id:e.id,kind:e.kind,readyState:e.readyState,hasClone:typeof e.clone==`function`}),typeof e.clone==`function`)try{let t=e.clone();return this.videoTrackClone=t,W.debug(`[WorkerProcessor] Video track cloned successfully:`,{id:t.id,kind:t.kind,readyState:t.readyState}),t}catch(e){throw W.error(`[WorkerProcessor] Failed to clone video track:`,e),Error(`Failed to clone video track: ${e instanceof Error?e.message:String(e)}`)}return W.warn(`[WorkerProcessor] Video track clone() not available, using original`),this.videoTrackClone=e,e}cloneAudioTrack(e){if(W.debug(`[WorkerProcessor] Original audio track:`,{id:e.id,kind:e.kind,readyState:e.readyState,hasClone:typeof e.clone==`function`}),typeof e.clone==`function`)try{let t=e.clone();return this.audioTrackClone=t,W.debug(`[WorkerProcessor] Audio track cloned successfully:`,{id:t.id,kind:t.kind,readyState:t.readyState}),t}catch(e){throw W.error(`[WorkerProcessor] Failed to clone audio track:`,e),Error(`Failed to clone audio track: ${e instanceof Error?e.message:String(e)}`)}return W.warn(`[WorkerProcessor] Audio track clone() not available, using original`),this.audioTrackClone=e,e}stopCurrentVideoTrack(){this.currentVideoTrack&&this.currentVideoTrack.readyState===`live`&&this.currentVideoTrack.stop(),this.currentVideoTrack=null}cleanup(){this.worker&&=(this.worker.terminate(),null),qd&&=(URL.revokeObjectURL(qd),null),this.isActive=!1,this.isPaused=!1,this.chunks=[],this.totalSize=0}static isSupported(){return typeof Worker<`u`&&typeof MediaStreamTrackProcessor<`u`&&typeof VideoFrame<`u`&&typeof AudioData<`u`&&typeof OffscreenCanvas<`u`}},Xd=class{constructor(){if(this.currentVideoStream=null,!Yd.isSupported())throw Error(`Web Workers are required for video processing. Please use a modern browser that supports Web Workers, MediaStreamTrackProcessor, VideoFrame, and AudioData APIs.`);try{this.workerProcessor=new Yd,W.debug(`[StreamProcessor] Using worker-based processing`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to initialize worker: ${t}. Web Workers are required for video processing.`)}}async startProcessing(e,t,n){this.workerProcessor.setOnBufferUpdate((e,t)=>{W.debug(`[StreamProcessor] Buffer update:`,{size:e,formatted:t})}),this.workerProcessor.setOnError(e=>{W.error(`[StreamProcessor] Worker error:`,e)}),this.currentVideoStream=e,await this.workerProcessor.startProcessing(e,t,n)}updateTabVisibility(e,t){this.workerProcessor.updateTabVisibility(e,t)}updateSourceType(e){this.workerProcessor.updateSourceType(e)}pause(){this.workerProcessor.pause()}resume(){this.workerProcessor.resume()}isPausedState(){return this.workerProcessor.isPausedState()}async finalize(){return W.debug(`[StreamProcessor] finalize called`),await this.workerProcessor.finalize()}toggleMute(){this.workerProcessor.toggleMute()}isMutedState(){return this.workerProcessor.getMutedState()}getClonedAudioTrack(){return this.workerProcessor.getClonedAudioTrack()}getAudioStreamForAnalysis(){return this.workerProcessor.getAudioStreamForAnalysis()}async switchVideoSource(e){await this.workerProcessor.switchVideoSource(e),this.currentVideoStream=e,this.onSourceChange&&this.onSourceChange(e)}getCurrentVideoSource(){return this.currentVideoStream}getBufferSize(){return this.workerProcessor.getBufferSize()}setOnMuteStateChange(e){this.workerProcessor.setOnMuteStateChange(e)}setOnSourceChange(e){this.onSourceChange=e}async cancel(){await this.workerProcessor.cancel(),this.workerProcessor.cleanup(),this.currentVideoStream=null}};let Zd=1e3,Qd=`recording`,$d=`idle`;var ef=class{constructor(e,t){this.recordingState=$d,this.countdownDuration=5e3,this.countdownRemaining=0,this.countdownTimeoutId=null,this.countdownIntervalId=null,this.countdownStartTime=null,this.isPaused=!1,this.maxRecordingTime=null,this.maxTimeTimer=null,this.recordingSeconds=0,this.recordingIntervalId=null,this.pauseStartTime=null,this.totalPausedTime=0,this.streamProcessor=null,this.originalCameraStream=null,this.enableTabVisibilityOverlay=!1,this.streamManager=e,this.callbacks=t}setCountdownDuration(e){this.countdownDuration=e}setMaxRecordingTime(e){this.maxRecordingTime=e}setTabVisibilityOverlayConfig(e,t){this.enableTabVisibilityOverlay=e,this.tabVisibilityOverlayText=t}getRecordingState(){return this.recordingState}isPausedState(){return this.isPaused}getRecordingSeconds(){return this.recordingSeconds}getStreamProcessor(){return this.streamProcessor}updateSourceType(e){this.recordingState!==Qd||!this.streamProcessor||this.streamProcessor.updateSourceType(e)}setOriginalCameraStream(e){this.originalCameraStream=e}getOriginalCameraStream(){return this.originalCameraStream}async startRecording(){try{this.callbacks.onClearUploadStatus(),this.countdownDuration>0?this.startCountdown():await this.doStartRecording()}catch(e){this.handleError(e),this.recordingState=$d,this.cancelCountdown()}}startCountdown(){this.recordingState=`countdown`,this.countdownRemaining=Math.ceil(this.countdownDuration/Zd),this.countdownStartTime=Date.now(),this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining),this.countdownIntervalId=window.setInterval(()=>{if(!this.countdownStartTime)return;let e=Date.now()-this.countdownStartTime;this.countdownRemaining=Math.max(0,Math.ceil((this.countdownDuration-e)/Zd)),this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining)},100),this.countdownTimeoutId=window.setTimeout(async()=>{await this.doStartRecording().catch(()=>{})},this.countdownDuration)}async doStartRecording(){W.debug(`[RecordingManager] doStartRecording called`),this.cancelCountdown(),this.recordingState=Qd,this.callbacks.onStateChange(this.recordingState),this.resetRecordingState();let e=this.streamManager.getStream();if(W.debug(`[RecordingManager] Current stream:`,{hasStream:!!e,audioTracks:e?.getAudioTracks().length||0,videoTracks:e?.getVideoTracks().length||0}),!e){W.warn(`[RecordingManager] No stream available`),this.handleError(Error(`No stream available for recording`)),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}this.originalCameraStream=e,W.debug(`[RecordingManager] Creating new StreamProcessor`),this.streamProcessor=new Xd,W.debug(`[RecordingManager] StreamProcessor created:`,!!this.streamProcessor);let t=await this.callbacks.onGetConfig().then(e=>({config:e,error:null})).catch(e=>({config:null,error:e}));if(t.error){this.handleError(t.error),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}if(!t.config){this.handleError(Error(`Failed to get recording config`)),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}W.debug(`[RecordingManager] Starting recording with stream manager`);let n=await this.streamManager.startRecording(this.streamProcessor,t.config,this.enableTabVisibilityOverlay,this.tabVisibilityOverlayText).then(()=>(W.info(`[RecordingManager] Recording started successfully`),null)).catch(e=>(W.error(`[RecordingManager] Error starting recording:`,e),e));if(n){this.handleError(n),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState);return}this.startRecordingTimer(),this.maxRecordingTime&&this.maxRecordingTime>0&&(this.maxTimeTimer=window.setTimeout(async()=>{this.recordingState===Qd&&await this.stopRecording()},this.maxRecordingTime))}async stopRecording(){W.debug(`[RecordingManager] stopRecording called`);try{this.cancelCountdown(),this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.clearTimer(this.maxTimeTimer,clearTimeout),this.maxTimeTimer=null,this.resetPauseState(),this.callbacks.onStopAudioTracking(),W.debug(`[RecordingManager] Stopping recording in stream manager`);let e=(await this.streamManager.stopRecording()).blob;return W.info(`[RecordingManager] Recording stopped, blob size:`,e.size),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState),this.recordingSeconds=0,this.streamProcessor=null,this.callbacks.onRecordingComplete(e),e}catch(e){throw this.handleError(e),this.recordingState=$d,this.callbacks.onStateChange(this.recordingState),e}}pauseRecording(){this.recordingState!==Qd||this.isPaused||(this.streamManager.pauseRecording(),this.isPaused=!0,this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.pauseStartTime=Date.now())}resumeRecording(){this.recordingState!==Qd||!this.isPaused||(this.streamManager.resumeRecording(),this.isPaused=!1,this.updatePausedDuration(),this.startRecordingTimer())}cancelCountdown(){this.clearTimer(this.countdownTimeoutId,clearTimeout),this.countdownTimeoutId=null,this.clearTimer(this.countdownIntervalId,clearInterval),this.countdownIntervalId=null,this.recordingState=$d,this.countdownRemaining=0,this.countdownStartTime=null,this.callbacks.onCountdownUpdate(this.recordingState,this.countdownRemaining)}cleanup(){this.cancelCountdown(),this.clearTimer(this.recordingIntervalId,clearInterval),this.recordingIntervalId=null,this.clearTimer(this.maxTimeTimer,clearTimeout),this.maxTimeTimer=null}resetRecordingState(){this.isPaused=!1,this.recordingSeconds=0,this.totalPausedTime=0,this.pauseStartTime=null}resetPauseState(){this.isPaused=!1,this.pauseStartTime=null,this.totalPausedTime=0}updatePausedDuration(){if(this.pauseStartTime===null)throw Error(`Pause start time not set`);let e=Date.now()-this.pauseStartTime;this.totalPausedTime+=e,this.pauseStartTime=null}startRecordingTimer(){this.recordingIntervalId===null&&(this.recordingIntervalId=window.setInterval(()=>{this.recordingSeconds+=1,this.callbacks.onTimerUpdate(Fd(this.recordingSeconds))},1e3))}clearTimer(e,t){e!==null&&t(e)}handleError(e){let t=e instanceof Error?e:Error(i(e));this.callbacks.onError(t)}};let tf=()=>{},nf=()=>{},rf=()=>{},af=()=>{},of=e=>{},sf=(e,t)=>{},cf=e=>{},lf=e=>{},uf=e=>{},df=()=>{},ff=e=>{};function pf(){return{onProgress:tf,onSuccess:nf,onError:rf,onClearStatus:af}}var mf=class{constructor(e={}){this.uploadService=null,this.uploadQueueManager=null,this.isInitialized=!1,this.enableTabVisibilityOverlay=!1,this.callbacks=e,this.streamManager=new Vd,this.configManager=new fd,this.storageManager=new bd,this.deviceManager=new pd(this.streamManager,e.device),this.audioLevelAnalyzer=new a,this.uploadService=new Ud,this.uploadCallbacks=e.upload?e.upload:pf();let t=this.createRecordingCallbacks(e);this.recordingManager=new ef(this.streamManager,t);let n=this.createSourceSwitchCallbacks(e);this.sourceSwitchManager=new Od(this.streamManager,n),e.stream&&(this.streamManager.on(`streamstart`,({stream:t})=>{W.debug(`[RecorderController] streamstart event received, calling callback`),e.stream?.onStreamStart&&e.stream.onStreamStart(t)}),this.streamManager.on(`streamstop`,()=>{W.debug(`[RecorderController] streamstop event received, calling callback`),e.stream?.onStreamStop&&e.stream.onStreamStop()}),this.streamManager.on(`error`,({error:t})=>{W.error(`[RecorderController] stream error event received, calling callback`,t),e.stream?.onError&&e.stream.onError(t)}))}async initialize(e){if(this.isInitialized)return;e.apiKey&&e.backendUrl&&await this.configManager.initialize(e.apiKey,e.backendUrl),e.countdownDuration!==void 0&&this.recordingManager.setCountdownDuration(e.countdownDuration),e.maxRecordingTime!==void 0&&this.recordingManager.setMaxRecordingTime(e.maxRecordingTime),e.enableTabVisibilityOverlay!==void 0&&(this.enableTabVisibilityOverlay=e.enableTabVisibilityOverlay),e.tabVisibilityOverlayText!==void 0&&(this.tabVisibilityOverlayText=e.tabVisibilityOverlayText),this.recordingManager.setTabVisibilityOverlayConfig(this.enableTabVisibilityOverlay,this.tabVisibilityOverlayText);let t=this.callbacks.onStorageCleanupError??ff;await this.storageManager.initialize(t);let n=this.storageManager.getStorageService();n&&this.uploadService&&(this.uploadQueueManager=new Hd(n,this.uploadService),this.uploadQueueManager.setCallbacks({onUploadProgress:(e,t)=>{this.uploadCallbacks.onProgress(t)},onUploadComplete:(e,t)=>{this.uploadCallbacks.onSuccess(t)},onUploadError:(e,t)=>{this.uploadCallbacks.onError(t)}})),this.isInitialized=!0}async startStream(){W.debug(`[RecorderController] startStream called`),await this.streamManager.startStream(),W.debug(`[RecorderController] startStream completed`)}async stopStream(){await this.streamManager.stopStream()}switchVideoDevice(e){return this.streamManager.switchVideoDevice(e)}switchAudioDevice(e){return this.streamManager.switchAudioDevice(e)}async startRecording(){await this.recordingManager.startRecording()}async stopRecording(){let e=await this.recordingManager.stopRecording();return await this.sourceSwitchManager.handleRecordingStop().catch(()=>{throw Error(`Source switch cleanup failed`)}),e}getTabVisibilityOverlayConfig(){return{enabled:this.enableTabVisibilityOverlay,text:this.tabVisibilityOverlayText}}pauseRecording(){this.recordingManager.pauseRecording()}resumeRecording(){this.recordingManager.resumeRecording()}async switchSource(e){await this.sourceSwitchManager.toggleSource()}setCameraDevice(e){this.deviceManager.setCameraDevice(e)}setMicDevice(e){this.deviceManager.setMicDevice(e)}getAvailableDevices(){return this.deviceManager.getAvailableDevices()}muteAudio(){this.streamManager.muteAudio()}unmuteAudio(){this.streamManager.unmuteAudio()}toggleMute(){this.streamManager.toggleMute()}getIsMuted(){return this.streamManager.isMuted()}startAudioLevelTracking(e,t){if(!t)throw Error(`Audio level callbacks are required`);return this.audioLevelAnalyzer.startTracking(e,t,()=>this.streamManager.isMuted()),Promise.resolve()}stopAudioLevelTracking(){this.audioLevelAnalyzer.stopTracking()}getAudioLevel(){return this.audioLevelAnalyzer.getAudioLevel()}async uploadVideo(e,t,n,r){if(!this.uploadQueueManager)throw Error(`Upload queue manager not initialized`);this.uploadCallbacks.onClearStatus();let i=await md(e),a=Object.keys(r).length>0?r:void 0;await this.uploadQueueManager.queueUpload({blob:e,apiKey:t,backendUrl:n,filename:`recording-${Date.now()}.mp4`,duration:i,metadata:void 0,userMetadata:a})}getStream(){return this.streamManager.getStream()}getRecordingState(){return this.recordingManager.getRecordingState()}isPaused(){return this.recordingManager.isPausedState()}getCurrentSourceType(){return this.sourceSwitchManager.getCurrentSourceType()}getOriginalCameraStream(){return this.sourceSwitchManager.getOriginalCameraStream()}getStreamManager(){return this.streamManager}getAudioStreamForAnalysis(){return this.streamManager.getAudioStreamForAnalysis()}getDeviceManager(){return this.deviceManager}getConfig(){return this.configManager.getConfig()}getUploadService(){return this.uploadService}isRecording(){return this.streamManager.isRecording()}isActive(){return this.streamManager.isActive()}cleanup(){this.storageManager.destroy(),this.recordingManager.cleanup(),this.audioLevelAnalyzer.stopTracking(),this.sourceSwitchManager.cleanup()}createRecordingCallbacks(e){let t=e.recording;return{onStateChange:t?.onStateChange??of,onCountdownUpdate:t?.onCountdownUpdate??sf,onTimerUpdate:t?.onTimerUpdate??cf,onError:t?.onError??lf,onRecordingComplete:t?.onRecordingComplete??uf,onClearUploadStatus:t?.onClearUploadStatus??df,onStopAudioTracking:()=>{this.audioLevelAnalyzer.stopTracking()},onGetConfig:()=>this.configManager.getConfig()}}createSourceSwitchCallbacks(e){let t=e.sourceSwitch;return{onSourceChange:t?.onSourceChange,onPreviewUpdate:t?.onPreviewUpdate,onError:t?.onError,onTransitionStart:t?.onTransitionStart,onTransitionEnd:t?.onTransitionEnd,onScreenSelectionStart:()=>{this.isRecording()&&this.recordingManager.updateSourceType(!0)},onScreenSelectionEnd:()=>{this.isRecording()&&this.recordingManager.updateSourceType(!1)},getSelectedCameraDeviceId:()=>this.deviceManager.getSelectedCameraDeviceId(),getSelectedMicDeviceId:()=>this.deviceManager.getSelectedMicDeviceId()}}},hf=`2.0.7`,gf=500,_f=`user-agent`,vf=``,yf=`?`,G={FUNCTION:`function`,OBJECT:`object`,STRING:`string`,UNDEFINED:`undefined`},bf=`browser`,xf=`cpu`,Sf=`device`,Cf=`engine`,wf=`os`,Tf=`result`,K=`name`,q=`type`,J=`vendor`,Y=`version`,Ef=`architecture`,Df=`major`,X=`model`,Of=`console`,Z=`mobile`,Q=`tablet`,$=`smarttv`,kf=`wearable`,Af=`xr`,jf=`embedded`,Mf=`inapp`,Nf=`brands`,Pf=`formFactors`,Ff=`fullVersionList`,If=`platform`,Lf=`platformVersion`,Rf=`bitness`,zf=`sec-ch-ua`,Bf=zf+`-full-version-list`,Vf=zf+`-arch`,Hf=zf+`-`+Rf,Uf=zf+`-form-factors`,Wf=zf+`-`+Z,Gf=zf+`-`+X,Kf=zf+`-`+If,qf=Kf+`-version`,Jf=[Nf,Ff,Z,X,If,Lf,Ef,Pf,Rf],Yf=`Amazon`,Xf=`Apple`,Zf=`ASUS`,Qf=`BlackBerry`,$f=`Google`,ep=`Huawei`,tp=`Lenovo`,np=`Honor`,rp=`LG`,ip=`Microsoft`,ap=`Motorola`,op=`Nvidia`,sp=`OnePlus`,cp=`OPPO`,lp=`Samsung`,up=`Sharp`,dp=`Sony`,fp=`Xiaomi`,pp=`Zebra`,mp=`Chrome`,hp=`Chromium`,gp=`Chromecast`,_p=`Edge`,vp=`Firefox`,yp=`Opera`,bp=`Facebook`,xp=`Sogou`,Sp=`Mobile `,Cp=` Browser`,wp=`Windows`,Tp=typeof window!==G.UNDEFINED&&window.navigator?window.navigator:void 0,Ep=Tp&&Tp.userAgentData?Tp.userAgentData:void 0,Dp=function(e,t){var n={},r=t;if(!Ap(t))for(var i in r={},t)for(var a in t[i])r[a]=t[i][a].concat(r[a]?r[a]:[]);for(var o in e)n[o]=r[o]&&r[o].length%2==0?r[o].concat(e[o]):e[o];return n},Op=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},kp=function(e,t){if(typeof e===G.OBJECT&&e.length>0){for(var n in e)if(Np(t)==Np(e[n]))return!0;return!1}return jp(e)?Np(t)==Np(e):!1},Ap=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Ap(e[n]):!1)},jp=function(e){return typeof e===G.STRING},Mp=function(e){if(e){for(var t=[],n=Ip(/\\?\"/g,e).split(`,`),r=0;r<n.length;r++)if(n[r].indexOf(`;`)>-1){var i=Rp(n[r]).split(`;v=`);t[r]={brand:i[0],version:i[1]}}else t[r]=Rp(n[r]);return t}},Np=function(e){return jp(e)?e.toLowerCase():e},Pp=function(e){return jp(e)?Ip(/[^\d\.]/g,e).split(`.`)[0]:void 0},Fp=function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n==G.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Ip=function(e,t){return jp(t)?t.replace(e,vf):t},Lp=function(e){return Ip(/\\?\"/g,e)},Rp=function(e,t){return e=Ip(/^\s\s*/,String(e)),typeof t===G.UNDEFINED?e:e.substring(0,t)},zp=function(e,t){if(!(!e||!t))for(var n=0,r,i,a,o,s,c;n<t.length&&!s;){var l=t[n],u=t[n+1];for(r=i=0;r<l.length&&!s&&l[r];)if(s=l[r++].exec(e),s)for(a=0;a<u.length;a++)c=s[++i],o=u[a],typeof o===G.OBJECT&&o.length>0?o.length===2?typeof o[1]==G.FUNCTION?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:o.length>=3&&(typeof o[1]===G.FUNCTION&&!(o[1].exec&&o[1].test)?o.length>3?this[o[0]]=c?o[1].apply(this,o.slice(2)):void 0:this[o[0]]=c?o[1].call(this,c,o[2]):void 0:o.length==3?this[o[0]]=c?c.replace(o[1],o[2]):void 0:o.length==4?this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):void 0:o.length>4&&(this[o[0]]=c?o[3].apply(this,[c.replace(o[1],o[2])].concat(o.slice(4))):void 0)):this[o]=c||void 0;n+=2}},Bp=function(e,t){for(var n in t)if(typeof t[n]===G.OBJECT&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(kp(t[n][r],e))return n===yf?void 0:n}else if(kp(t[n],e))return n===yf?void 0:n;return t.hasOwnProperty(`*`)?t[`*`]:e},Vp={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},Hp={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},Up={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},Wp={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Y,[K,Sp+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[Y,[K,_p+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Y,[K,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[K,Y],[/opios[\/ ]+([\w\.]+)/i],[Y,[K,yp+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Y,[K,yp+` GX`]],[/\bopr\/([\w\.]+)/i],[Y,[K,yp]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Y,[K,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Y,[K,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[K,Y],[/quark(?:pc)?\/([-\w\.]+)/i],[Y,[K,`Quark`]],[/\bddg\/([\w\.]+)/i],[Y,[K,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Y,[K,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Y,[K,`WeChat`]],[/konqueror\/([\w\.]+)/i],[Y,[K,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Y,[K,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[Y,[K,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[Y,[K,`Smart `+tp+Cp]],[/(avast|avg)\/([\w\.]+)/i],[[K,/(.+)/,`$1 Secure`+Cp],Y],[/\bfocus\/([\w\.]+)/i],[Y,[K,vp+` Focus`]],[/\bopt\/([\w\.]+)/i],[Y,[K,yp+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[Y,[K,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[Y,[K,`Dolphin`]],[/coast\/([\w\.]+)/i],[Y,[K,yp+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[Y,[K,`MIUI`+Cp]],[/fxios\/([\w\.-]+)/i],[Y,[K,Sp+vp]],[/\bqihoobrowser\/?([\w\.]*)/i],[Y,[K,`360`]],[/\b(qq)\/([\w\.]+)/i],[[K,/(.+)/,`$1Browser`],Y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[K,/(.+)/,`$1`+Cp],Y],[/samsungbrowser\/([\w\.]+)/i],[Y,[K,lp+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[Y,[K,xp+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[K,xp+` Mobile`],Y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[K,Y],[/(lbbrowser|rekonq|steam(?= (clie|tenf|gameo)))/i],[K],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Y,K],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[K,bp],Y,[q,Mf]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[K,Y,[q,Mf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Y,[K,`GSA`],[q,Mf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Y,[K,`TikTok`],[q,Mf]],[/\[(linkedin)app\]/i],[K,[q,Mf]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[K,/(.+)/,`Zalo`],Y,[q,Mf]],[/(chromium)[\/ ]([-\w\.]+)/i],[K,Y],[/headlesschrome(?:\/([\w\.]+)| )/i],[Y,[K,mp+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[Y,[K,_p+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[K,mp+` WebView`],Y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Y,[K,`Android`+Cp]],[/chrome\/([\w\.]+) mobile/i],[Y,[K,Sp+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[K,Y],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Y,[K,Sp+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[K,Sp+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[Y,K],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[K,[Y,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[K,Y],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[K,Sp+vp],Y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[K,`Netscape`],Y],[/(wolvic|librewolf)\/([\w\.]+)/i],[K,Y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Y,[K,vp+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[K,[Y,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[K,[Y,/[^\d\.]+./,vf]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Ef,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Ef,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Ef,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Ef,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Ef,`arm`]],[/ sun4\w[;\)]/i],[[Ef,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[Ef,/ower/,vf,Np]],[/mc680.0/i],[[Ef,`68k`]],[/winnt.+\[axp/i],[[Ef,`alpha`]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[X,[J,lp],[q,Q]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[X,[J,lp],[q,Z]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[X,[J,Xf],[q,Z]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[X,[J,Xf],[q,Q]],[/(macintosh);/i],[X,[J,Xf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[X,[J,up],[q,Z]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[X,[J,np],[q,Q]],[/honor([-\w ]+)[;\)]/i],[X,[J,np],[q,Z]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[X,[J,ep],[q,Q]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[X,[J,ep],[q,Z]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[X,/_/g,` `],[J,fp],[q,Q]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[X,/_/g,` `],[J,fp],[q,Z]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[X,[J,sp],[q,Z]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[X,[J,cp],[q,Z]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[X,[J,Bp,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":cp}],[q,Q]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[X,[J,`BLU`],[q,Z]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[X,[J,`Vivo`],[q,Z]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[X,[J,`Realme`],[q,Z]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[X,[J,tp],[q,Q]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[X,[J,tp],[q,Z]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[X,[J,ap],[q,Z]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[X,[J,ap],[q,Q]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[X,[J,rp],[q,Q]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[X,[J,rp],[q,Z]],[/(nokia) (t[12][01])/i],[J,X,[q,Q]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[X,/_/g,` `],[q,Z],[J,`Nokia`]],[/(pixel (c|tablet))\b/i],[X,[J,$f],[q,Q]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[X,[J,$f],[q,Z]],[/(google) (pixelbook( go)?)/i],[J,X],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[X,[J,dp],[q,Z]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[X,`Xperia Tablet`],[J,dp],[q,Q]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[X,[J,Yf],[q,Q]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[X,/(.+)/g,`Fire Phone $1`],[J,Yf],[q,Z]],[/(playbook);[-\w\),; ]+(rim)/i],[X,J,[q,Q]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[X,[J,Qf],[q,Z]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[X,[J,Zf],[q,Q]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[X,[J,Zf],[q,Z]],[/(nexus 9)/i],[X,[J,`HTC`],[q,Q]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[J,[X,/_/g,` `],[q,Z]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[X,[J,`TCL`],[q,Q]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[X,[J,`TCL`],[q,Z]],[/(itel) ((\w+))/i],[[J,Np],X,[q,Bp,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[X,[J,`Acer`],[q,Q]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[X,[J,`Meizu`],[q,Z]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[X,[J,`Ulefone`],[q,Z]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[X,[J,`Energizer`],[q,Z]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[X,[J,`Cat`],[q,Z]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[X,[J,`Smartfren`],[q,Z]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[X,[J,`Nothing`],[q,Z]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[X,[J,`Archos`],[q,Q]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[X,[J,`Archos`],[q,Z]],[/; (n159v)/i],[X,[J,`HMD`],[q,Z]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[J,X,[q,Q]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[J,X,[q,Z]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[J,X,[q,Q]],[/(surface duo)/i],[X,[J,ip],[q,Q]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[X,[J,`Fairphone`],[q,Z]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[X,[J,op],[q,Q]],[/(sprint) (\w+)/i],[J,X,[q,Z]],[/(kin\.[onetw]{3})/i],[[X,/\./g,` `],[J,ip],[q,Z]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[X,[J,pp],[q,Q]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[X,[J,pp],[q,Z]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[J,[q,$]],[/hbbtv.+maple;(\d+)/i],[[X,/^/,`SmartTV`],[J,lp],[q,$]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[J,X,[q,$]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[J,rp],[q,$]],[/(apple) ?tv/i],[J,[X,Xf+` TV`],[q,$]],[/crkey.*devicetype\/chromecast/i],[[X,gp+` Third Generation`],[J,$f],[q,$]],[/crkey.*devicetype\/([^/]*)/i],[[X,/^/,`Chromecast `],[J,$f],[q,$]],[/fuchsia.*crkey/i],[[X,gp+` Nest Hub`],[J,$f],[q,$]],[/crkey/i],[[X,gp],[J,$f],[q,$]],[/(portaltv)/i],[X,[J,bp],[q,$]],[/droid.+aft(\w+)( bui|\))/i],[X,[J,Yf],[q,$]],[/(shield \w+ tv)/i],[X,[J,op],[q,$]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[X,[J,up],[q,$]],[/(bravia[\w ]+)( bui|\))/i],[X,[J,dp],[q,$]],[/(mi(tv|box)-?\w+) bui/i],[X,[J,fp],[q,$]],[/Hbbtv.*(technisat) (.*);/i],[J,X,[q,$]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[J,/.+\/(\w+)/,`$1`,Bp,{LG:`lge`}],[X,Rp],[q,$]],[/(playstation \w+)/i],[X,[J,dp],[q,Of]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[X,[J,ip],[q,Of]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[J,Bp,{Nvidia:`Shield`,Anbernic:`RGCUBE`,Logitech:`GR0006`}],X,[q,Of]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[X,[J,lp],[q,kf]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[J,X,[q,kf]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[X,[J,cp],[q,kf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[X,[J,Xf],[q,kf]],[/(opwwe\d{3})/i],[X,[J,sp],[q,kf]],[/(moto 360)/i],[X,[J,ap],[q,kf]],[/(smartwatch 3)/i],[X,[J,dp],[q,kf]],[/(g watch r)/i],[X,[J,rp],[q,kf]],[/droid.+; (wt63?0{2,3})\)/i],[X,[J,pp],[q,kf]],[/droid.+; (glass) \d/i],[X,[J,$f],[q,Af]],[/(pico) ([\w ]+) os\d/i],[J,X,[q,Af]],[/(quest( \d| pro)?s?).+vr/i],[X,[J,bp],[q,Af]],[/mobile vr; rv.+firefox/i],[[q,Af]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[J,[q,jf]],[/(aeobc)\b/i],[X,[J,Yf],[q,jf]],[/(homepod).+mac os/i],[X,[J,Xf],[q,jf]],[/windows iot/i],[[q,jf]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[X,[q,$]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[q,$]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[X,[q,Bp,{mobile:`Mobile`,xr:`VR`,"*":Q}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[q,Q]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[q,Z]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[X,[J,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Y,[K,_p+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[K,Y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Y,[K,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[K,Y],[/ladybird\//i],[[K,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Y,K]],os:[[/(windows nt) (6\.[23]); arm/i],[[K,/N/,`R`],[Y,Bp,Vp]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[K,Y],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[Y,/(;|\))/g,``,Bp,Vp],[K,wp]],[/(windows ce)\/?([\d\.]*)/i],[K,Y],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[Y,/_/g,`.`],[K,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[K,`macOS`],[Y,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[Y,[K,gp+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[Y,[K,gp+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Y,[K,gp+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[Y,[K,gp+` Linux`]],[/crkey\/([\d\.]+)/i],[Y,[K,gp]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[Y,K],[/(ubuntu) ([\w\.]+) like android/i],[[K,/(.+)/,`$1 Touch`],Y],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[K,Y],[/\(bb(10);/i],[Y,[K,Qf]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[Y,[K,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Y,[K,vp+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[Y,[K,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[Y,Bp,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[K,`webOS`]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Y,[K,`watchOS`]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[K,`Chrome OS`],Y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[K,Y],[/(sunos) ?([\d\.]*)/i],[[K,`Solaris`],Y],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[K,Y]]},Gp=(function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Fp.call(e.init,[[bf,[K,Y,Df,q]],[xf,[Ef]],[Sf,[q,X,J]],[Cf,[K,Y]],[wf,[K,Y]]]),Fp.call(e.isIgnore,[[bf,[Y,Df]],[Cf,[Y]],[wf,[Y]]]),Fp.call(e.isIgnoreRgx,[[bf,/ ?browser$/i],[wf,/ ?os$/i]]),Fp.call(e.toString,[[bf,[K,Y]],[xf,[Ef]],[Sf,[J,X]],[Cf,[K,Y]],[wf,[K,Y]]]),e})(),Kp=function(e,t){var n=Gp.init[t],r=Gp.isIgnore[t]||0,i=Gp.isIgnoreRgx[t]||0,a=Gp.toString[t]||0;function o(){Fp.call(this,n)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return Ep?Ep.getHighEntropyValues(Jf).then(function(t){return e.setCH(new qp(t,!1)).parseCH().get()}):e.parseCH().get()},o.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Tf&&(o.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!kp(r,n)&&Np(i?Ip(i,this[n]):this[n])==Np(i?Ip(i,e):e)){if(t=!0,e!=G.UNDEFINED)break}else if(e==G.UNDEFINED&&t){t=!t;break}return t},o.prototype.toString=function(){var e=vf;for(var t in a)typeof this[a[t]]!==G.UNDEFINED&&(e+=(e?` `:vf)+this[a[t]]);return e||G.UNDEFINED}),o.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:o.prototype.is,toString:o.prototype.toString,withClientHints:o.prototype.withClientHints,withFeatureCheck:o.prototype.withFeatureCheck};var r=new n;return e(r),r},new o};function qp(e,t){if(e||={},Fp.call(this,Jf),t)Fp.call(this,[[Nf,Mp(e[zf])],[Ff,Mp(e[Bf])],[Z,/\?1/.test(e[Wf])],[X,Lp(e[Gf])],[If,Lp(e[Kf])],[Lf,Lp(e[qf])],[Ef,Lp(e[Vf])],[Pf,Mp(e[Uf])],[Rf,Lp(e[Hf])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==G.UNDEFINED&&(this[n]=e[n])}function Jp(e,t,n,r){return Fp.call(this,[[`itemType`,e],[`ua`,t],[`uaCH`,r],[`rgxMap`,n],[`data`,Kp(this,e)]]),this}Jp.prototype.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},Jp.prototype.set=function(e,t){return this.data[e]=t,this},Jp.prototype.setCH=function(e){return this.uaCH=e,this},Jp.prototype.detectFeature=function(){if(Tp&&Tp.userAgent==this.ua)switch(this.itemType){case bf:Tp.brave&&typeof Tp.brave.isBrave==G.FUNCTION&&this.set(K,`Brave`);break;case Sf:!this.get(q)&&Ep&&Ep[Z]&&this.set(q,Z),this.get(X)==`Macintosh`&&Tp&&typeof Tp.standalone!==G.UNDEFINED&&Tp.maxTouchPoints&&Tp.maxTouchPoints>2&&this.set(X,`iPad`).set(q,Q);break;case wf:!this.get(K)&&Ep&&Ep[If]&&this.set(K,Ep[If]);break;case Tf:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(bf,t(bf)).set(xf,t(xf)).set(Sf,t(Sf)).set(Cf,t(Cf)).set(wf,t(wf))}return this},Jp.prototype.parseUA=function(){switch(this.itemType!=Tf&&zp.call(this.data,this.ua,this.rgxMap),this.itemType){case bf:this.set(Df,Pp(this.get(Y)));break;case wf:if(this.get(K)==`iOS`&&this.get(Y)==`18.6`){var e=/\) Version\/([\d\.]+)/.exec(this.ua);e&&parseInt(e[1].substring(0,2),10)>=26&&this.set(Y,e[1])}break}return this},Jp.prototype.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case bf:case Cf:var n=e[Ff]||e[Nf],r;if(n)for(var i=0;i<n.length;i++){var a=n[i].brand||n[i],o=n[i].version;this.itemType==bf&&!/not.a.brand/i.test(a)&&(!r||/Chrom/.test(r)&&a!=hp||r==_p&&/WebView2/.test(a))&&(a=Bp(a,Up),r=this.get(K),r&&!/Chrom/.test(r)&&/Chrom/.test(a)||this.set(K,a).set(Y,o).set(Df,Pp(o)),r=a),this.itemType==Cf&&a==hp&&this.set(Y,o)}break;case xf:var s=e[Ef];s&&(s&&e[Rf]==`64`&&(s+=`64`),zp.call(this.data,s+`;`,t));break;case Sf:if(e[Z]&&this.set(q,Z),e[X]&&(this.set(X,e[X]),!this.get(q)||!this.get(J))){var c={};zp.call(c,`droid 9; `+e[X]+`)`,t),!this.get(q)&&c.type&&this.set(q,c.type),!this.get(J)&&c.vendor&&this.set(J,c.vendor)}if(e[Pf]){var l;if(typeof e[Pf]!=`string`)for(var u=0;!l&&u<e[Pf].length;)l=Bp(e[Pf][u++],Hp);else l=Bp(e[Pf],Hp);this.set(q,l)}break;case wf:var d=e[If];if(d){var f=e[Lf];d==wp&&(f=parseInt(Pp(f),10)>=13?`11`:`10`),this.set(K,d).set(Y,f)}this.get(K)==wp&&e[X]==`Xbox`&&this.set(K,`Xbox`).set(Y,void 0);break;case Tf:var p=this.data,m=function(t){return p[t].getItem().setCH(e).parseCH().get()};this.set(bf,m(bf)).set(xf,m(xf)).set(Sf,m(Sf)).set(Cf,m(Cf)).set(wf,m(wf))}return this};function Yp(e,t,n){if(typeof e===G.OBJECT?(Ap(e,!0)?(typeof t===G.OBJECT&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===G.STRING&&!Ap(t,!0)&&(n=t,t=void 0),n)if(typeof n.append===G.FUNCTION){var r={};n.forEach(function(e,t){r[String(t).toLowerCase()]=e}),n=r}else{var i={};for(var a in n)n.hasOwnProperty(a)&&(i[String(a).toLowerCase()]=n[a]);n=i}if(!(this instanceof Yp))return new Yp(e,t,n).getResult();var o=typeof e===G.STRING?e:n&&n[_f]?n[_f]:Tp&&Tp.userAgent?Tp.userAgent:vf,s=new qp(n,!0),c=t?Dp(Wp,t):Wp,l=function(e){return e==Tf?function(){return new Jp(e,o,c,s).set(`ua`,o).set(bf,this.getBrowser()).set(xf,this.getCPU()).set(Sf,this.getDevice()).set(Cf,this.getEngine()).set(wf,this.getOS()).get()}:function(){return new Jp(e,o,c[e],s).parseUA().get()}};return Fp.call(this,[[`getBrowser`,l(bf)],[`getCPU`,l(xf)],[`getDevice`,l(Sf)],[`getEngine`,l(Cf)],[`getOS`,l(wf)],[`getResult`,l(Tf)],[`getUA`,function(){return o}],[`setUA`,function(e){return jp(e)&&(o=Rp(e,gf)),this}]]).setUA(o),this}Yp.VERSION=hf,Yp.BROWSER=Op([K,Y,Df,q]),Yp.CPU=Op([Ef]),Yp.DEVICE=Op([X,J,q,Of,Z,$,Q,kf,jf]),Yp.ENGINE=Yp.OS=Op([K,Y]);function Xp(e){return{recording:{onStateChange:t=>{e.updateState({recordingState:t})},onCountdownUpdate:(t,n)=>{e.updateState({recordingState:t,countdown:n})},onTimerUpdate:t=>{e.updateState({timer:t})},onError:t=>{e.updateState({error:i(t)})},onRecordingComplete:t=>{e.updateState({countdown:null})},onClearUploadStatus:()=>{e.updateState({uploadProgress:null})},onStopAudioTracking:()=>{},onGetConfig:()=>{if(!e.controller)throw Error(`Controller not initialized`);return e.isDemo?Promise.resolve(od(`mp4`)):e.controller.getConfig()}},sourceSwitch:{onSourceChange:e=>Promise.resolve(),onPreviewUpdate:t=>(e.updateState({stream:t}),Promise.resolve()),onError:t=>{e.updateState({error:i(t)})},onTransitionStart:t=>{e.updateState({transitionMessage:t})},onTransitionEnd:()=>{e.updateState({transitionMessage:null})}},storage:{onUploadProgress:()=>{},onUploadComplete:()=>{},onUploadError:()=>{}},onStorageCleanupError:e=>{console.error(e)}}}function Zp(e,t){let n=(e=>e===``||e===`default`?null:e)(t);return e.setCameraDevice(n),e.switchVideoDevice(n)}function Qp(e,t){let n=(e=>e===``||e===`default`?null:e)(t);return e.setMicDevice(n),e.switchAudioDevice(n)}async function $p(e,t=`camera`){e.isActive()||await e.startStream(),t!==e.getCurrentSourceType()&&await e.switchSource(t),await e.startRecording()}async function em(e,t,n,r){return await e.stopRecording()}function tm(e){e.pauseRecording()}function nm(e){e.resumeRecording()}async function rm(e,t){await e.switchSource(t)}function im(e){return e.toggleMute(),e.getIsMuted()}function am(e){if(!e)return;let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`recording-${Date.now()}.mp4`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}var om=class{constructor(e){if(this.proxyEndpoint=e.proxyEndpoint,this.proxyEndpoint)throw Error(`Proxy mode not yet implemented`);this.service=new Ud}uploadVideo(e,t){if(this.proxyEndpoint)throw Error(`Proxy mode not yet implemented`);return this.service.uploadVideo(e,t)}};let sm=()=>`
|
|
8097
8099
|
<div class="vidtreo-camera-area vidtreo-active" id="cameraArea">
|
|
8098
8100
|
<!-- Error Boundary / Preview Container -->
|
|
8099
8101
|
<div class="vidtreo-preview-container">
|
|
@@ -8155,36 +8157,38 @@ new RecorderWorker;
|
|
|
8155
8157
|
<!-- Recording Controls -->
|
|
8156
8158
|
<div class="vidtreo-recording-controls" id="recordingControls" style="display: none;">
|
|
8157
8159
|
<div class="vidtreo-recording-controls-row">
|
|
8160
|
+
<div class="vidtreo-control-buttons-row">
|
|
8158
8161
|
|
|
8159
|
-
<!-- Settings Button -->
|
|
8162
|
+
<!-- Settings Button (only shown when NOT recording) -->
|
|
8160
8163
|
<button class="vidtreo-control-button" id="btnSettings" title="Settings" style="display: none;">
|
|
8161
8164
|
<i class="ph-fill ph-gear" style="font-size: 20px;"></i>
|
|
8162
8165
|
</button>
|
|
8163
8166
|
|
|
8164
|
-
<!--
|
|
8165
|
-
<button class="vidtreo-
|
|
8166
|
-
|
|
8167
|
+
<!-- Record Button (only shown when idle) -->
|
|
8168
|
+
<button class="vidtreo-record-button" id="btnRecord">
|
|
8169
|
+
<i class="ph-fill ph-circle" style="font-size: 24px; margin-right: 0.375rem;"></i>
|
|
8170
|
+
<span data-i18n="record">Record</span>
|
|
8167
8171
|
</button>
|
|
8168
8172
|
|
|
8169
|
-
|
|
8173
|
+
<!-- Mute Button (only shown when recording) -->
|
|
8170
8174
|
<button class="vidtreo-control-button" id="btnMute" title="Mute" style="display: none;">
|
|
8171
8175
|
<i class="ph-fill ph-microphone" id="iconMute" style="font-size: 24px;"></i>
|
|
8172
8176
|
</button>
|
|
8173
8177
|
|
|
8174
|
-
<!--
|
|
8175
|
-
<button class="vidtreo-
|
|
8176
|
-
<i class="ph-fill ph-
|
|
8177
|
-
<span data-i18n="record">Record</span>
|
|
8178
|
+
<!-- Pause/Resume Button (only shown when recording) -->
|
|
8179
|
+
<button class="vidtreo-control-button" id="btnPause" title="Pause" style="display: none;">
|
|
8180
|
+
<i class="ph-fill ph-pause" id="iconPause" style="font-size: 24px;"></i>
|
|
8178
8181
|
</button>
|
|
8179
8182
|
|
|
8180
|
-
<!-- Stop Button -->
|
|
8181
|
-
<button class="vidtreo-
|
|
8182
|
-
<i class="ph-fill ph-square" style="font-size: 24px;"></i>
|
|
8183
|
+
<!-- Stop Button (styled like Record button, only shown when recording) -->
|
|
8184
|
+
<button class="vidtreo-record-button" id="btnStop" style="display: none;">
|
|
8185
|
+
<i class="ph-fill ph-square" style="font-size: 24px; margin-right: 0.375rem;"></i>
|
|
8186
|
+
<span data-i18n="stop">Stop</span>
|
|
8183
8187
|
</button>
|
|
8184
8188
|
|
|
8185
|
-
<!--
|
|
8186
|
-
<button class="vidtreo-control-button" id="
|
|
8187
|
-
|
|
8189
|
+
<!-- Switch Source Button (only shown when recording) -->
|
|
8190
|
+
<button class="vidtreo-control-button" id="btnSwitchSource" title="Switch Source" style="display: none;">
|
|
8191
|
+
<i class="ph-fill ph-monitor" id="iconSwitchSource" style="font-size: 24px;"></i>
|
|
8188
8192
|
</button>
|
|
8189
8193
|
|
|
8190
8194
|
<!-- Download Button -->
|
|
@@ -8192,6 +8196,7 @@ new RecorderWorker;
|
|
|
8192
8196
|
<i class="ph-fill ph-cloud-arrow-down" style="font-size: 24px;"></i>
|
|
8193
8197
|
</button>
|
|
8194
8198
|
|
|
8199
|
+
</div>
|
|
8195
8200
|
</div>
|
|
8196
8201
|
</div>
|
|
8197
8202
|
|
|
@@ -8205,6 +8210,12 @@ new RecorderWorker;
|
|
|
8205
8210
|
</div>
|
|
8206
8211
|
</div>
|
|
8207
8212
|
|
|
8213
|
+
<!-- Source Transition Overlay -->
|
|
8214
|
+
<div class="vidtreo-source-transition-overlay" id="sourceTransitionOverlay">
|
|
8215
|
+
<div class="vidtreo-transition-spinner"></div>
|
|
8216
|
+
<div class="vidtreo-transition-message" id="transitionMessage"></div>
|
|
8217
|
+
</div>
|
|
8218
|
+
|
|
8208
8219
|
</div>
|
|
8209
8220
|
|
|
8210
8221
|
<!-- Settings Panel -->
|
|
@@ -8213,7 +8224,7 @@ new RecorderWorker;
|
|
|
8213
8224
|
<!-- Settings Header -->
|
|
8214
8225
|
<button class="vidtreo-settings-header" id="btnSettingsBack" style="display:none;">
|
|
8215
8226
|
<div class="vidtreo-settings-back-icon">
|
|
8216
|
-
<i class="ph
|
|
8227
|
+
<i class="ph ph-caret-left" style="font-size: 20px;"></i>
|
|
8217
8228
|
</div>
|
|
8218
8229
|
<h3 class="vidtreo-settings-title" data-i18n="settings">Settings</h3>
|
|
8219
8230
|
</button>
|
|
@@ -8222,7 +8233,7 @@ new RecorderWorker;
|
|
|
8222
8233
|
<div class="vidtreo-device-options-container" id="settingsMain">
|
|
8223
8234
|
<button class="vidtreo-device-option-nav" id="btnCameraMenu">
|
|
8224
8235
|
<div class="vidtreo-device-option-nav-content">
|
|
8225
|
-
<i class="ph-fill ph-camera" style="font-size:
|
|
8236
|
+
<i class="ph-fill ph-video-camera" style="font-size: 20px;"></i>
|
|
8226
8237
|
<span class="vidtreo-device-option-nav-label" data-i18n="camera">Camera</span>
|
|
8227
8238
|
</div>
|
|
8228
8239
|
<div class="vidtreo-device-option-nav-value">
|
|
@@ -8233,7 +8244,7 @@ new RecorderWorker;
|
|
|
8233
8244
|
|
|
8234
8245
|
<button class="vidtreo-device-option-nav" id="btnMicMenu">
|
|
8235
8246
|
<div class="vidtreo-device-option-nav-content">
|
|
8236
|
-
<i class="ph-fill ph-microphone" style="font-size:
|
|
8247
|
+
<i class="ph-fill ph-microphone" style="font-size: 20px;"></i>
|
|
8237
8248
|
<span class="vidtreo-device-option-nav-label" data-i18n="microphone">Microphone</span>
|
|
8238
8249
|
</div>
|
|
8239
8250
|
<div class="vidtreo-device-option-nav-value">
|
|
@@ -8249,16 +8260,28 @@ new RecorderWorker;
|
|
|
8249
8260
|
</div>
|
|
8250
8261
|
</div>
|
|
8251
8262
|
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8263
|
+
|
|
8264
|
+
<!-- Configuration Error Overlay -->
|
|
8265
|
+
<div class="vidtreo-error-overlay" id="configErrorOverlay" style="display: none;">
|
|
8266
|
+
<div class="vidtreo-error-content">
|
|
8267
|
+
<div class="vidtreo-error-icon">
|
|
8268
|
+
<i class="ph-fill ph-warning-circle" style="font-size: 48px;"></i>
|
|
8269
|
+
</div>
|
|
8270
|
+
<div class="vidtreo-error-title" data-i18n="errorTitle">Configuration Error</div>
|
|
8271
|
+
<div class="vidtreo-error-message" id="configErrorMessageDefault" style="display: none;"></div>
|
|
8272
|
+
<div class="vidtreo-error-config" id="configErrorDetails" style="display: none;">
|
|
8273
|
+
<div class="vidtreo-error-config-title">Configuration Options:</div>
|
|
8274
|
+
<div class="vidtreo-error-config-item">
|
|
8275
|
+
<code>api-key</code> attribute: Pass the API key as an attribute to the component
|
|
8276
|
+
</div>
|
|
8277
|
+
</div>
|
|
8278
|
+
</div>
|
|
8279
|
+
</div>
|
|
8257
8280
|
|
|
8258
8281
|
<!-- Error Message -->
|
|
8259
8282
|
<div class="vidtreo-error" id="error" style="display: none;"></div>
|
|
8260
8283
|
</div>
|
|
8261
|
-
`;function cm(e,t){return e.querySelector(t)}let lm=/^https?:\/\//i;function um(e){return e?lm.test(e)?e:`https://${e}`:`https://api.vidtreo.com`}function dm(e,t){let n={apiKey:e.getAttribute(`api-key`),backendUrl:um(e.getAttribute(`backend-url`))},r=e.getAttribute(`countdown-duration`);if(r){let e=Number.parseInt(r,10);Number.isNaN(e)||(n.countdownDuration=e)}let a=e.getAttribute(`max-recording-time`);if(a){let e=Number.parseInt(a,10);Number.isNaN(e)||(n.maxRecordingTime=e)}let o=e.getAttribute(`user-metadata`);if(o)try{let e=JSON.parse(o);Object.assign(t,e),n.userMetadata=t}catch(e){throw Error(`Invalid user-metadata JSON: ${i(e)}`)}let s=e.getAttribute(`enable-source-switching`);n.enableSourceSwitching=s===null||s!==`false`;let c=e.getAttribute(`enable-mute`);n.enableMute=c===null||c!==`false`;let l=e.getAttribute(`enable-pause`);n.enablePause=l===null||l!==`false`;let u=e.getAttribute(`enable-device-change`);n.enableDeviceChange=u===null||u!==`false`;let d=e.getAttribute(`enable-tab-visibility-overlay`);return n.enableTabVisibilityOverlay=d!==null&&d!==`false`,n}function fm(){if(typeof document>`u`||document.querySelector(`script[src*="@phosphor-icons/web"]`))return;let e=document.createElement(`script`);e.src=`https://unpkg.com/@phosphor-icons/web`,e.async=!0,document.head.appendChild(e)}let pm={recordingState:`idle`,stream:null,isMuted:!1,isPaused:!1,error:null,countdown:null,timer:`00:00`,uploadProgress:null,transitionMessage:null,recordedBlob:null,devices:{cameras:[],microphones:[],selectedCamera:null,selectedMic:null}};var mm=class extends HTMLElement{constructor(...e){super(...e),this.controller=null,this.uploadService=null,this.state={...pm},this.config={},this.initialized=!1,this.videoPreview=null,this.audioBarsContainer=null,this.audioContext=null,this.analyser=null,this.animationFrameId=null,this.settingsView=`main`,this.slideDirection=`none`}static{this.observedAttributes=[`api-key`,`backend-url`,`countdown-duration`,`max-recording-time`,`user-metadata`,`enable-source-switching`,`enable-mute`,`enable-pause`,`enable-device-change`,`enable-tab-visibility-overlay`,`demo`]}get isDemo(){return this.hasAttribute(`demo`)&&this.getAttribute(`demo`)!==`false`}connectedCallback(){this.innerHTML=sm(),this.init()}disconnectedCallback(){this.cleanup()}attributeChangedCallback(e,t,n){t!==n&&this.initialized&&(e===`api-key`||e===`backend-url`)&&(this.cleanup(),this.init())}async init(){try{this.config=dm(this,{});let e=this.config.apiKey||``,t=this.config.backendUrl||``;this.isDemo||(this.uploadService=new om({apiKey:e,backendUrl:t})),this.controller=new mf(Xp(this));let n={...this.config};await this.controller.initialize(n),this.initialized=!0,this.videoPreview=cm(this,`#videoPreview`),this.audioBarsContainer=cm(this,`#audioLevelBars`),this.setupEventListeners(),fm(),setTimeout(()=>this.startPreview(),100)}catch(e){this.updateState({error:i(e)})}}cleanup(){this.controller&&=(this.controller.cleanup(),null),this.stopAudioAnalysis(),this.initialized=!1,this.state={...pm}}updateState(e){this.state={...this.state,...e},this.render(),e.stream!==void 0&&this.handleStreamUpdate(this.state.stream),this.state.devices.cameras.length===0&&this.state.stream&&this.updateDevices()}async updateDevices(){if(!this.controller)return;let e=this.controller.getDeviceManager(),t=await e.getAvailableDevices();this.updateState({devices:{cameras:t.videoinput,microphones:t.audioinput,selectedCamera:e.getSelectedCameraDeviceId(),selectedMic:e.getSelectedMicDeviceId()}})}handleStreamUpdate(e){this.videoPreview&&(e?(this.videoPreview.srcObject=e,this.videoPreview.style.display=`block`,this.videoPreview.play().catch(console.error),this.startAudioAnalysis(e)):(this.videoPreview.srcObject=null,this.videoPreview.style.display=`none`,this.stopAudioAnalysis()))}startAudioAnalysis(e){if(this.stopAudioAnalysis(),e.getAudioTracks().length!==0)try{this.audioContext=new AudioContext;let t=this.audioContext.createMediaStreamSource(e);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=64,t.connect(this.analyser);let n=new Uint8Array(this.analyser.frequencyBinCount),r=()=>{if(!this.analyser)return;this.analyser.getByteFrequencyData(n);let e=0;for(let t of n)e+=t;let t=e/n.length,i=Math.min(1,t/128);this.renderAudioBars(i),this.animationFrameId=requestAnimationFrame(r)};r()}catch(e){console.error(`Audio analysis setup failed`,e)}}stopAudioAnalysis(){this.animationFrameId&&=(cancelAnimationFrame(this.animationFrameId),null),this.audioContext&&=(this.audioContext.close(),null)}renderAudioBars(e){if(!this.audioBarsContainer)return;let t=[.8,1.2,.9],n=``;this.state.isMuted||t.forEach((t,r)=>{let i=Math.max(4,e*24*t);n+=`<div class="vidtreo-audio-level-bar" style="height: ${i}px;"></div>`}),this.audioBarsContainer.innerHTML=n}render(){this.renderPreviewSection(),this.renderIndicatorsSection(),this.renderButtonsSection(),this.renderStatusSection()}renderPreviewSection(){let e=this.state;this.toggleDisplay(`#startCameraArea`,!e.stream),this.toggleDisplay(`#videoPreview`,!!e.stream&&!e.transitionMessage),this.toggleDisplay(`#previewSkeleton`,!!e.transitionMessage),this.setText(`#transitionMessage`,e.transitionMessage||``)}renderIndicatorsSection(){let e=this.state,t=e.recordingState===`recording`||e.isPaused;this.toggleClass(`#countdownOverlay`,`vidtreo-active`,e.recordingState===`countdown`),this.setText(`#countdownNumber`,e.countdown?.toString()||``),this.toggleDisplay(`#recIndicatorTop`,t),this.toggleDisplay(`#recordingTimerRow`,t),this.setText(`#recordingTimer`,e.timer),this.toggleDisplay(`#audioLevelBars`,t),this.toggleDisplay(`#recordingControls`,!!e.stream)}renderButtonsSection(){let e=this.state,t=e.recordingState===`recording`||e.isPaused;this.toggleDisplay(`#btnSettings`,!t&&this.config.enableDeviceChange!==!1),this.toggleDisplay(`#btnSwitchSource`,t&&this.config.enableSourceSwitching!==!1),this.toggleDisplay(`#btnMute`,t&&this.config.enableMute!==!1),this.toggleDisplay(`#btnStop`,t),this.renderPauseButton(t),this.renderMuteButton();let n=this.isDemo&&!t&&e.recordingState===`idle`&&e.recordedBlob!==null;this.toggleDisplay(`#btnDownload`,n)}renderPauseButton(e){let t=this.state,n=cm(this,`#btnPause`),r=this.querySelector(`#iconPause`);n&&(t.isPaused?(n.title=`Resume`,r&&(r.className=`ph-fill ph-play`),n.onclick=()=>this.handleResume()):(n.title=`Pause`,r&&(r.className=`ph-fill ph-pause`),n.onclick=()=>this.handlePause()),n.style.display=e&&this.config.enablePause!==!1?`inline-flex`:`none`)}renderMuteButton(){let e=this.state,t=cm(this,`#btnMute`),n=this.querySelector(`#iconMute`);t&&(n&&(n.className=e.isMuted?`ph-fill ph-microphone-slash`:`ph-fill ph-microphone`),t.classList.toggle(`vidtreo-muted`,e.isMuted))}renderStatusSection(){let e=this.state;if(this.toggleDisplay(`#error`,!!e.error),this.setText(`#error`,e.error||``),this.renderUploadStatus(),e.recordingState!==`idle`){let e=this.querySelector(`#settingsPanel`);e&&e.classList.remove(`vidtreo-active`)}}renderUploadStatus(){let e=this.state;this.toggleDisplay(`#uploadProgressOverlay`,e.uploadProgress!==null);let t=this.querySelector(`#uploadProgressFill`);t&&e.uploadProgress!==null&&(t.style.width=`${Math.round(e.uploadProgress*100)}%`);let n=this.querySelector(`#uploadProgressText`);n&&e.uploadProgress!==null&&(n.textContent=`Uploading... ${Math.round(e.uploadProgress*100)}%`)}toggleDisplay(e,t){let n=this.querySelector(e);n&&(t?(e.includes(`row`)||e.includes(`controls`)||e.includes(`Overlay`)?n.style.display=`flex`:n.style.display=`block`,(e.includes(`control-button`)||e.includes(`record-button`))&&(n.style.display=`inline-flex`)):n.style.display=`none`)}toggleClass(e,t,n){let r=this.querySelector(e);r&&r.classList.toggle(t,n)}setText(e,t){let n=this.querySelector(e);n&&(n.textContent=t)}async startPreview(){if(this.controller)try{await this.controller.startStream(),this.updateState({stream:this.controller.getStream()})}catch(e){this.updateState({error:i(e)})}}async handleRecord(){if(this.controller)try{await $p(this.controller,`camera`)}catch(e){this.updateState({error:i(e)})}}async handleStop(){if(this.controller)try{let e=await em(this.controller,this.isDemo,()=>{},()=>{});if(this.isDemo&&e)this.updateState({recordedBlob:e});else if(!this.isDemo&&e){if(!this.uploadService)throw Error(`Upload service not ready`);let t=await md(e),n=`recording-${Date.now()}.mp4`;this.updateState({uploadProgress:0});try{let r=await this.uploadService.uploadVideo(e,{apiKey:this.config.apiKey||``,backendUrl:this.config.backendUrl||``,filename:n,duration:t,userMetadata:this.config.userMetadata,onProgress:e=>this.updateState({uploadProgress:e})});this.updateState({uploadProgress:null}),this.dispatchEvent(new CustomEvent(`upload-complete`,{detail:r}))}catch(e){throw this.updateState({uploadProgress:null}),e}}}catch(e){this.updateState({error:i(e)})}}handlePause(){this.controller&&tm(this.controller)}handleResume(){this.controller&&nm(this.controller)}handleDownload(){this.state.recordedBlob&&am(this.state.recordedBlob)}handleMute(){this.controller&&(im(this.controller),this.updateState({isMuted:this.controller.getIsMuted()}))}async handleSwitch(){if(!this.controller)return;let e=this.controller.getCurrentSourceType()===`camera`?`screen`:`camera`;try{await rm(this.controller,e)}catch(e){this.updateState({error:i(e)})}}setupEventListeners(){let e=(e,t)=>{let n=cm(this,e);n&&n.addEventListener(`click`,t)};e(`#btnRecord`,()=>this.handleRecord()),e(`#btnStop`,()=>this.handleStop()),e(`#btnPause`,()=>this.handlePause()),e(`#btnDownload`,()=>this.handleDownload()),e(`#btnMute`,()=>this.handleMute()),e(`#btnSwitchSource`,()=>this.handleSwitch());let t=this.querySelector(`#startCameraArea`);t&&t.addEventListener(`click`,()=>this.startPreview());let n=this.querySelector(`#btnSettings`),r=this.querySelector(`#settingsPanel`);n&&r&&n.addEventListener(`click`,()=>{r.classList.toggle(`vidtreo-active`),this.populateSettings()});let i=this.querySelector(`#btnSettingsBack`);i&&r&&i.addEventListener(`click`,()=>{}),this.setupSettingsListeners()}setupSettingsListeners(){let e=this.querySelector(`#btnCameraMenu`);e&&e.addEventListener(`click`,()=>this.navigateSettings(`camera`));let t=this.querySelector(`#btnMicMenu`);t&&t.addEventListener(`click`,()=>this.navigateSettings(`microphone`));let n=this.querySelector(`#btnSettingsBack`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),this.settingsView!==`main`&&this.navigateSettings(`main`)})}navigateSettings(e){e===`main`?this.slideDirection=`left`:this.slideDirection=`right`,this.settingsView=e,this.renderSettings(),setTimeout(()=>{this.slideDirection=`none`,this.renderSettings()},300)}renderSettings(){this.updateSettingsContent(),this.renderSettingsView()}updateSettingsContent(){let e=this.querySelector(`#settingsContent`);e&&(e.classList.remove(`vidtreo-slide-left`,`vidtreo-slide-right`,`vidtreo-slide-none`),this.slideDirection!==`none`&&e.classList.add(`vidtreo-slide-${this.slideDirection}`))}renderSettingsView(){let e=this.querySelector(`#settingsMain`),t=this.querySelector(`#cameraList`),n=this.querySelector(`#micList`),r=this.querySelector(`#btnSettingsBack`);e&&(e.style.display=`none`),t&&(t.style.display=`none`),n&&(n.style.display=`none`),r&&(r.style.display=`none`),this.settingsView===`main`?this.renderSettingsMain(e,r):this.settingsView===`camera`?this.renderSettingsCamera(t,r):this.settingsView===`microphone`&&this.renderSettingsMicrophone(n,r)}renderSettingsMain(e,t){e&&(e.style.display=`flex`);let n=this.querySelector(`.vidtreo-settings-title`),r=this.querySelector(`.vidtreo-settings-back-icon`);t&&(t.style.display=`flex`,t.style.cursor=`default`,t.onclick=null),n&&(n.textContent=`Settings`),r&&(r.style.display=`none`),this.updateCurrentDeviceLabels()}updateCurrentDeviceLabels(){let e=this.state.devices.cameras,t=this.state.devices.microphones,n=e.find(e=>e.deviceId===this.state.devices.selectedCamera),r=t.find(e=>e.deviceId===this.state.devices.selectedMic);this.setText(`#currentCameraName`,n?.label||`Default`),this.setText(`#currentMicName`,r?.label||`Default`)}renderSettingsCamera(e,t){e&&(e.style.display=`flex`,this.renderDeviceList(e,this.state.devices.cameras,this.state.devices.selectedCamera,`camera`));let n=this.querySelector(`.vidtreo-settings-title`),r=this.querySelector(`.vidtreo-settings-back-icon`);t&&(t.style.display=`flex`,t.style.cursor=`pointer`,t.onclick=()=>this.navigateSettings(`main`)),n&&(n.textContent=`Camera`),r&&(r.style.display=`block`)}renderSettingsMicrophone(e,t){e&&(e.style.display=`flex`,this.renderDeviceList(e,this.state.devices.microphones,this.state.devices.selectedMic,`mic`));let n=this.querySelector(`.vidtreo-settings-title`),r=this.querySelector(`.vidtreo-settings-back-icon`);t&&(t.style.display=`flex`,t.style.cursor=`pointer`,t.onclick=()=>this.navigateSettings(`main`)),n&&(n.textContent=`Microphone`),r&&(r.style.display=`block`)}renderDeviceList(e,t,n,r){if(!t||t.length===0){e.innerHTML=`<div class="vidtreo-device-empty">No devices found</div>`;return}e.innerHTML=``;for(let a of t){let t=document.createElement(`button`);t.className=`vidtreo-device-option`,t.innerHTML=`
|
|
8262
|
-
<div class="vidtreo-device-option-check-container">${a.deviceId===n?`<i class="ph-fill ph-check vidtreo-device-checkmark" style="display:
|
|
8284
|
+
`;function cm(e,t){return e.querySelector(t)}let lm=/^https?:\/\//i;function um(e){return e?lm.test(e)?e:`https://${e}`:`https://api.vidtreo.com`}function dm(e,t){let n={apiKey:e.getAttribute(`api-key`),backendUrl:um(e.getAttribute(`backend-url`))},r=e.getAttribute(`countdown-duration`);if(r){let e=Number.parseInt(r,10);Number.isNaN(e)||(n.countdownDuration=e)}let a=e.getAttribute(`max-recording-time`);if(a){let e=Number.parseInt(a,10);Number.isNaN(e)||(n.maxRecordingTime=e)}let o=e.getAttribute(`user-metadata`);if(o)try{let e=JSON.parse(o);Object.assign(t,e),n.userMetadata=t}catch(e){throw Error(`Invalid user-metadata JSON: ${i(e)}`)}let s=e.getAttribute(`enable-source-switching`);n.enableSourceSwitching=s===null||s!==`false`;let c=e.getAttribute(`enable-mute`);n.enableMute=c===null||c!==`false`;let l=e.getAttribute(`enable-pause`);n.enablePause=l===null||l!==`false`;let u=e.getAttribute(`enable-device-change`);n.enableDeviceChange=u===null||u!==`false`;let d=e.getAttribute(`enable-tab-visibility-overlay`);return n.enableTabVisibilityOverlay=d!==null&&d!==`false`,n}function fm(){if(typeof document>`u`||document.querySelector(`script[src*="@phosphor-icons/web"]`))return;let e=document.createElement(`script`);e.src=`https://unpkg.com/@phosphor-icons/web`,e.async=!0,document.head.appendChild(e)}let pm={recordingState:`idle`,stream:null,isMuted:!1,isPaused:!1,error:null,countdown:null,timer:`00:00`,uploadProgress:null,transitionMessage:null,recordedBlob:null,devices:{cameras:[],microphones:[],selectedCamera:null,selectedMic:null},configError:null};var mm=class extends HTMLElement{constructor(...e){super(...e),this.controller=null,this.uploadService=null,this.state={...pm},this.config={},this.initialized=!1,this.isInitializing=!1,this.videoPreview=null,this.audioBarsContainer=null,this.audioContext=null,this.analyser=null,this.animationFrameId=null,this.settingsView=`main`,this.slideDirection=`none`}static{this.observedAttributes=[`api-key`,`backend-url`,`countdown-duration`,`max-recording-time`,`user-metadata`,`enable-source-switching`,`enable-mute`,`enable-pause`,`enable-device-change`,`enable-tab-visibility-overlay`,`demo`]}get isDemo(){return this.hasAttribute(`demo`)&&this.getAttribute(`demo`)!==`false`}connectedCallback(){this.innerHTML=sm(),this.init()}disconnectedCallback(){this.cleanup()}attributeChangedCallback(e,t,n){t!==n&&[`api-key`,`backend-url`,`demo`].includes(e)&&(this.initialized&&this.cleanup(),this.init())}async init(){if(!this.isInitializing){this.isInitializing=!0;try{this.initialized&&this.cleanup(),this.config=dm(this,{});let e=this.config.apiKey||``,t=this.config.backendUrl||``;if(!(this.isDemo||e)){this.updateState({configError:Error(`apiKey is required. Provide it as an attribute or ensure demo mode is enabled.`)}),this.isInitializing=!1;return}this.isDemo||(this.uploadService=new om({apiKey:e,backendUrl:t})),this.controller=new mf(Xp(this));let n={...this.config};await this.controller.initialize(n),this.initialized=!0,this.updateState({configError:null}),this.videoPreview=cm(this,`#videoPreview`),this.audioBarsContainer=cm(this,`#audioLevelBars`),this.setupEventListeners(),fm(),setTimeout(()=>this.startPreview(),100)}catch(e){this.updateState({error:i(e)})}finally{this.isInitializing=!1}}}renderConfigError(){let e=this.state,t=!!e.configError;if(this.toggleDisplay(`#configErrorOverlay`,t),t&&e.configError){let t=e.configError.message.includes(`apiKey is required`);this.toggleDisplay(`#configErrorMessageDefault`,!t),this.toggleDisplay(`#configErrorDetails`,t),t||this.setText(`#configErrorMessageDefault`,e.configError.message)}}cleanup(){this.controller&&=(this.controller.cleanup(),null),this.stopAudioAnalysis(),this.initialized=!1,this.state={...pm}}updateState(e){this.state={...this.state,...e},this.render(),e.stream!==void 0&&this.handleStreamUpdate(this.state.stream),this.state.devices.cameras.length===0&&this.state.stream&&this.updateDevices()}async updateDevices(){if(!this.controller)return;let e=this.controller.getDeviceManager(),t=await e.getAvailableDevices();this.updateState({devices:{cameras:t.videoinput,microphones:t.audioinput,selectedCamera:e.getSelectedCameraDeviceId(),selectedMic:e.getSelectedMicDeviceId()}})}handleStreamUpdate(e){this.videoPreview&&(e?(this.videoPreview.srcObject=e,this.videoPreview.style.display=`block`,this.videoPreview.play().catch(console.error),this.startAudioAnalysis(e)):(this.videoPreview.srcObject=null,this.videoPreview.style.display=`none`,this.stopAudioAnalysis()))}startAudioAnalysis(e){if(this.stopAudioAnalysis(),e.getAudioTracks().length!==0)try{this.audioContext=new AudioContext;let t=this.audioContext.createMediaStreamSource(e);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=64,t.connect(this.analyser);let n=new Uint8Array(this.analyser.frequencyBinCount),r=()=>{if(!this.analyser)return;this.analyser.getByteFrequencyData(n);let e=0;for(let t of n)e+=t;let t=e/n.length,i=Math.min(1,t/128);this.renderAudioBars(i),this.animationFrameId=requestAnimationFrame(r)};r()}catch(e){console.error(`Audio analysis setup failed`,e)}}stopAudioAnalysis(){this.animationFrameId&&=(cancelAnimationFrame(this.animationFrameId),null),this.audioContext&&=(this.audioContext.close(),null)}renderAudioBars(e){if(!this.audioBarsContainer)return;let t=[.8,1.2,.9],n=``;this.state.isMuted||t.forEach((t,r)=>{let i=Math.max(4,e*24*t);n+=`<div class="vidtreo-audio-level-bar" style="height: ${i}px;"></div>`}),this.audioBarsContainer.innerHTML=n}render(){this.renderPreviewSection(),this.renderIndicatorsSection(),this.renderButtonsSection(),this.renderStatusSection(),this.renderConfigError()}renderPreviewSection(){let e=this.state;this.toggleDisplay(`#startCameraArea`,!e.stream),this.toggleDisplay(`#videoPreview`,!!e.stream&&!e.transitionMessage),this.toggleClass(`#sourceTransitionOverlay`,`vidtreo-active`,!!e.transitionMessage),this.setText(`#transitionMessage`,e.transitionMessage||``)}renderIndicatorsSection(){let e=this.state,t=e.recordingState===`recording`||e.isPaused;this.toggleClass(`#countdownOverlay`,`vidtreo-active`,e.recordingState===`countdown`),this.setText(`#countdownNumber`,e.countdown?.toString()||``),this.toggleDisplay(`#recIndicatorTop`,t),this.toggleDisplay(`#recordingTimerRow`,t),this.setText(`#recordingTimer`,e.timer),this.toggleDisplay(`#audioLevelBars`,t),this.toggleDisplay(`#recordingControls`,!!e.stream)}renderButtonsSection(){let e=this.state,t=e.recordingState===`recording`||e.isPaused;this.toggleDisplay(`#btnSettings`,!t&&this.config.enableDeviceChange!==!1),this.toggleDisplay(`#btnRecord`,e.recordingState===`idle`),this.toggleDisplay(`#btnMute`,t&&this.config.enableMute!==!1),this.toggleDisplay(`#btnStop`,t),this.toggleDisplay(`#btnSwitchSource`,t&&this.config.enableSourceSwitching!==!1),this.renderPauseButton(t),this.renderMuteButton();let n=this.isDemo&&!t&&e.recordingState===`idle`&&e.recordedBlob!==null;this.toggleDisplay(`#btnDownload`,n)}renderPauseButton(e){let t=this.state,n=cm(this,`#btnPause`),r=this.querySelector(`#iconPause`);n&&(t.isPaused?(n.title=`Resume`,r&&(r.className=`ph-fill ph-play`)):(n.title=`Pause`,r&&(r.className=`ph-fill ph-pause`)),n.style.display=e&&this.config.enablePause!==!1?`inline-flex`:`none`)}renderMuteButton(){let e=this.state,t=cm(this,`#btnMute`),n=this.querySelector(`#iconMute`);t&&(n&&(n.className=e.isMuted?`ph-fill ph-microphone-slash`:`ph-fill ph-microphone`),t.classList.toggle(`vidtreo-muted`,e.isMuted))}renderStatusSection(){let e=this.state;if(this.toggleDisplay(`#error`,!!e.error),this.setText(`#error`,e.error||``),this.renderUploadStatus(),e.recordingState!==`idle`){let e=this.querySelector(`#settingsPanel`);e&&e.classList.remove(`vidtreo-active`)}}renderUploadStatus(){let e=this.state;this.toggleDisplay(`#uploadProgressOverlay`,e.uploadProgress!==null);let t=this.querySelector(`#uploadProgressFill`);t&&e.uploadProgress!==null&&(t.style.width=`${Math.round(e.uploadProgress*100)}%`);let n=this.querySelector(`#uploadProgressText`);n&&e.uploadProgress!==null&&(n.textContent=`Uploading... ${Math.round(e.uploadProgress*100)}%`)}toggleDisplay(e,t){let n=this.querySelector(e);if(n)if(t){let t=n.tagName===`BUTTON`,r=e.includes(`row`)||e.includes(`controls`)||e.includes(`Overlay`)||e.includes(`Indicator`)||e.includes(`Timer`)||e.includes(`Bars`);t?n.style.display=`inline-flex`:r?n.style.display=`flex`:n.style.display=`block`}else n.style.display=`none`}toggleClass(e,t,n){let r=this.querySelector(e);r&&r.classList.toggle(t,n)}setText(e,t){let n=this.querySelector(e);n&&(n.textContent=t)}async startPreview(){if(this.controller)try{await this.controller.startStream(),this.updateState({stream:this.controller.getStream()})}catch(e){this.updateState({error:i(e)})}}async handleRecord(){if(this.controller)try{await $p(this.controller,`camera`)}catch(e){this.updateState({error:i(e)})}}async handleStop(){if(this.controller)try{let e=await em(this.controller,this.isDemo,()=>{},()=>{});if(this.isDemo&&e)this.updateState({recordedBlob:e});else if(!this.isDemo&&e){if(!this.uploadService)throw Error(`Upload service not ready`);let t=await md(e),n=`recording-${Date.now()}.mp4`;this.updateState({uploadProgress:0});try{let r=await this.uploadService.uploadVideo(e,{apiKey:this.config.apiKey||``,backendUrl:this.config.backendUrl||``,filename:n,duration:t,userMetadata:this.config.userMetadata,onProgress:e=>this.updateState({uploadProgress:e})});this.updateState({uploadProgress:null}),this.dispatchEvent(new CustomEvent(`upload-complete`,{detail:r}))}catch(e){throw this.updateState({uploadProgress:null}),e}}}catch(e){this.updateState({error:i(e)})}}handlePauseToggle(){this.controller&&(this.state.isPaused?nm(this.controller):tm(this.controller),this.updateState({isPaused:this.controller.isPaused()}))}handleDownload(){this.state.recordedBlob&&am(this.state.recordedBlob)}handleMute(){this.controller&&(im(this.controller),this.updateState({isMuted:this.controller.getIsMuted()}))}async handleSwitch(){if(!this.controller)return;let e=this.controller.getCurrentSourceType()===`camera`?`screen`:`camera`;try{await rm(this.controller,e)}catch(e){this.updateState({error:i(e)})}}setupEventListeners(){let e=(e,t)=>{let n=cm(this,e);n&&n.addEventListener(`click`,t)};e(`#btnRecord`,()=>this.handleRecord()),e(`#btnStop`,()=>this.handleStop()),e(`#btnPause`,()=>this.handlePauseToggle()),e(`#btnDownload`,()=>this.handleDownload()),e(`#btnMute`,()=>this.handleMute()),e(`#btnSwitchSource`,()=>this.handleSwitch());let t=this.querySelector(`#startCameraArea`);t&&t.addEventListener(`click`,()=>this.startPreview());let n=this.querySelector(`#btnSettings`),r=this.querySelector(`#settingsPanel`);n&&r&&n.addEventListener(`click`,()=>{r.classList.toggle(`vidtreo-active`),this.populateSettings()});let i=this.querySelector(`#btnSettingsBack`);i&&r&&i.addEventListener(`click`,()=>{}),this.setupSettingsListeners()}setupSettingsListeners(){let e=this.querySelector(`#btnCameraMenu`);e&&e.addEventListener(`click`,()=>this.navigateSettings(`camera`));let t=this.querySelector(`#btnMicMenu`);t&&t.addEventListener(`click`,()=>this.navigateSettings(`microphone`));let n=this.querySelector(`#btnSettingsBack`);n&&n.addEventListener(`click`,e=>{e.stopPropagation(),this.settingsView!==`main`&&this.navigateSettings(`main`)})}navigateSettings(e){e===`main`?this.slideDirection=`left`:this.slideDirection=`right`,this.settingsView=e,this.renderSettings(),setTimeout(()=>{this.slideDirection=`none`,this.renderSettings()},300)}renderSettings(){this.updateSettingsContent(),this.renderSettingsView()}updateSettingsContent(){let e=this.querySelector(`#settingsContent`);e&&(e.classList.remove(`vidtreo-slide-left`,`vidtreo-slide-right`,`vidtreo-slide-none`),this.slideDirection!==`none`&&e.classList.add(`vidtreo-slide-${this.slideDirection}`))}renderSettingsView(){let e=this.querySelector(`#settingsMain`),t=this.querySelector(`#cameraList`),n=this.querySelector(`#micList`),r=this.querySelector(`#btnSettingsBack`);e&&(e.style.display=`none`),t&&(t.style.display=`none`),n&&(n.style.display=`none`),r&&(r.style.display=`none`),this.settingsView===`main`?this.renderSettingsMain(e,r):this.settingsView===`camera`?this.renderSettingsCamera(t,r):this.settingsView===`microphone`&&this.renderSettingsMicrophone(n,r)}renderSettingsMain(e,t){e&&(e.style.display=`flex`),t&&(t.style.display=`none`),this.updateCurrentDeviceLabels()}updateCurrentDeviceLabels(){let e=this.state.devices.cameras.filter(e=>e.deviceId&&e.deviceId.trim()!==``),t=this.state.devices.microphones.filter(e=>e.deviceId&&e.deviceId.trim()!==``),n=e.find(e=>e.deviceId===this.state.devices.selectedCamera),r=t.find(e=>e.deviceId===this.state.devices.selectedMic),i=n?.label||e[0]?.label||`Camera`,a=r?.label||t[0]?.label||`Microphone`;this.setText(`#currentCameraName`,i),this.setText(`#currentMicName`,a)}renderSettingsCamera(e,t){e&&(e.style.display=`flex`,this.renderDeviceList(e,this.state.devices.cameras,this.state.devices.selectedCamera,`camera`));let n=this.querySelector(`.vidtreo-settings-title`),r=this.querySelector(`.vidtreo-settings-back-icon`);t&&(t.style.display=`flex`,t.style.cursor=`pointer`,t.onclick=()=>this.navigateSettings(`main`)),n&&(n.textContent=`Camera`),r&&(r.style.display=`flex`)}renderSettingsMicrophone(e,t){e&&(e.style.display=`flex`,this.renderDeviceList(e,this.state.devices.microphones,this.state.devices.selectedMic,`mic`));let n=this.querySelector(`.vidtreo-settings-title`),r=this.querySelector(`.vidtreo-settings-back-icon`);t&&(t.style.display=`flex`,t.style.cursor=`pointer`,t.onclick=()=>this.navigateSettings(`main`)),n&&(n.textContent=`Microphone`),r&&(r.style.display=`flex`)}renderDeviceList(e,t,n,r){if(!t||t.length===0){e.innerHTML=`<div class="vidtreo-device-empty">No devices found</div>`;return}e.innerHTML=``;for(let a of t){let t=document.createElement(`button`);t.className=`vidtreo-device-option`,t.innerHTML=`
|
|
8285
|
+
<div class="vidtreo-device-option-check-container">${a.deviceId===n?`<i class="ph-fill ph-check vidtreo-device-checkmark" style="display: flex; font-size: 20px;"></i>`:`<span class="vidtreo-device-checkmark-placeholder"></span>`}</div>
|
|
8263
8286
|
<span class="vidtreo-device-option-label">${a.label||`Device ${a.deviceId.slice(0,8)}`}</span>
|
|
8264
8287
|
`,t.onclick=()=>{this.controller&&(r===`camera`?Zp(this.controller,a.deviceId).then(e=>this.updateState({stream:e})).catch(e=>this.updateState({error:i(e)})):Qp(this.controller,a.deviceId).then(e=>this.updateState({stream:e})).catch(e=>this.updateState({error:i(e)})),r===`camera`&&(this.state.devices.selectedCamera=a.deviceId),r===`mic`&&(this.state.devices.selectedMic=a.deviceId),this.navigateSettings(`main`))},e.appendChild(t)}}populateSettings(){this.settingsView=`main`,this.slideDirection=`none`,this.renderSettings()}};return customElements.get(`vidtreo-recorder`)||customElements.define(`vidtreo-recorder`,mm),e.VidtreoRecorder=mm,e})({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidtreo/recorder-wc",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Web component for @vidtreo/recorder - video recording SDK",
|
|
6
6
|
"main": "./dist/vidtreo-recorder.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"author": "cfonseca@vidtreo.com",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@vidtreo/recorder": ">=0.9.
|
|
30
|
+
"@vidtreo/recorder": ">=0.9.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.10.1",
|