text: var app=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function c(e){return"function"==typeof e}function r(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function i(e,t){e.appendChild(t)}function a(e,t,n){e.insertBefore(t,n||null)}function l(e){e.parentNode.removeChild(e)}function u(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function s(e){return document.createElement(e)}function d(e){return document.createTextNode(e)}function f(){return d(" ")}function p(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function m(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t){t=""+t,e.data!==t&&(e.data=t)}function h(e,t){for(let n=0;n<e.options.length;n+=1){const o=e.options[n];if(o.__value===t)return void(o.selected=!0)}}let v;function b(e){v=e}const y=[],$=[],_=[],x=[],w=Promise.resolve();let k=!1;function M(e){_.push(e)}let S=!1;const C=new Set;function E(){if(!S){S=!0;do{for(let e=0;e<y.length;e+=1){const t=y[e];b(t),D(t.$$)}for(y.length=0;$.length;)$.pop()();for(let e=0;e<_.length;e+=1){const t=_[e];C.has(t)||(C.add(t),t())}_.length=0}while(y.length);for(;x.length;)x.pop()();k=!1,S=!1,C.clear()}}function D(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(M)}}const N=new Set;function R(e,t){-1===e.$$.dirty[0]&&(y.push(e),k||(k=!0,w.then(E)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function A(r,i,a,u,s,d,f=[-1]){const p=v;b(r);const m=i.props||{},g=r.$$={fragment:null,ctx:null,props:d,update:e,not_equal:s,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(p?p.$$.context:[]),callbacks:n(),dirty:f};let h=!1;if(g.ctx=a?a(r,m,(e,t,...n)=>{const o=n.length?n[0]:t;return g.ctx&&s(g.ctx[e],g.ctx[e]=o)&&(g.bound[e]&&g.bound[e](o),h&&R(r,e)),t}):[],g.update(),h=!0,o(g.before_update),g.fragment=!!u&&u(g.ctx),i.target){if(i.hydrate){const e=function(e){return Array.from(e.childNodes)}(i.target);g.fragment&&g.fragment.l(e),e.forEach(l)}else g.fragment&&g.fragment.c();i.intro&&((y=r.$$.fragment)&&y.i&&(N.delete(y),y.i($))),function(e,n,r){const{fragment:i,on_mount:a,on_destroy:l,after_update:u}=e.$$;i&&i.m(n,r),M(()=>{const n=a.map(t).filter(c);l?l.push(...n):o(n),e.$$.on_mount=[]}),u.forEach(M)}(r,i.target,i.anchor),E()}var y,$;b(p)}function L(e,t,n){const o=e.slice();return o[15]=t[n],o[16]=t,o[17]=n,o}function T(e,t,n){const o=e.slice();return o[18]=t[n].label,o[19]=t[n].deviceId,o[20]=t[n].kind,o}function U(t){let n;return{c(){n=s("h2"),n.textContent="getUserMedia or MediaRecording API are not supported by your browser"},m(e,t){a(e,n,t)},p:e,d(e){e&&l(n)}}}function j(e){let t,n,o,c,r,d,g,v,b,y,$,_,x=e[2],w=[];for(let t=0;t<x.length;t+=1)w[t]=I(T(e,x,t));let k=e[4],S=[];for(let t=0;t<k.length;t+=1)S[t]=O(L(e,k,t));function C(e,t){return e[3]?q:P}let E=C(e),D=E(e);return{c(){t=s("div"),n=s("label"),o=s("span"),o.textContent="Select Microphone",c=f(),r=s("select");for(let e=0;e<w.length;e+=1)w[e].c();d=f(),g=s("div"),v=s("div"),v.textContent="Enable / Disable Media Constraints",b=f();for(let e=0;e<S.length;e+=1)S[e].c();y=f(),$=s("div"),D.c(),m(o,"class","text-label mr-5"),m(r,"class","voices"),void 0===e[1]&&M(()=>e[13].call(r)),m(t,"class","section"),m(g,"class","section flex-column"),m($,"class","section justify-content-center confirm")},m(l,u,s){a(l,t,u),i(t,n),i(n,o),i(n,c),i(n,r);for(let e=0;e<w.length;e+=1)w[e].m(r,null);h(r,e[1]),a(l,d,u),a(l,g,u),i(g,v),i(g,b);for(let e=0;e<S.length;e+=1)S[e].m(g,null);a(l,y,u),a(l,$,u),D.m($,null),s&&_(),_=p(r,"change",e[13])},p(e,t){if(4&t){let n;for(x=e[2],n=0;n<x.length;n+=1){const o=T(e,x,n);w[n]?w[n].p(o,t):(w[n]=I(o),w[n].c(),w[n].m(r,null))}for(;n<w.length;n+=1)w[n].d(1);w.length=x.length}if(2&t&&h(r,e[1]),16&t){let n;for(k=e[4],n=0;n<k.length;n+=1){const o=L(e,k,n);S[n]?S[n].p(o,t):(S[n]=O(o),S[n].c(),S[n].m(g,null))}for(;n<S.length;n+=1)S[n].d(1);S.length=k.length}E===(E=C(e))&&D?D.p(e,t):(D.d(1),D=E(e),D&&(D.c(),D.m($,null)))},d(e){e&&l(t),u(w,e),e&&l(d),e&&l(g),u(S,e),e&&l(y),e&&l($),D.d(),_()}}}function I(e){let t,n,o,c,r,u,p,m,h=e[18]+"",v=e[20]+"",b=e[19]+"";return{c(){t=s("option"),n=d(h),o=d(" - "),c=d(v),r=d(" - "),u=d(b),p=f(),t.__value=m=e[19],t.value=t.__value},m(e,l){a(e,t,l),i(t,n),i(t,o),i(t,c),i(t,r),i(t,u),i(t,p)},p(e,o){4&o&&h!==(h=e[18]+"")&&g(n,h),4&o&&v!==(v=e[20]+"")&&g(c,v),4&o&&b!==(b=e[19]+"")&&g(u,b),4&o&&m!==(m=e[19])&&(t.__value=m),t.value=t.__value},d(e){e&&l(t)}}}function O(e){let t,n,o,c,r,u,h,v=e[15].constraintName+"";function b(){e[14].call(n,e[15])}return{c(){t=s("label"),n=s("input"),o=f(),c=s("span"),r=d(v),u=f(),m(n,"type","checkbox"),m(n,"class","mr-5"),m(c,"class","text-label")},m(l,s,d){a(l,t,s),i(t,n),n.checked=e[15].enabled,i(t,o),i(t,c),i(c,r),i(t,u),d&&h(),h=p(n,"change",b)},p(t,o){e=t,16&o&&(n.checked=e[15].enabled),16&o&&v!==(v=e[15].constraintName+"")&&g(r,v)},d(e){e&&l(t),h()}}}function P(t){let n,o;return{c(){n=s("button"),n.innerHTML="<span>Record</span>",m(n,"class","primary")},m(e,c,r){a(e,n,c),r&&o(),o=p(n,"click",t[6])},p:e,d(e){e&&l(n),o()}}}function q(t){let n,o;return{c(){n=s("button"),n.innerHTML="<span>Stop</span>",m(n,"class","primary")},m(e,c,r){a(e,n,c),r&&o(),o=p(n,"click",t[7])},p:e,d(e){e&&l(n),o()}}}function B(t){let n;function o(e,t){return e[5]&&e[0]?j:U}let c=o(t),r=c(t);return{c(){n=s("div"),r.c(),m(n,"class","container")},m(e,t){a(e,n,t),r.m(n,null)},p(e,[t]){c===(c=o(e))&&r?r.p(e,t):(r.d(1),r=c(e),r&&(r.c(),r.m(n,null)))},i:e,o:e,d(e){e&&l(n),r.d()}}}function H(e,t,n){let o,c="MediaRecorder"in window,r=navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices,i="",a=[],l="webm",u="audio/webm; codecs=opus",s=!1,d=[];async function f(){if(!c||!r)return;MediaRecorder.isTypeSupported("audio/webm; codecs=opus")||(l="ogg",u="audio/ogg; codecs=opus"),await navigator.mediaDevices.getUserMedia({audio:!0});let e=await navigator.mediaDevices.enumerateDevices();if(n(2,a=e.filter(e=>"audioinput"===e.kind)),!a||0===a.length)return void n(0,r=!1);n(1,i=a[0].deviceId);let t=navigator.mediaDevices.getSupportedConstraints()||{};n(4,d=["autoGainControl","echoCancellation","noiseSuppression"].reduce((e,n)=>(t[n]&&e.push({constraintName:n,enabled:!0}),e),[]))}function p(e){let t=`audio_${d.reduce((e,t)=>e+=`${t.constraintName}_${t.enabled}_`,"")}0.${l}`,n=URL.createObjectURL(e),o=document.createElement("a");document.body.appendChild(o),o.style="display: none",o.href=n,o.download=t,o.click()}return f(),[r,i,a,s,d,c,async function(){i||(isOutputStreamNotSupported=!0);let e=[];const t=d.reduce((e,t)=>(e[t.constraintName]=t.enabled,e),{audio:{deviceId:{exact:i}}});let c=await navigator.mediaDevices.getUserMedia(t);o=new MediaRecorder(c,{mimeType:u,bitsPerSecond:128e3}),o.ondataavailable=t=>{t.data.size>0&&e.push(t.data)},o.onstop=()=>{let t=new Blob(e,{type:u});n(3,s=!1),c.getAudioTracks().forEach(e=>e.stop()),p(t)},o.onerror=e=>{console.log(e)},o.start(),n(3,s=!0)},function(){o&&"recording"===o.state&&o.stop()},l,u,o,f,p,function(){i=function(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}(this),n(1,i),n(2,a)},function(e){e.enabled=this.checked,n(4,d)}]}return new class extends class{$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}}{constructor(e){super(),A(this,e,H,B,r,{})}}({target:document.body})}();
  //# sourceMappingURL=bundle.js.map
  