"use strict";(globalThis.webpackChunkwordpress_particles=globalThis.webpackChunkwordpress_particles||[]).push([[6798],{6798:(e,t,s)=>{s.r(t),s.d(t,{loadExportVideoPlugin:()=>r});const o=["webm","ogg","mp4","x-matroska"],i=["vp9","vp9.0","vp8","vp8.0","avc1","av1","h265","h.265","h264","h.264","opus","pcm","aac","mpeg","mp4a"];class n{constructor(e,t){this._supportedTypes=[],this._exportVideo=async e=>{const t=this._container.canvas.element;if(t)return new Promise((s=>{const o=t.captureStream(e.fps??this._container.actualOptions.fpsLimit),i=e.mimeType??this._supportedTypes[0],n=new MediaRecorder(o,{mimeType:i}),p=[];n.addEventListener("dataavailable",(e=>{p.push(e.data)})),n.addEventListener("stop",(()=>{s(new Blob(p,{type:i}))})),n.start(),setTimeout((()=>{n.stop()}),e.duration??5e3)}))},this._container=e,this._engine=t,this._supportedTypes=function(){const e=MediaRecorder.isTypeSupported,t=[];return o.forEach((s=>{const o=`video/${s}`;i.forEach((s=>[`${o};codecs=${s}`,`${o};codecs=${s.toUpperCase()}`].forEach((s=>{e(s)&&t.push(s)})))),e(o)&&t.push(o)})),t}()}async export(e,t){const s={supported:!1};return"video"===e&&(s.supported=!0,s.blob=await this._exportVideo(t)),s}}class p{constructor(e){this.id="export-video",this._engine=e}getPlugin(e){return new n(e,this._engine)}loadOptions(){}needsPlugin(){return!0}}async function r(e,t=!0){await e.addPlugin(new p(e),t)}}}]);