import{c as A}from"./@vueup/vue-quill.21cd2cdd.js";var Oe={exports:{}};(function(Te){/** * {@link https://github.com/muaz-khan/RecordRTC|RecordRTC} is a WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows. * @summary Record audio, video or screen inside the browser. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef RecordRTC * @class * @example * var recorder = RecordRTC(mediaStream or [arrayOfMediaStream], { * type: 'video', // audio or video or gif or canvas * recorderType: MediaStreamRecorder || CanvasRecorder || StereoAudioRecorder || Etc * }); * recorder.startRecording(); * @see For further information: * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc. * @param {object} config - {type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, desiredSampRate: 16000, video: HTMLVideoElement, etc.} */function S(i,e){if(!i)throw"First parameter is required.";e=e||{type:"video"},e=new ke(i,e);var t=this;function a(o){return e.disableLogs||console.log("RecordRTC version: ",t.version),o&&(e=new ke(i,o)),e.disableLogs||console.log("started recording "+e.type+" stream."),c?(c.clearRecordedData(),c.record(),g("recording"),t.recordingDuration&&l(),t):(s(function(){t.recordingDuration&&l()}),t)}function s(o){o&&(e.initCallback=function(){o(),o=e.initCallback=null});var m=new Ee(i,e);c=new m(i,e),c.record(),g("recording"),e.disableLogs||console.log("Initialized recorderType:",c.constructor.name,"for output-type:",e.type)}function d(o){if(o=o||function(){},!c){v();return}if(t.state==="paused"){t.resumeRecording(),setTimeout(function(){d(o)},1);return}t.state!=="recording"&&!e.disableLogs&&console.warn('Recording state should be: "recording", however current state is: ',t.state),e.disableLogs||console.log("Stopped recording "+e.type+" stream."),e.type!=="gif"?c.stop(m):(c.stop(),m()),g("stopped");function m(C){if(!c){typeof o.call=="function"?o.call(t,""):o("");return}Object.keys(c).forEach(function(w){typeof c[w]!="function"&&(t[w]=c[w])});var n=c.blob;if(!n)if(C)c.blob=n=C;else throw"Recording failed.";if(n&&!e.disableLogs&&console.log(n.type,"->",ge(n.size)),o){var u;try{u=U.createObjectURL(n)}catch(w){}typeof o.call=="function"?o.call(t,u):o(u)}!e.autoWriteToDisk||b(function(w){var y={};y[e.type+"Blob"]=w,G.Store(y)})}}function f(){if(!c){v();return}if(t.state!=="recording"){e.disableLogs||console.warn("Unable to pause the recording. Recording state: ",t.state);return}g("paused"),c.pause(),e.disableLogs||console.log("Paused recording.")}function r(){if(!c){v();return}if(t.state!=="paused"){e.disableLogs||console.warn("Unable to resume the recording. Recording state: ",t.state);return}g("recording"),c.resume(),e.disableLogs||console.log("Resumed recording.")}function h(o){postMessage(new FileReaderSync().readAsDataURL(o))}function b(o,m){if(!o)throw"Pass a callback function over getDataURL.";var C=m?m.blob:(c||{}).blob;if(!C){e.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout(function(){b(o,m)},1e3);return}if(typeof Worker!="undefined"&&!navigator.mozGetUserMedia){var n=w(h);n.onmessage=function(y){o(y.data)},n.postMessage(C)}else{var u=new FileReader;u.readAsDataURL(C),u.onload=function(y){o(y.target.result)}}function w(y){try{var L=U.createObjectURL(new Blob([y.toString(),"this.onmessage = function (eee) {"+y.name+"(eee.data);}"],{type:"application/javascript"})),k=new Worker(L);return U.revokeObjectURL(L),k}catch(I){}}}function l(o){if(o=o||0,t.state==="paused"){setTimeout(function(){l(o)},1e3);return}if(t.state!=="stopped"){if(o>=t.recordingDuration){d(t.onRecordingStopped);return}o+=1e3,setTimeout(function(){l(o)},1e3)}}function g(o){!t||(t.state=o,typeof t.onStateChanged.call=="function"?t.onStateChanged.call(t,o):t.onStateChanged(o))}var p='It seems that recorder is destroyed or "startRecording" is not invoked for '+e.type+" recorder.";function v(){e.disableLogs!==!0&&console.warn(p)}var c,R={startRecording:a,stopRecording:d,pauseRecording:f,resumeRecording:r,initRecorder:s,setRecordingDuration:function(o,m){if(typeof o=="undefined")throw"recordingDuration is required.";if(typeof o!="number")throw"recordingDuration must be a number.";return t.recordingDuration=o,t.onRecordingStopped=m||function(){},{onRecordingStopped:function(C){t.onRecordingStopped=C}}},clearRecordedData:function(){if(!c){v();return}c.clearRecordedData(),e.disableLogs||console.log("Cleared old recorded data.")},getBlob:function(){if(!c){v();return}return c.blob},getDataURL:b,toURL:function(){if(!c){v();return}return U.createObjectURL(c.blob)},getInternalRecorder:function(){return c},save:function(o){if(!c){v();return}xe(c.blob,o)},getFromDisk:function(o){if(!c){v();return}S.getFromDisk(e.type,o)},setAdvertisementArray:function(o){e.advertisement=[];for(var m=o.length,C=0;C-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),Q=!ae&&!ve&&!!navigator.webkitGetUserMedia||Me()||navigator.userAgent.toLowerCase().indexOf("chrome/")!==-1,de=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);de&&!Q&&navigator.userAgent.indexOf("CriOS")!==-1&&(de=!1,Q=!0);var N=window.MediaStream;typeof N=="undefined"&&typeof webkitMediaStream!="undefined"&&(N=webkitMediaStream),typeof N!="undefined"&&typeof N.prototype.stop=="undefined"&&(N.prototype.stop=function(){this.getTracks().forEach(function(i){i.stop()})});function ge(i){var e=1e3,t=["Bytes","KB","MB","GB","TB"];if(i===0)return"0 Bytes";var a=parseInt(Math.floor(Math.log(i)/Math.log(e)),10);return(i/Math.pow(e,a)).toPrecision(3)+" "+t[a]}function xe(i,e){if(!i)throw"Blob object is required.";if(!i.type)try{i.type="video/webm"}catch(f){}var t=(i.type||"video/webm").split("/")[1];if(t.indexOf(";")!==-1&&(t=t.split(";")[0]),e&&e.indexOf(".")!==-1){var a=e.split(".");e=a[0],t=a[1]}var s=(e||Math.round(Math.random()*9999999999)+888888888)+"."+t;if(typeof navigator.msSaveOrOpenBlob!="undefined")return navigator.msSaveOrOpenBlob(i,s);if(typeof navigator.msSaveBlob!="undefined")return navigator.msSaveBlob(i,s);var d=document.createElement("a");d.href=U.createObjectURL(i),d.download=s,d.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(d),typeof d.click=="function"?d.click():(d.target="_blank",d.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),U.revokeObjectURL(d.href)}function Me(){return typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&!!process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0}function x(i,e){return!i||!i.getTracks?[]:i.getTracks().filter(function(t){return t.kind===(e||"audio")})}function De(i,e){"srcObject"in e?e.srcObject=i:"mozSrcObject"in e?e.mozSrcObject=i:e.srcObject=i}function je(i,e){if(typeof EBML=="undefined")throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var t=new EBML.Reader,a=new EBML.Decoder,s=EBML.tools,d=new FileReader;d.onload=function(f){var r=a.decode(this.result);r.forEach(function(g){t.read(g)}),t.stop();var h=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),b=this.result.slice(t.metadataSize),l=new Blob([h,b],{type:"video/webm"});e(l)},d.readAsArrayBuffer(i)}typeof S!="undefined"&&(S.invokeSaveAsDialog=xe,S.getTracks=x,S.getSeekableBlob=je,S.bytesToSize=ge,S.isElectron=Me);/** * Storage is a standalone object used by {@link RecordRTC} to store reusable objects e.g. "new AudioContext". * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @example * Storage.AudioContext === webkitAudioContext * @property {webkitAudioContext} AudioContext - Keeps a reference to AudioContext object. * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} */var ie={};typeof ne!="undefined"?ie.AudioContext=ne:typeof webkitAudioContext!="undefined"&&(ie.AudioContext=webkitAudioContext),typeof S!="undefined"&&(S.Storage=ie);function _(){if(Ae||de||ve)return!0;var i=navigator.userAgent,e=""+parseFloat(navigator.appVersion),t=parseInt(navigator.appVersion,10),a,s;return(Q||ae)&&(a=i.indexOf("Chrome"),e=i.substring(a+7)),(s=e.indexOf(";"))!==-1&&(e=e.substring(0,s)),(s=e.indexOf(" "))!==-1&&(e=e.substring(0,s)),t=parseInt(""+e,10),isNaN(t)&&(e=""+parseFloat(navigator.appVersion),t=parseInt(navigator.appVersion,10)),t>=49}/** * MediaStreamRecorder is an abstraction layer for {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}. It is used by {@link RecordRTC} to record MediaStream(s) in both Chrome and Firefox. * @summary Runs top over {@link https://w3c.github.io/mediacapture-record/MediaRecorder.html|MediaRecorder API}. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://github.com/muaz-khan|Muaz Khan} * @typedef MediaStreamRecorder * @class * @example * var config = { * mimeType: 'video/webm', // vp8, vp9, h264, mkv, opus/vorbis * audioBitsPerSecond : 256 * 8 * 1024, * videoBitsPerSecond : 256 * 8 * 1024, * bitsPerSecond: 256 * 8 * 1024, // if this is provided, skip above two * checkForInactiveTracks: true, * timeSlice: 1000, // concatenate intervals based blobs * ondataavailable: function() {} // get intervals based blobs * } * var recorder = new MediaStreamRecorder(mediaStream, config); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * * // or * var blob = recorder.blob; * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API. * @param {object} config - {disableLogs:true, initCallback: function, mimeType: "video/webm", timeSlice: 1000} * @throws Will throw an error if first argument "MediaStream" is missing. Also throws error if "MediaRecorder API" are not supported by the browser. */function j(i,e){var l=this;if(typeof i=="undefined")throw'First argument "MediaStream" is required.';if(typeof MediaRecorder=="undefined")throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if(e=e||{mimeType:"video/webm"},e.type==="audio"){if(x(i,"video").length&&x(i,"audio").length){var t;navigator.mozGetUserMedia?(t=new N,t.addTrack(x(i,"audio")[0])):t=new N(x(i,"audio")),i=t}(!e.mimeType||e.mimeType.toString().toLowerCase().indexOf("audio")===-1)&&(e.mimeType=Q?"audio/webm":"audio/ogg"),e.mimeType&&e.mimeType.toString().toLowerCase()!=="audio/ogg"&&!!navigator.mozGetUserMedia&&(e.mimeType="audio/ogg")}var a=[];this.getArrayOfBlobs=function(){return a},this.record=function(){l.blob=null,l.clearRecordedData(),l.timestamps=[],b=[],a=[];var g=e;e.disableLogs||console.log("Passing following config over MediaRecorder API.",g),r&&(r=null),Q&&!_()&&(g="video/vp8"),typeof MediaRecorder.isTypeSupported=="function"&&g.mimeType&&(MediaRecorder.isTypeSupported(g.mimeType)||(e.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",g.mimeType),g.mimeType=e.type==="audio"?"audio/webm":"video/webm"));try{r=new MediaRecorder(i,g),e.mimeType=g.mimeType}catch(p){r=new MediaRecorder(i)}g.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&r.canRecordMimeType(g.mimeType)===!1&&(e.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",g.mimeType)),r.ondataavailable=function(p){if(p.data&&b.push("ondataavailable: "+ge(p.data.size)),typeof e.timeSlice=="number"){if(p.data&&p.data.size&&(a.push(p.data),s(),typeof e.ondataavailable=="function")){var v=e.getNativeBlob?p.data:new Blob([p.data],{type:d(g)});e.ondataavailable(v)}return}if(!p.data||!p.data.size||p.data.size<100||l.blob){l.recordingCallback&&(l.recordingCallback(new Blob([],{type:d(g)})),l.recordingCallback=null);return}l.blob=e.getNativeBlob?p.data:new Blob([p.data],{type:d(g)}),l.recordingCallback&&(l.recordingCallback(l.blob),l.recordingCallback=null)},r.onstart=function(){b.push("started")},r.onpause=function(){b.push("paused")},r.onresume=function(){b.push("resumed")},r.onstop=function(){b.push("stopped")},r.onerror=function(p){!p||(p.name||(p.name="UnknownError"),b.push("error: "+p),e.disableLogs||(p.name.toString().toLowerCase().indexOf("invalidstate")!==-1?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",p):p.name.toString().toLowerCase().indexOf("notsupported")!==-1?console.error("MIME type (",g.mimeType,") is not supported.",p):p.name.toString().toLowerCase().indexOf("security")!==-1?console.error("MediaRecorder security error",p):p.name==="OutOfMemory"?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",p):p.name==="IllegalStreamModification"?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",p):p.name==="OtherRecordingError"?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",p):p.name==="GenericError"?console.error("The UA cannot provide the codec or recording option that has been requested.",p):console.error("MediaRecorder Error",p)),function(v){if(!l.manuallyStopped&&r&&r.state==="inactive"){delete e.timeslice,r.start(10*60*1e3);return}setTimeout(v,1e3)}(),r.state!=="inactive"&&r.state!=="stopped"&&r.stop())},typeof e.timeSlice=="number"?(s(),r.start(e.timeSlice)):r.start(36e5),e.initCallback&&e.initCallback()},this.timestamps=[];function s(){l.timestamps.push(new Date().getTime()),typeof e.onTimeStamp=="function"&&e.onTimeStamp(l.timestamps[l.timestamps.length-1],l.timestamps)}function d(g){return r&&r.mimeType?r.mimeType:g.mimeType||"video/webm"}this.stop=function(g){g=g||function(){},l.manuallyStopped=!0,r&&(this.recordingCallback=g,r.state==="recording"&&r.stop(),typeof e.timeSlice=="number"&&setTimeout(function(){l.blob=new Blob(a,{type:d(e)}),l.recordingCallback(l.blob)},100))},this.pause=function(){!r||r.state==="recording"&&r.pause()},this.resume=function(){!r||r.state==="paused"&&r.resume()},this.clearRecordedData=function(){r&&r.state==="recording"&&l.stop(f),f()};function f(){a=[],r=null,l.timestamps=[]}var r;this.getInternalRecorder=function(){return r};function h(){if("active"in i){if(!i.active)return!1}else if("ended"in i&&i.ended)return!1;return!0}this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var b=[];this.getAllStates=function(){return b},typeof e.checkForInactiveTracks=="undefined"&&(e.checkForInactiveTracks=!1);var l=this;(function g(){if(!(!r||e.checkForInactiveTracks===!1)){if(h()===!1){e.disableLogs||console.log("MediaStream seems stopped."),l.stop();return}setTimeout(g,1e3)}})(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}typeof S!="undefined"&&(S.MediaStreamRecorder=j);/** * StereoAudioRecorder is a standalone class used by {@link RecordRTC} to bring "stereo" audio-recording in chrome. * @summary JavaScript standalone object for stereo audio recording. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef StereoAudioRecorder * @class * @example * var recorder = new StereoAudioRecorder(MediaStream, { * sampleRate: 44100, * bufferSize: 4096 * }); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API. * @param {object} config - {sampleRate: 44100, bufferSize: 4096, numberOfAudioChannels: 1, etc.} */function se(i,e){if(!x(i,"audio").length)throw"Your stream has no audio tracks.";e=e||{};var t=this,a=[],s=[],d=!1,f=0,r,h=2,b=e.desiredSampRate;e.leftChannel===!0&&(h=1),e.numberOfAudioChannels===1&&(h=1),(!h||h<1)&&(h=2),e.disableLogs||console.log("StereoAudioRecorder is set to record number of channels: "+h),typeof e.checkForInactiveTracks=="undefined"&&(e.checkForInactiveTracks=!0);function l(){if(e.checkForInactiveTracks===!1)return!0;if("active"in i){if(!i.active)return!1}else if("ended"in i&&i.ended)return!1;return!0}this.record=function(){if(l()===!1)throw"Please make sure MediaStream is active.";C(),u=m=!1,d=!0,typeof e.timeSlice!="undefined"&&L()};function g(k,I){function M(D,re){var V=D.numberOfAudioChannels,E=D.leftBuffers.slice(0),X=D.rightBuffers.slice(0),q=D.sampleRate,K=D.internalInterleavedLength,P=D.desiredSampRate;V===2&&(E=ye(E,K),X=ye(X,K),P&&(E=ee(E,P,q),X=ee(X,P,q))),V===1&&(E=ye(E,K),P&&(E=ee(E,P,q))),P&&(q=P);function ee(B,H,z){var W=Math.round(B.length*(H/z)),O=[],J=Number((B.length-1)/(W-1));O[0]=B[0];for(var te=1;te96e3)&&(e.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),e.disableLogs||e.desiredSampRate&&console.log("Desired sample-rate: "+e.desiredSampRate);var m=!1;this.pause=function(){m=!0},this.resume=function(){if(l()===!1)throw"Please make sure MediaStream is active.";if(!d){e.disableLogs||console.log("Seems recording has been restarted."),this.record();return}m=!1},this.clearRecordedData=function(){e.checkForInactiveTracks=!1,d&&this.stop(n),n()};function C(){a=[],s=[],f=0,u=!1,d=!1,m=!1,v=null,t.leftchannel=a,t.rightchannel=s,t.numberOfAudioChannels=h,t.desiredSampRate=b,t.sampleRate=o,t.recordingLength=f,y={left:[],right:[],recordingLength:0}}function n(){r&&(r.onaudioprocess=null,r.disconnect(),r=null),c&&(c.disconnect(),c=null),C()}this.name="StereoAudioRecorder",this.toString=function(){return this.name};var u=!1;function w(k){if(!m){if(l()===!1&&(e.disableLogs||console.log("MediaStream seems stopped."),r.disconnect(),d=!1),!d){c&&(c.disconnect(),c=null);return}u||(u=!0,e.onAudioProcessStarted&&e.onAudioProcessStarted(),e.initCallback&&e.initCallback());var I=k.inputBuffer.getChannelData(0),M=new Float32Array(I);if(a.push(M),h===2){var $=k.inputBuffer.getChannelData(1),D=new Float32Array($);s.push(D)}f+=T,t.recordingLength=f,typeof e.timeSlice!="undefined"&&(y.recordingLength+=T,y.left.push(M),h===2&&y.right.push(D))}}r.onaudioprocess=w,v.createMediaStreamDestination?r.connect(v.createMediaStreamDestination()):r.connect(v.destination),this.leftchannel=a,this.rightchannel=s,this.numberOfAudioChannels=h,this.desiredSampRate=b,this.sampleRate=o,t.recordingLength=f;var y={left:[],right:[],recordingLength:0};function L(){!d||typeof e.ondataavailable!="function"||typeof e.timeSlice=="undefined"||(y.left.length?(g({desiredSampRate:b,sampleRate:o,numberOfAudioChannels:h,internalInterleavedLength:y.recordingLength,leftBuffers:y.left,rightBuffers:h===1?[]:y.right},function(k,I){var M=new Blob([I],{type:"audio/wav"});e.ondataavailable(M),setTimeout(L,e.timeSlice)}),y={left:[],right:[],recordingLength:0}):setTimeout(L,e.timeSlice))}}typeof S!="undefined"&&(S.StereoAudioRecorder=se);/** * CanvasRecorder is a standalone class used by {@link RecordRTC} to bring HTML5-Canvas recording into video WebM. It uses HTML2Canvas library and runs top over {@link Whammy}. * @summary HTML2Canvas recording into video WebM. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef CanvasRecorder * @class * @example * var recorder = new CanvasRecorder(htmlElement, { disableLogs: true, useWhammyRecorder: true }); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {HTMLElement} htmlElement - querySelector/getElementById/getElementsByTagName[0]/etc. * @param {object} config - {disableLogs:true, initCallback: function} */function ue(i,e){if(typeof html2canvas=="undefined")throw"Please link: https://www.webrtc-experiment.com/screenshot.js";e=e||{},e.frameInterval||(e.frameInterval=10);var t=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach(function(R){R in document.createElement("canvas")&&(t=!0)});var a=(!!window.webkitRTCPeerConnection||!!window.webkitGetUserMedia)&&!!window.chrome,s=50,d=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);a&&d&&d[2]&&(s=parseInt(d[2],10)),a&&s<52&&(t=!1),e.useWhammyRecorder&&(t=!1);var f,r;if(t)if(e.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),i instanceof HTMLCanvasElement)f=i;else if(i instanceof CanvasRenderingContext2D)f=i.canvas;else throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";else navigator.mozGetUserMedia&&(e.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));var h;this.record=function(){if(h=!0,t&&!e.useWhammyRecorder){var R;"captureStream"in f?R=f.captureStream(25):"mozCaptureStream"in f?R=f.mozCaptureStream(25):"webkitCaptureStream"in f&&(R=f.webkitCaptureStream(25));try{var T=new N;T.addTrack(x(R,"video")[0]),R=T}catch(o){}if(!R)throw"captureStream API are NOT available.";r=new j(R,{mimeType:e.mimeType||"video/webm"}),r.record()}else c.frames=[],v=new Date().getTime(),p();e.initCallback&&e.initCallback()},this.getWebPImages=function(R){if(i.nodeName.toLowerCase()!=="canvas"){R();return}var T=c.frames.length;c.frames.forEach(function(o,m){var C=T-m;e.disableLogs||console.log(C+"/"+T+" frames remaining"),e.onEncodingCallback&&e.onEncodingCallback(C,T);var n=o.image.toDataURL("image/webp",1);c.frames[m].image=n}),e.disableLogs||console.log("Generating WebM"),R()},this.stop=function(R){h=!1;var T=this;if(t&&r){r.stop(R);return}this.getWebPImages(function(){c.compile(function(o){e.disableLogs||console.log("Recording finished!"),T.blob=o,T.blob.forEach&&(T.blob=new Blob([],{type:"video/webm"})),R&&R(T.blob),c.frames=[]})})};var b=!1;this.pause=function(){if(b=!0,r instanceof j){r.pause();return}},this.resume=function(){if(b=!1,r instanceof j){r.resume();return}h||this.record()},this.clearRecordedData=function(){h&&this.stop(l),l()};function l(){c.frames=[],h=!1,b=!1}this.name="CanvasRecorder",this.toString=function(){return this.name};function g(){var R=document.createElement("canvas"),T=R.getContext("2d");return R.width=i.width,R.height=i.height,T.drawImage(i,0,0),R}function p(){if(b)return v=new Date().getTime(),setTimeout(p,500);if(i.nodeName.toLowerCase()==="canvas"){var R=new Date().getTime()-v;v=new Date().getTime(),c.frames.push({image:g(),duration:R}),h&&setTimeout(p,e.frameInterval);return}html2canvas(i,{grabMouse:typeof e.showMousePointer=="undefined"||e.showMousePointer,onrendered:function(T){var o=new Date().getTime()-v;if(!o)return setTimeout(p,e.frameInterval);v=new Date().getTime(),c.frames.push({image:T.toDataURL("image/webp",1),duration:o}),h&&setTimeout(p,e.frameInterval)}})}var v=new Date().getTime(),c=new be.Video(100)}typeof S!="undefined"&&(S.CanvasRecorder=ue);/** * WhammyRecorder is a standalone class used by {@link RecordRTC} to bring video recording in Chrome. It runs top over {@link Whammy}. * @summary Video recording feature in Chrome. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef WhammyRecorder * @class * @example * var recorder = new WhammyRecorder(mediaStream); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API. * @param {object} config - {disableLogs: true, initCallback: function, video: HTMLVideoElement, etc.} */function fe(i,e){e=e||{},e.frameInterval||(e.frameInterval=10),e.disableLogs||console.log("Using frames-interval:",e.frameInterval),this.record=function(){e.width||(e.width=320),e.height||(e.height=240),e.video||(e.video={width:e.width,height:e.height}),e.canvas||(e.canvas={width:e.width,height:e.height}),h.width=e.canvas.width||320,h.height=e.canvas.height||240,b=h.getContext("2d"),e.video&&e.video instanceof HTMLVideoElement?(l=e.video.cloneNode(),e.initCallback&&e.initCallback()):(l=document.createElement("video"),De(i,l),l.onloadedmetadata=function(){e.initCallback&&e.initCallback()},l.width=e.video.width,l.height=e.video.height),l.muted=!0,l.play(),g=new Date().getTime(),p=new be.Video,e.disableLogs||(console.log("canvas resolutions",h.width,"*",h.height),console.log("video width/height",l.width||h.width,"*",l.height||h.height)),t(e.frameInterval)};function t(v){v=typeof v!="undefined"?v:10;var c=new Date().getTime()-g;if(!c)return setTimeout(t,v,v);if(f)return g=new Date().getTime(),setTimeout(t,100);g=new Date().getTime(),l.paused&&l.play(),b.drawImage(l,0,0,h.width,h.height),p.frames.push({duration:c,image:h.toDataURL("image/webp")}),d||setTimeout(t,v,v)}function a(v){var c=-1,R=v.length;(function T(){if(c++,c===R){v.callback();return}setTimeout(function(){v.functionToLoop(T,c)},1)})()}function s(v,c,R,T,o){var m=document.createElement("canvas");m.width=h.width,m.height=h.height;var C=m.getContext("2d"),n=[],u=c===-1,w=c&&c>0&&c<=v.length?c:v.length,y={r:0,g:0,b:0},L=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),k=R&&R>=0&&R<=1?R:0,I=T&&T>=0&&T<=1?T:0,M=!1;a({length:w,functionToLoop:function($,D){var re,V,E,X=function(){!M&&E-re<=E*I||(u&&(M=!0),n.push(v[D])),$()};if(M)X();else{var q=new Image;q.onload=function(){C.drawImage(q,0,0,h.width,h.height);var K=C.getImageData(0,0,h.width,h.height);re=0,V=K.data.length,E=K.data.length/4;for(var P=0;P0;)m.push(o&255),o=o>>8;return new Uint8Array(m.reverse())}function h(o){return new Uint8Array(o.split("").map(function(m){return m.charCodeAt(0)}))}function b(o){var m=[],C=o.length%8?new Array(9-o.length%8).join("0"):"";o=C+o;for(var n=0;n127)throw"TrackNumber > 127 not supported";var C=[o.trackNum|128,o.timecode>>8,o.timecode&255,m].map(function(n){return String.fromCharCode(n)}).join("")+o.frame;return C}function p(o){for(var m=o.RIFF[0].WEBP[0],C=m.indexOf("\x9D*"),n=0,u=[];n<4;n++)u[n]=m.charCodeAt(C+3+n);var w,y,L;return L=u[1]<<8|u[0],w=L&16383,L=u[3]<<8|u[2],y=L&16383,{width:w,height:y,data:m,riff:o}}function v(o,m){return parseInt(o.substr(m+4,4).split("").map(function(C){var n=C.charCodeAt(0).toString(2);return new Array(8-n.length+1).join("0")+n}).join(""),2)}function c(o){for(var m=0,C={};m1?w[0].width*2:w[0].width;var y=1;(n===3||n===4)&&(y=2),(n===5||n===6)&&(y=3),(n===7||n===8)&&(y=4),(n===9||n===10)&&(y=5),d.height=w[0].height*y}else d.width=r.width||360,d.height=r.height||240;u&&u instanceof HTMLVideoElement&&c(u),w.forEach(function(L,k){c(L,k)}),setTimeout(v,r.frameInterval)}}function c(n,u){if(!s){var w=0,y=0,L=n.width,k=n.height;u===1&&(w=n.width),u===2&&(y=n.height),u===3&&(w=n.width,y=n.height),u===4&&(y=n.height*2),u===5&&(w=n.width,y=n.height*2),u===6&&(y=n.height*3),u===7&&(w=n.width,y=n.height*3),typeof n.stream.left!="undefined"&&(w=n.stream.left),typeof n.stream.top!="undefined"&&(y=n.stream.top),typeof n.stream.width!="undefined"&&(L=n.stream.width),typeof n.stream.height!="undefined"&&(k=n.stream.height),f.drawImage(n,w,y,L,k),typeof n.stream.onRender=="function"&&n.stream.onRender(f,w,y,L,k,u)}}function R(){s=!1;var n=T(),u=o();return u&&u.getTracks().filter(function(w){return w.kind==="audio"}).forEach(function(w){n.addTrack(w)}),i.forEach(function(w){w.fullcanvas}),n}function T(){C();var n;"captureStream"in d?n=d.captureStream():"mozCaptureStream"in d?n=d.mozCaptureStream():r.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var u=new l;return n.getTracks().filter(function(w){return w.kind==="video"}).forEach(function(w){u.addTrack(w)}),d.stream=u,u}function o(){g.AudioContextConstructor||(g.AudioContextConstructor=new g.AudioContext),r.audioContext=g.AudioContextConstructor,r.audioSources=[],r.useGainNode===!0&&(r.gainNode=r.audioContext.createGain(),r.gainNode.connect(r.audioContext.destination),r.gainNode.gain.value=0);var n=0;if(i.forEach(function(u){if(!!u.getTracks().filter(function(y){return y.kind==="audio"}).length){n++;var w=r.audioContext.createMediaStreamSource(u);r.useGainNode===!0&&w.connect(r.gainNode),r.audioSources.push(w)}}),!!n)return r.audioDestination=r.audioContext.createMediaStreamDestination(),r.audioSources.forEach(function(u){u.connect(r.audioDestination)}),r.audioDestination.stream}function m(n){var u=document.createElement("video");return p(n,u),u.className=e,u.muted=!0,u.volume=0,u.width=n.width||r.width||360,u.height=n.height||r.height||240,u.play(),u}this.appendStreams=function(n){if(!n)throw"First parameter is required.";n instanceof Array||(n=[n]),n.forEach(function(u){var w=new l;if(u.getTracks().filter(function(k){return k.kind==="video"}).length){var y=m(u);y.stream=u,a.push(y),w.addTrack(u.getTracks().filter(function(k){return k.kind==="video"})[0])}if(u.getTracks().filter(function(k){return k.kind==="audio"}).length){var L=r.audioContext.createMediaStreamSource(u);r.audioDestination=r.audioContext.createMediaStreamDestination(),L.connect(r.audioDestination),w.addTrack(r.audioDestination.stream.getTracks().filter(function(k){return k.kind==="audio"})[0])}i.push(w)})},this.releaseStreams=function(){a=[],s=!0,r.gainNode&&(r.gainNode.disconnect(),r.gainNode=null),r.audioSources.length&&(r.audioSources.forEach(function(n){n.disconnect()}),r.audioSources=[]),r.audioDestination&&(r.audioDestination.disconnect(),r.audioDestination=null),r.audioContext&&r.audioContext.close(),r.audioContext=null,f.clearRect(0,0,d.width,d.height),d.stream&&(d.stream.stop(),d.stream=null)},this.resetVideoStreams=function(n){n&&!(n instanceof Array)&&(n=[n]),C(n)};function C(n){a=[],n=n||i,n.forEach(function(u){if(!!u.getTracks().filter(function(y){return y.kind==="video"}).length){var w=m(u);w.stream=u,a.push(w)}})}this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=R}typeof S=="undefined"&&(Te.exports=Be);/** * MultiStreamRecorder can record multiple videos in single container. * @summary Multi-videos recorder. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef MultiStreamRecorder * @class * @example * var options = { * mimeType: 'video/webm' * } * var recorder = new MultiStreamRecorder(ArrayOfMediaStreams, options); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * * // or * var blob = recorder.blob; * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStreams} mediaStreams - Array of MediaStreams. * @param {object} config - {disableLogs:true, frameInterval: 1, mimeType: "video/webm"} */function Ue(i,e){i=i||[];var t=this,a,s;e=e||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}},e.frameInterval||(e.frameInterval=10),e.video||(e.video={}),e.video.width||(e.video.width=360),e.video.height||(e.video.height=240),this.record=function(){a=new Be(i,e.elementClass||"multi-streams-mixer"),d().length&&(a.frameInterval=e.frameInterval||10,a.width=e.video.width||360,a.height=e.video.height||240,a.startDrawingFrames()),e.previewStream&&typeof e.previewStream=="function"&&e.previewStream(a.getMixedStream()),s=new j(a.getMixedStream(),e),s.record()};function d(){var f=[];return i.forEach(function(r){x(r,"video").forEach(function(h){f.push(h)})}),f}this.stop=function(f){!s||s.stop(function(r){t.blob=r,f(r),t.clearRecordedData()})},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),a&&(a.releaseStreams(),a=null)},this.addStreams=function(f){if(!f)throw"First parameter is required.";f instanceof Array||(f=[f]),i.concat(f),!(!s||!a)&&(a.appendStreams(f),e.previewStream&&typeof e.previewStream=="function"&&e.previewStream(a.getMixedStream()))},this.resetVideoStreams=function(f){!a||(f&&!(f instanceof Array)&&(f=[f]),a.resetVideoStreams(f))},this.getMixer=function(){return a},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}typeof S!="undefined"&&(S.MultiStreamRecorder=Ue);/** * RecordRTCPromisesHandler adds promises support in {@link RecordRTC}. Try a {@link https://github.com/muaz-khan/RecordRTC/blob/master/simple-demos/RecordRTCPromisesHandler.html|demo here} * @summary Promises for {@link RecordRTC} * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef RecordRTCPromisesHandler * @class * @example * var recorder = new RecordRTCPromisesHandler(mediaStream, options); * recorder.startRecording() * .then(successCB) * .catch(errorCB); * // Note: You can access all RecordRTC API using "recorder.recordRTC" e.g. * recorder.recordRTC.onStateChanged = function(state) {}; * recorder.recordRTC.setRecordingDuration(5000); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - Single media-stream object, array of media-streams, html-canvas-element, etc. * @param {object} config - {type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.} * @throws Will throw an error if "new" keyword is not used to initiate "RecordRTCPromisesHandler". Also throws error if first argument "MediaStream" is missing. * @requires {@link RecordRTC} */function ze(i,e){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(typeof i=="undefined")throw'First argument "MediaStream" is required.';var t=this;t.recordRTC=new S(i,e),this.startRecording=function(){return new Promise(function(a,s){try{t.recordRTC.startRecording(),a()}catch(d){s(d)}})},this.stopRecording=function(){return new Promise(function(a,s){try{t.recordRTC.stopRecording(function(d){if(t.blob=t.recordRTC.getBlob(),!t.blob||!t.blob.size){s("Empty blob.",t.blob);return}a(d)})}catch(d){s(d)}})},this.pauseRecording=function(){return new Promise(function(a,s){try{t.recordRTC.pauseRecording(),a()}catch(d){s(d)}})},this.resumeRecording=function(){return new Promise(function(a,s){try{t.recordRTC.resumeRecording(),a()}catch(d){s(d)}})},this.getDataURL=function(a){return new Promise(function(s,d){try{t.recordRTC.getDataURL(function(f){s(f)})}catch(f){d(f)}})},this.getBlob=function(){return new Promise(function(a,s){try{a(t.recordRTC.getBlob())}catch(d){s(d)}})},this.getInternalRecorder=function(){return new Promise(function(a,s){try{a(t.recordRTC.getInternalRecorder())}catch(d){s(d)}})},this.reset=function(){return new Promise(function(a,s){try{a(t.recordRTC.reset())}catch(d){s(d)}})},this.destroy=function(){return new Promise(function(a,s){try{a(t.recordRTC.destroy())}catch(d){s(d)}})},this.getState=function(){return new Promise(function(a,s){try{a(t.recordRTC.getState())}catch(d){s(d)}})},this.blob=null,this.version="5.6.2"}typeof S!="undefined"&&(S.RecordRTCPromisesHandler=ze);/** * WebAssemblyRecorder lets you create webm videos in JavaScript via WebAssembly. The library consumes raw RGBA32 buffers (4 bytes per pixel) and turns them into a webm video with the given framerate and quality. This makes it compatible out-of-the-box with ImageData from a CANVAS. With realtime mode you can also use webm-wasm for streaming webm videos. * @summary Video recording feature in Chrome, Firefox and maybe Edge. * @license {@link https://github.com/muaz-khan/RecordRTC/blob/master/LICENSE|MIT} * @author {@link https://MuazKhan.com|Muaz Khan} * @typedef WebAssemblyRecorder * @class * @example * var recorder = new WebAssemblyRecorder(mediaStream); * recorder.record(); * recorder.stop(function(blob) { * video.src = URL.createObjectURL(blob); * }); * @see {@link https://github.com/muaz-khan/RecordRTC|RecordRTC Source Code} * @param {MediaStream} mediaStream - MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API. * @param {object} config - {webAssemblyPath:'webm-wasm.wasm',workerPath: 'webm-worker.js', frameRate: 30, width: 1920, height: 1080, bitrate: 1024, realtime: true} */function oe(i,e){(typeof ReadableStream=="undefined"||typeof WritableStream=="undefined")&&console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),e=e||{},e.width=e.width||640,e.height=e.height||480,e.frameRate=e.frameRate||30,e.bitrate=e.bitrate||1200,e.realtime=e.realtime||!0;var t;function a(){return new ReadableStream({start:function(b){var l=document.createElement("canvas"),g=document.createElement("video"),p=!0;g.srcObject=i,g.muted=!0,g.height=e.height,g.width=e.width,g.volume=0,g.onplaying=function(){l.width=e.width,l.height=e.height;var v=l.getContext("2d"),c=1e3/e.frameRate,R=setInterval(function(){if(t&&(clearInterval(R),b.close()),p&&(p=!1,e.onVideoProcessStarted&&e.onVideoProcessStarted()),v.drawImage(g,0,0),b._controlledReadableStream.state!=="closed")try{b.enqueue(v.getImageData(0,0,e.width,e.height))}catch(o){}},c)},g.play()}})}var s;function d(b,l){if(!e.workerPath&&!l){t=!1,fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then(function(p){p.arrayBuffer().then(function(v){d(b,v)})});return}if(!e.workerPath&&l instanceof ArrayBuffer){var g=new Blob([l],{type:"text/javascript"});e.workerPath=U.createObjectURL(g)}e.workerPath||console.error("workerPath parameter is missing."),s=new Worker(e.workerPath),s.postMessage(e.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",function(p){p.data==="READY"?(s.postMessage({width:e.width,height:e.height,bitrate:e.bitrate||1200,timebaseDen:e.frameRate||30,realtime:e.realtime}),a().pipeTo(new WritableStream({write:function(v){if(t){console.error("Got image, but recorder is finished!");return}s.postMessage(v.data.buffer,[v.data.buffer])}}))):p.data&&(f||h.push(p.data))})}this.record=function(){h=[],f=!1,this.blob=null,d(i),typeof e.initCallback=="function"&&e.initCallback()};var f;this.pause=function(){f=!0},this.resume=function(){f=!1};function r(b){if(!s){b&&b();return}s.addEventListener("message",function(l){l.data===null&&(s.terminate(),s=null,b&&b())}),s.postMessage(null)}var h=[];this.stop=function(b){t=!0;var l=this;r(function(){l.blob=new Blob(h,{type:"video/webm"}),b(l.blob)})},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){h=[],f=!1,this.blob=null},this.blob=null}typeof S!="undefined"&&(S.WebAssemblyRecorder=oe)})(Oe);const Je=Oe.exports;export{Je as R};