@micromag/viewer-build 0.2.382 → 0.2.387
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/build/asset-manifest.json +41 -41
- package/build/index.html +1 -1
- package/build/static/css/{main.8d32c59f.chunk.css → main.7f2f5b5a.chunk.css} +2 -2
- package/build/static/css/{main.8d32c59f.chunk.css.map → main.7f2f5b5a.chunk.css.map} +1 -1
- package/build/static/js/0.d9088605.chunk.js +2 -0
- package/build/static/js/0.d9088605.chunk.js.map +1 -0
- package/build/static/js/1.879145d2.chunk.js +2 -0
- package/build/static/js/1.879145d2.chunk.js.map +1 -0
- package/build/static/js/10.fd9e9017.chunk.js +2 -0
- package/build/static/js/10.fd9e9017.chunk.js.map +1 -0
- package/build/static/js/11.d3ed28d2.chunk.js +2 -0
- package/build/static/js/11.d3ed28d2.chunk.js.map +1 -0
- package/build/static/js/12.2a2aa503.chunk.js +2 -0
- package/build/static/js/12.2a2aa503.chunk.js.map +1 -0
- package/build/static/js/13.af8da627.chunk.js +2 -0
- package/build/static/js/13.af8da627.chunk.js.map +1 -0
- package/build/static/js/{14.c979eb43.chunk.js → 14.e42f0789.chunk.js} +2 -2
- package/build/static/js/{14.c979eb43.chunk.js.map → 14.e42f0789.chunk.js.map} +1 -1
- package/build/static/js/{15.31f10001.chunk.js → 15.ad0fd5b3.chunk.js} +2 -2
- package/build/static/js/{15.31f10001.chunk.js.map → 15.ad0fd5b3.chunk.js.map} +1 -1
- package/build/static/js/{16.fc5c2b07.chunk.js → 16.d2386b37.chunk.js} +2 -2
- package/build/static/js/{16.fc5c2b07.chunk.js.map → 16.d2386b37.chunk.js.map} +1 -1
- package/build/static/js/{2.c4cf9c8a.chunk.js → 2.ccd0e24e.chunk.js} +2 -2
- package/build/static/js/2.ccd0e24e.chunk.js.map +1 -0
- package/build/static/js/5.da9ceed0.chunk.js +3 -0
- package/build/static/js/{5.489576ba.chunk.js.LICENSE.txt → 5.da9ceed0.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/5.da9ceed0.chunk.js.map +1 -0
- package/build/static/js/6.721b993c.chunk.js +2 -0
- package/build/static/js/6.721b993c.chunk.js.map +1 -0
- package/build/static/js/7.cfd16496.chunk.js +2 -0
- package/build/static/js/7.cfd16496.chunk.js.map +1 -0
- package/build/static/js/8.afddfbe6.chunk.js +2 -0
- package/build/static/js/8.afddfbe6.chunk.js.map +1 -0
- package/build/static/js/9.9ad1de75.chunk.js +2 -0
- package/build/static/js/9.9ad1de75.chunk.js.map +1 -0
- package/build/static/js/main.28a335a0.chunk.js +2 -0
- package/build/static/js/main.28a335a0.chunk.js.map +1 -0
- package/build/static/js/runtime-main.6cc96b7a.js +2 -0
- package/build/static/js/{runtime-main.db3c76f2.js.map → runtime-main.6cc96b7a.js.map} +1 -1
- package/package.json +7 -7
- package/build/static/js/0.ae1e2b23.chunk.js +0 -2
- package/build/static/js/0.ae1e2b23.chunk.js.map +0 -1
- package/build/static/js/1.dc635ac3.chunk.js +0 -2
- package/build/static/js/1.dc635ac3.chunk.js.map +0 -1
- package/build/static/js/10.c4c543ba.chunk.js +0 -2
- package/build/static/js/10.c4c543ba.chunk.js.map +0 -1
- package/build/static/js/11.926ced06.chunk.js +0 -2
- package/build/static/js/11.926ced06.chunk.js.map +0 -1
- package/build/static/js/12.08deb037.chunk.js +0 -2
- package/build/static/js/12.08deb037.chunk.js.map +0 -1
- package/build/static/js/13.3fbd8798.chunk.js +0 -2
- package/build/static/js/13.3fbd8798.chunk.js.map +0 -1
- package/build/static/js/2.c4cf9c8a.chunk.js.map +0 -1
- package/build/static/js/5.489576ba.chunk.js +0 -3
- package/build/static/js/5.489576ba.chunk.js.map +0 -1
- package/build/static/js/6.4ed08336.chunk.js +0 -2
- package/build/static/js/6.4ed08336.chunk.js.map +0 -1
- package/build/static/js/7.30c6cad9.chunk.js +0 -2
- package/build/static/js/7.30c6cad9.chunk.js.map +0 -1
- package/build/static/js/8.959d6a7c.chunk.js +0 -2
- package/build/static/js/8.959d6a7c.chunk.js.map +0 -1
- package/build/static/js/9.13a28a70.chunk.js +0 -2
- package/build/static/js/9.13a28a70.chunk.js.map +0 -1
- package/build/static/js/main.0b301599.chunk.js +0 -2
- package/build/static/js/main.0b301599.chunk.js.map +0 -1
- package/build/static/js/runtime-main.db3c76f2.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[7],{453:function(e,t,i){var r=i(457);function n(t,i,o){return"undefined"!==typeof Reflect&&Reflect.get?e.exports=n=Reflect.get:e.exports=n=function(e,t,i){var n=r(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(i):o.value}},n(t,i,o||t)}e.exports=n},457:function(e,t,i){var r=i(149);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},477:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(){return r("svg",{"aria-hidden":"true",focusable:"false",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55"},r("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z",fillRule:"evenodd"}))}},500:function(e,t,i){"use strict";var r=i(95),n={"audio/mp3":"mp3","audio/mp4":"mp4","audio/ogg":"ogg","audio/webm":"webm","image/gif":"gif","image/heic":"heic","image/heif":"heif","image/jpeg":"jpg","image/png":"png","image/svg+xml":"svg","video/mp4":"mp4","video/ogg":"ogv","video/quicktime":"mov","video/webm":"webm","video/x-matroska":"mkv","video/x-msvideo":"avi"};e.exports=function(e){var t=e.split(";",1);return e=r(t,1)[0],n[e]||null}},501:function(e,t,i){"use strict";e.exports=function(e,t,i){return new Promise((function(r){e.toBlob(r,t,i)}))}},502:function(e,t,i){"use strict";e.exports=function(){return"function"===typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"===typeof MediaRecorder.prototype.start}},503:function(e,t,i){"use strict";var r=i(19),n=i(20),o=i(24),s=i(25);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},a.apply(this,arguments)}var c=i(17),u=c.h,d=c.Component,p=i(504),l=i(505),h=i(506),g=i(508),v=i(509),m=i(510);function f(e,t){return-1!==e.indexOf(t)}var y=function(e){o(i,e);var t=s(i);function i(){return r(this,i),t.apply(this,arguments)}return n(i,[{key:"componentDidMount",value:function(){(0,this.props.onFocus)()}},{key:"componentWillUnmount",value:function(){(0,this.props.onStop)()}},{key:"render",value:function(){var e=this,t=this.props,i=t.src,r=t.recordedVideo,n=t.recording,o=t.modes,s=t.supportsRecording,c=t.videoSources,d=t.showVideoSourceDropdown,y=t.showRecordingLength,b=t.onSubmit,w=t.i18n,S=t.mirror,R=t.onSnapshot,k=t.onStartRecording,C=t.onStopRecording,x=t.onDiscardRecordedVideo,P=t.recordingLengthSeconds,I=!!r,M=!I&&s&&(f(o,"video-only")||f(o,"audio-only")||f(o,"video-audio")),T=!I&&f(o,"picture"),V=s&&y,L=d&&c&&c.length>1,D={playsinline:!0};return r?(D.muted=!1,D.controls=!0,D.src=r,this.videoElement&&(this.videoElement.srcObject=void 0)):(D.muted=!0,D.autoplay=!0,D.srcObject=i),u("div",{className:"uppy uppy-Webcam-container"},u("div",{className:"uppy-Webcam-videoContainer"},u("video",a({ref:function(t){return e.videoElement=t},className:"uppy-Webcam-video ".concat(S?"uppy-Webcam-video--mirrored":"")},D))),u("div",{className:"uppy-Webcam-footer"},u("div",{className:"uppy-Webcam-videoSourceContainer"},L?g(this.props):null),u("div",{className:"uppy-Webcam-buttonContainer"},T&&u(p,{onSnapshot:R,i18n:w}),M&&u(l,{recording:n,onStartRecording:k,onStopRecording:C,i18n:w}),I&&u(v,{onSubmit:b,i18n:w}),I&&u(m,{onDiscard:x,i18n:w})),V&&u("div",{className:"uppy-Webcam-recordingLength"},u(h,{recordingLengthSeconds:P,i18n:w}))))}}]),i}(d);e.exports=y},504:function(e,t,i){"use strict";var r=i(17).h,n=i(477);e.exports=function(e){var t=e.onSnapshot,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:i("takePicture"),"aria-label":i("takePicture"),onClick:t,"data-uppy-super-focusable":!0},n())}},505:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.recording,i=e.onStartRecording,n=e.onStopRecording,o=e.i18n;return t?r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("stopRecording"),"aria-label":o("stopRecording"),onClick:n,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("rect",{x:"15",y:"15",width:"70",height:"70"}))):r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:o("startRecording"),"aria-label":o("startRecording"),onClick:i,"data-uppy-super-focusable":!0},r("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"100",height:"100",viewBox:"0 0 100 100"},r("circle",{cx:"50",cy:"50",r:"40"})))}},506:function(e,t,i){"use strict";var r=i(17).h,n=i(507);e.exports=function(e){var t=e.recordingLengthSeconds,i=e.i18n,o=n(t);return r("span",{"aria-label":i("recordingLength",{recording_length:o})},o)}},507:function(e,t,i){"use strict";e.exports=function(e){return"".concat(Math.floor(e/60),":").concat(String(e%60).padStart(2,0))}},508:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.currentDeviceId,i=e.videoSources,n=e.onChangeVideoSource;return r("div",{className:"uppy-Webcam-videoSource"},r("select",{className:"uppy-u-reset uppy-Webcam-videoSource-select",onChange:function(e){n(e.target.value)}},i.map((function(e){return r("option",{key:e.deviceId,value:e.deviceId,selected:e.deviceId===t},e.label)}))))}},509:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onSubmit,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit",type:"button",title:i("submitRecordedFile"),"aria-label":i("submitRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"12",height:"9",viewBox:"0 0 12 9",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("path",{fill:"#fff",fillRule:"nonzero",d:"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z"})))}},510:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){var t=e.onDiscard,i=e.i18n;return r("button",{className:"uppy-u-reset uppy-c-btn uppy-Webcam-button",type:"button",title:i("discardRecordedFile"),"aria-label":i("discardRecordedFile"),onClick:t,"data-uppy-super-focusable":!0},r("svg",{width:"13",height:"13",viewBox:"0 0 13 13",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",className:"uppy-c-icon"},r("g",{fill:"#FFF",fillRule:"evenodd"},r("path",{d:"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z"}),r("path",{d:"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z"}))))}},511:function(e,t,i){"use strict";var r=i(17).h;e.exports=function(e){return r("div",{className:"uppy-Webcam-permissons"},r("div",{className:"uppy-Webcam-permissonsIcon"},e.icon()),r("h1",{className:"uppy-Webcam-title"},e.hasCamera?e.i18n("allowAccessTitle"):e.i18n("noCameraTitle")),r("p",null,e.hasCamera?e.i18n("allowAccessDescription"):e.i18n("noCameraDescription")))}},535:function(e,t,i){"use strict";var r,n,o,s=i(51),a=i(226),c=i(29),u=i(19),d=i(20),p=i(56),l=i(453),h=i(149),g=i(24),v=i(25);function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(this,arguments)}function f(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var y=0;function b(e){return"__private_"+y+++"_"+e}var w=i(17).h,S=i(53).UIPlugin,R=i(500),k=i(232),C=i(501),x=i(502),P=i(477),I=i(503),M=i(511);function T(e){return"."===e[0]?k[e.slice(1)]:e}function V(e){return/^video\/[^*]+$/.test(e)}function L(e){return/^image\/[^*]+$/.test(e)}e.exports=(n=b("enableMirror"),o=r=function(e){g(i,e);var t=v(i);function i(e,r){var o;u(this,i),o=t.call(this,e,r),Object.defineProperty(p(o),n,{writable:!0,value:void 0}),o.mediaDevices=navigator.mediaDevices,o.supportsUserMedia=!!o.mediaDevices,o.protocol=location.protocol.match(/https/i)?"https":"http",o.id=o.opts.id||"Webcam",o.type="acquirer",o.capturedMediaFile=null,o.icon=function(){return w("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},w("g",{fill:"none",fillRule:"evenodd"},w("rect",{className:"uppy-ProviderIconBg",fill:"#03BFEF",width:"32",height:"32",rx:"16"}),w("path",{d:"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z",fill:"#FFF",fillRule:"nonzero"})))},o.defaultLocale={strings:{pluginNameCamera:"Camera",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site.",noCameraTitle:"Camera Not Available",noCameraDescription:"In order to take pictures or record video, please connect a camera device",recordingStoppedMaxSize:"Recording stopped because the file size is about to exceed the limit",recordingLength:"Recording length %{recording_length}",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file"}};var s={onBeforeSnapshot:function(){return Promise.resolve()},countdown:!1,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,showVideoSourceDropdown:!1,facingMode:"user",preferredImageMimeType:null,preferredVideoMimeType:null,showRecordingLength:!1};return o.opts=c(c({},s),r),o.i18nInit(),o.title=o.i18n("pluginNameCamera"),f(p(o),n)[n]=o.opts.mirror,o.install=o.install.bind(p(o)),o.setPluginState=o.setPluginState.bind(p(o)),o.render=o.render.bind(p(o)),o.start=o.start.bind(p(o)),o.stop=o.stop.bind(p(o)),o.takeSnapshot=o.takeSnapshot.bind(p(o)),o.startRecording=o.startRecording.bind(p(o)),o.stopRecording=o.stopRecording.bind(p(o)),o.discardRecordedVideo=o.discardRecordedVideo.bind(p(o)),o.submit=o.submit.bind(p(o)),o.oneTwoThreeSmile=o.oneTwoThreeSmile.bind(p(o)),o.focus=o.focus.bind(p(o)),o.changeVideoSource=o.changeVideoSource.bind(p(o)),o.webcamActive=!1,o.opts.countdown&&(o.opts.onBeforeSnapshot=o.oneTwoThreeSmile),o.setPluginState({hasCamera:!1,cameraReady:!1,cameraError:null,recordingLengthSeconds:0,videoSources:[],currentDeviceId:null}),o}return d(i,[{key:"setOptions",value:function(e){l(h(i.prototype),"setOptions",this).call(this,c(c({},e),{},{videoConstraints:c(c({},this.opts.videoConstraints),null==e?void 0:e.videoConstraints)}))}},{key:"hasCameraCheck",value:function(){return this.mediaDevices?this.mediaDevices.enumerateDevices().then((function(e){return e.some((function(e){return"videoinput"===e.kind}))})):Promise.resolve(!1)}},{key:"isAudioOnly",value:function(){return 1===this.opts.modes.length&&"audio-only"===this.opts.modes[0]}},{key:"getConstraints",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),i=!this.isAudioOnly()&&(-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("video-only")||-1!==this.opts.modes.indexOf("picture")),r=c(c({},this.opts.videoConstraints||{facingMode:this.opts.facingMode}),e?{deviceId:e,facingMode:null}:{});return{audio:t,video:!!i&&r}}},{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.supportsUserMedia)return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0,this.opts.mirror&&(f(this,n)[n]=!0);var i=this.getConstraints(t&&t.deviceId?t.deviceId:null);this.hasCameraCheck().then((function(r){return e.setPluginState({hasCamera:r}),e.mediaDevices.getUserMedia(i).then((function(i){e.stream=i;var r=null,n=e.isAudioOnly()?i.getAudioTracks():i.getVideoTracks();t&&t.deviceId?n.forEach((function(e){e.getSettings().deviceId===t.deviceId&&(r=e.getSettings().deviceId)})):r=n[0].getSettings().deviceId,e.updateVideoSources(),e.setPluginState({currentDeviceId:r,cameraReady:!0})})).catch((function(t){e.setPluginState({cameraReady:!1,cameraError:t}),e.uppy.info(t.message,"error")}))}))}},{key:"getMediaRecorderOptions",value:function(){var e={};if(MediaRecorder.isTypeSupported){var t=this.uppy.opts.restrictions,i=[];this.opts.preferredVideoMimeType?i=[this.opts.preferredVideoMimeType]:t.allowedFileTypes&&(i=t.allowedFileTypes.map(T).filter(V));var r=i.filter((function(e){return MediaRecorder.isTypeSupported(e)&&R(e)}));r.length>0&&(e.mimeType=r[0])}return e}},{key:"startRecording",value:function(){var e=this;this.recorder=new MediaRecorder(this.stream,this.getMediaRecorderOptions()),this.recordingChunks=[];var t=!1;this.recorder.addEventListener("dataavailable",(function(i){e.recordingChunks.push(i.data);var r=e.uppy.opts.restrictions;if(e.recordingChunks.length>1&&null!=r.maxFileSize&&!t){var n=e.recordingChunks.reduce((function(e,t){return e+t.size}),0),o=3*((n-e.recordingChunks[0].size)/(e.recordingChunks.length-1));n>Math.max(0,r.maxFileSize-o)&&(t=!0,e.uppy.info(e.i18n("recordingStoppedMaxSize"),"warning",4e3),e.stopRecording())}})),this.recorder.start(500),this.opts.showRecordingLength&&(this.recordingLengthTimer=setInterval((function(){var t=e.getPluginState().recordingLengthSeconds;e.setPluginState({recordingLengthSeconds:t+1})}),1e3)),this.setPluginState({isRecording:!0})}},{key:"stopRecording",value:function(){var e=this;return new Promise((function(t){e.recorder.addEventListener("stop",(function(){t()})),e.recorder.stop(),e.opts.showRecordingLength&&(clearInterval(e.recordingLengthTimer),e.setPluginState({recordingLengthSeconds:0}))})).then((function(){return e.setPluginState({isRecording:!1}),e.getVideo()})).then((function(t){try{e.capturedMediaFile=t,e.setPluginState({recordedVideo:URL.createObjectURL(t.data)}),f(e,n)[n]=!1}catch(i){i.isRestriction||e.uppy.log(i)}})).then((function(){e.recordingChunks=null,e.recorder=null}),(function(t){throw e.recordingChunks=null,e.recorder=null,t}))}},{key:"discardRecordedVideo",value:function(){this.setPluginState({recordedVideo:null}),this.opts.mirror&&(f(this,n)[n]=!0),this.capturedMediaFile=null}},{key:"submit",value:function(){try{this.capturedMediaFile&&this.uppy.addFile(this.capturedMediaFile)}catch(e){e.isRestriction||this.uppy.log(e,"error")}}},{key:"stop",value:function(){var e=a(s.mark((function e(){var t,i,r=this;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.stream&&(t=this.stream.getAudioTracks(),i=this.stream.getVideoTracks(),t.concat(i).forEach((function(e){return e.stop()}))),!this.recorder){e.next=4;break}return e.next=4,new Promise((function(e){r.recorder.addEventListener("stop",e,{once:!0}),r.recorder.stop(),r.opts.showRecordingLength&&clearInterval(r.recordingLengthTimer)}));case 4:this.recordingChunks=null,this.recorder=null,this.webcamActive=!1,this.stream=null,this.setPluginState({recordedVideo:null,isRecording:!1,recordingLengthSeconds:0});case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getVideoElement",value:function(){return this.el.querySelector(".uppy-Webcam-video")}},{key:"oneTwoThreeSmile",value:function(){var e=this;return new Promise((function(t,i){var r=e.opts.countdown,n=setInterval((function(){if(!e.webcamActive)return clearInterval(n),e.captureInProgress=!1,i(new Error("Webcam is not active"));r>0?(e.uppy.info("".concat(r,"..."),"warning",800),r--):(clearInterval(n),e.uppy.info(e.i18n("smile"),"success",1500),setTimeout((function(){return t()}),1500))}),1e3)}))}},{key:"takeSnapshot",value:function(){var e=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch((function(t){var i="object"===typeof t?t.message:t;return e.uppy.info(i,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: ".concat(i)))})).then((function(){return e.getImage()})).then((function(t){e.captureInProgress=!1;try{e.uppy.addFile(t)}catch(i){i.isRestriction||e.uppy.log(i)}}),(function(t){throw e.captureInProgress=!1,t})))}},{key:"getImage",value:function(){var e=this,t=this.getVideoElement();if(!t)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var i=t.videoWidth,r=t.videoHeight,n=document.createElement("canvas");n.width=i,n.height=r,n.getContext("2d").drawImage(t,0,0);var o=this.uppy.opts.restrictions,s=[];this.opts.preferredImageMimeType?s=[this.opts.preferredImageMimeType]:o.allowedFileTypes&&(s=o.allowedFileTypes.map(T).filter(L));var a=s[0]||"image/jpeg",c=R(a)||"jpg",u="cam-".concat(Date.now(),".").concat(c);return C(n,a).then((function(t){return{source:e.id,name:u,data:new Blob([t],{type:a}),type:a}}))}},{key:"getVideo",value:function(){var e=this.recordingChunks.find((function(e){var t;return(null==(t=e.type)?void 0:t.length)>0})).type,t=R(e);if(!t)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'.concat(e,'"')));var i="webcam-".concat(Date.now(),".").concat(t),r=new Blob(this.recordingChunks,{type:e}),n={source:this.id,name:i,data:new Blob([r],{type:e}),type:e};return Promise.resolve(n)}},{key:"focus",value:function(){var e=this;this.opts.countdown&&setTimeout((function(){e.uppy.info(e.i18n("smile"),"success",1500)}),1e3)}},{key:"changeVideoSource",value:function(e){this.stop(),this.start({deviceId:e})}},{key:"updateVideoSources",value:function(){var e=this;this.mediaDevices.enumerateDevices().then((function(t){e.setPluginState({videoSources:t.filter((function(e){return"videoinput"===e.kind}))})}))}},{key:"render",value:function(){this.webcamActive||this.start();var e=this.getPluginState();return e.cameraReady&&e.hasCamera?w(I,m({},e,{onChangeVideoSource:this.changeVideoSource,onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onDiscardRecordedVideo:this.discardRecordedVideo,onSubmit:this.submit,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,showRecordingLength:this.opts.showRecordingLength,showVideoSourceDropdown:this.opts.showVideoSourceDropdown,supportsRecording:x(),recording:e.isRecording,mirror:f(this,n)[n],src:this.stream})):w(M,{icon:P,i18n:this.i18n,hasCamera:e.hasCamera})}},{key:"install",value:function(){var e=this;this.setPluginState({cameraReady:!1,recordingLengthSeconds:0});var t=this.opts.target;t&&this.mount(t,this),this.mediaDevices&&(this.updateVideoSources(),this.mediaDevices.ondevicechange=function(){if(e.updateVideoSources(),e.stream){var t=!0,i=e.getPluginState(),r=i.videoSources,n=i.currentDeviceId;r.forEach((function(e){n===e.deviceId&&(t=!1)})),t&&(e.stop(),e.start())}})}},{key:"uninstall",value:function(){this.stop(),this.unmount()}},{key:"onUnmount",value:function(){this.stop()}}]),i}(S),r.VERSION="2.0.4",o)}}]);
|
|
2
|
-
//# sourceMappingURL=7.30c6cad9.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/get.js","../../../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/superPropBase.js","../../../node_modules/@uppy/webcam/lib/CameraIcon.js","../../../node_modules/@uppy/utils/lib/getFileTypeExtension.js","../../../node_modules/@uppy/utils/lib/canvasToBlob.js","../../../node_modules/@uppy/webcam/lib/supportsMediaRecorder.js","../../../node_modules/@uppy/webcam/lib/CameraScreen.js","../../../node_modules/@uppy/webcam/lib/SnapshotButton.js","../../../node_modules/@uppy/webcam/lib/RecordButton.js","../../../node_modules/@uppy/webcam/lib/RecordingLength.js","../../../node_modules/@uppy/webcam/lib/formatSeconds.js","../../../node_modules/@uppy/webcam/lib/VideoSourceSelect.js","../../../node_modules/@uppy/webcam/lib/SubmitButton.js","../../../node_modules/@uppy/webcam/lib/DiscardButton.js","../../../node_modules/@uppy/webcam/lib/PermissionsScreen.js","../../../node_modules/@uppy/webcam/lib/index.js"],"names":["superPropBase","_get","target","property","receiver","Reflect","get","module","exports","base","desc","Object","getOwnPropertyDescriptor","call","value","getPrototypeOf","object","prototype","hasOwnProperty","h","require","focusable","fill","width","height","viewBox","d","fillRule","mimeToExtensions","mimeType","split","canvas","type","quality","Promise","resolve","toBlob","MediaRecorder","start","_extends","assign","i","arguments","length","source","key","apply","this","Component","SnapshotButton","RecordButton","RecordingLength","VideoSourceSelect","SubmitButton","DiscardButton","isModeAvailable","modes","mode","indexOf","CameraScreen","onFocus","props","onStop","src","recordedVideo","recording","supportsRecording","videoSources","showVideoSourceDropdown","showRecordingLength","onSubmit","i18n","mirror","onSnapshot","onStartRecording","onStopRecording","onDiscardRecordedVideo","recordingLengthSeconds","hasRecordedVideo","shouldShowRecordButton","shouldShowSnapshotButton","shouldShowRecordingLength","shouldShowVideoSourceDropdown","videoProps","playsinline","muted","controls","videoElement","srcObject","undefined","autoplay","className","ref","onDiscard","CameraIcon","title","onClick","x","y","cx","cy","r","formatSeconds","formattedRecordingLengthSeconds","recording_length","seconds","Math","floor","String","padStart","currentDeviceId","onChangeVideoSource","onChange","event","map","videoSource","deviceId","selected","label","xmlns","icon","hasCamera","_class","_enableMirror","_temp","_classPrivateFieldLooseBase","privateKey","TypeError","id","_classPrivateFieldLooseKey","name","UIPlugin","getFileTypeExtension","mimeTypes","canvasToBlob","supportsMediaRecorder","PermissionsScreen","toMimeType","fileType","slice","isVideoMimeType","test","isImageMimeType","uppy","opts","defineProperty","writable","mediaDevices","navigator","supportsUserMedia","protocol","location","match","capturedMediaFile","rx","defaultLocale","strings","pluginNameCamera","smile","takePicture","startRecording","stopRecording","allowAccessTitle","allowAccessDescription","noCameraTitle","noCameraDescription","recordingStoppedMaxSize","recordingLength","submitRecordedFile","discardRecordedFile","defaultOptions","onBeforeSnapshot","countdown","facingMode","preferredImageMimeType","preferredVideoMimeType","i18nInit","install","bind","setPluginState","render","stop","takeSnapshot","discardRecordedVideo","submit","oneTwoThreeSmile","focus","changeVideoSource","webcamActive","cameraReady","cameraError","newOpts","videoConstraints","enumerateDevices","then","devices","some","device","kind","acceptsAudio","acceptsVideo","isAudioOnly","audio","video","options","reject","Error","constraints","getConstraints","hasCameraCheck","getUserMedia","stream","tracks","getAudioTracks","getVideoTracks","forEach","track","getSettings","updateVideoSources","err","info","message","isTypeSupported","restrictions","preferredVideoMimeTypes","allowedFileTypes","filter","acceptableMimeTypes","candidateType","recorder","getMediaRecorderOptions","recordingChunks","stoppingBecauseOfMaxSize","addEventListener","push","data","maxFileSize","totalSize","reduce","acc","chunk","size","expectedEndChunkSize","max","recordingLengthTimer","setInterval","currentRecordingLength","getPluginState","isRecording","clearInterval","getVideo","file","URL","createObjectURL","isRestriction","log","error","addFile","audioTracks","videoTracks","concat","once","el","querySelector","count","countDown","captureInProgress","setTimeout","getImage","tagFile","getVideoElement","videoWidth","videoHeight","document","createElement","getContext","drawImage","preferredImageMimeTypes","ext","Date","now","blob","Blob","find","_blob$type","fileExtension","webcamState","mount","ondevicechange","restartStream","unmount","VERSION"],"mappings":"2HAAA,IAAIA,EAAgB,EAAQ,KAE5B,SAASC,EAAKC,EAAQC,EAAUC,GAiB9B,MAhBuB,qBAAZC,SAA2BA,QAAQC,IAC5CC,EAAOC,QAAUP,EAAOI,QAAQC,IAEhCC,EAAOC,QAAUP,EAAO,SAAcC,EAAQC,EAAUC,GACtD,IAAIK,EAAOT,EAAcE,EAAQC,GACjC,GAAKM,EAAL,CACA,IAAIC,EAAOC,OAAOC,yBAAyBH,EAAMN,GAEjD,OAAIO,EAAKJ,IACAI,EAAKJ,IAAIO,KAAKT,GAGhBM,EAAKI,QAITb,EAAKC,EAAQC,EAAUC,GAAYF,GAG5CK,EAAOC,QAAUP,G,oBCtBjB,IAAIc,EAAiB,EAAQ,KAW7BR,EAAOC,QATP,SAAwBQ,EAAQb,GAC9B,MAAQQ,OAAOM,UAAUC,eAAeL,KAAKG,EAAQb,IAEpC,QADfa,EAASD,EAAeC,MAI1B,OAAOA,I,iCCNT,IACEG,EACEC,EAAQ,IADVD,EAGFZ,EAAOC,QAAU,WACf,OAAOW,EAAE,MAAO,CACd,cAAe,OACfE,UAAW,QACXC,KAAM,UACNC,MAAO,KACPC,OAAQ,KACRC,QAAS,aACRN,EAAE,OAAQ,CACXO,EAAG,ueACHC,SAAU,e,6CCdRC,EAAmB,CACvB,YAAa,MACb,YAAa,MACb,YAAa,MACb,aAAc,OACd,YAAa,MACb,aAAc,OACd,aAAc,OACd,aAAc,MACd,YAAa,MACb,gBAAiB,MACjB,YAAa,MACb,YAAa,MACb,kBAAmB,MACnB,aAAc,OACd,mBAAoB,MACpB,kBAAmB,OAGrBrB,EAAOC,QAAU,SAA8BqB,GAAU,MAG1CA,EAASC,MAAM,IAAK,GACjC,OADCD,EAHsD,UAIhDD,EAAiBC,IAAa,O,iCCjBvC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,KAAM4E,GAAeA,GACzD5D,IAAKhB,KAAKoK,UAxBHhM,EAAEqH,EAAmB,CAC1BhB,KAAM1B,EACNvB,KAAMxB,KAAKwB,KACXkD,UAAWqK,EAAYrK,cAnhB2E,qBA4iBxG,WAAU,WACR1E,KAAKoI,eAAe,CAClBU,aAAa,EACbhH,uBAAwB,IAE1B,IACE3E,EACE6C,KAAKiG,KADP9I,OAGEA,GACF6C,KAAKgP,MAAM7R,EAAQ6C,MAGjBA,KAAKoG,eACPpG,KAAK2K,qBAEL3K,KAAKoG,aAAa6I,eAAiB,WAGjC,GAFA,EAAKtE,qBAED,EAAKP,OAAQ,CACf,IAAI8E,GAAgB,EACpB,EAGI,EAAK1C,iBAFPpL,EADF,EACEA,aACA2C,EAFF,EAEEA,gBAEF3C,EAAaoJ,SAAQ,SAAApG,GACfL,IAAoBK,EAAYC,WAClC6K,GAAgB,MAIhBA,IACF,EAAK5G,OACL,EAAK/I,cA7kByF,uBAolBxG,WACES,KAAKsI,OACLtI,KAAKmP,YAtlBiG,uBAylBxG,WACEnP,KAAKsI,WA1lBiG,GAAwBlD,GA6lB9HT,EAAOyK,QAAU,QAASvK","file":"static/js/7.30c6cad9.chunk.js","sourcesContent":["var superPropBase = require(\"./superPropBase\");\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nmodule.exports = _get;","var getPrototypeOf = require(\"./getPrototypeOf\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = () => {\n return h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n fill: \"#0097DC\",\n width: \"66\",\n height: \"55\",\n viewBox: \"0 0 66 55\"\n }, h(\"path\", {\n d: \"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z\",\n fillRule: \"evenodd\"\n }));\n};","\"use strict\";\n\nconst mimeToExtensions = {\n 'audio/mp3': 'mp3',\n 'audio/mp4': 'mp4',\n 'audio/ogg': 'ogg',\n 'audio/webm': 'webm',\n 'image/gif': 'gif',\n 'image/heic': 'heic',\n 'image/heif': 'heif',\n 'image/jpeg': 'jpg',\n 'image/png': 'png',\n 'image/svg+xml': 'svg',\n 'video/mp4': 'mp4',\n 'video/ogg': 'ogv',\n 'video/quicktime': 'mov',\n 'video/webm': 'webm',\n 'video/x-matroska': 'mkv',\n 'video/x-msvideo': 'avi'\n};\n\nmodule.exports = function getFileTypeExtension(mimeType) {\n // Remove the ; bit in 'video/x-matroska;codecs=avc1'\n // eslint-disable-next-line no-param-reassign\n [mimeType] = mimeType.split(';', 1);\n return mimeToExtensions[mimeType] || null;\n};","\"use strict\";\n\n/**\n * Save a <canvas> element's content to a Blob object.\n *\n * @param {HTMLCanvasElement} canvas\n * @returns {Promise}\n */\nmodule.exports = function canvasToBlob(canvas, type, quality) {\n return new Promise(resolve => {\n canvas.toBlob(resolve, type, quality);\n });\n};","\"use strict\";\n\nmodule.exports = function supportsMediaRecorder() {\n /* eslint-disable compat/compat */\n return typeof MediaRecorder === 'function' && !!MediaRecorder.prototype && typeof MediaRecorder.prototype.start === 'function';\n /* eslint-enable compat/compat */\n};","\"use strict\";\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\n/* eslint-disable jsx-a11y/media-has-caption */\nconst {\n h,\n Component\n} = require('preact');\n\nconst SnapshotButton = require('./SnapshotButton');\n\nconst RecordButton = require('./RecordButton');\n\nconst RecordingLength = require('./RecordingLength');\n\nconst VideoSourceSelect = require('./VideoSourceSelect');\n\nconst SubmitButton = require('./SubmitButton');\n\nconst DiscardButton = require('./DiscardButton');\n\nfunction isModeAvailable(modes, mode) {\n return modes.indexOf(mode) !== -1;\n}\n\nclass CameraScreen extends Component {\n componentDidMount() {\n const {\n onFocus\n } = this.props;\n onFocus();\n }\n\n componentWillUnmount() {\n const {\n onStop\n } = this.props;\n onStop();\n }\n\n render() {\n const {\n src,\n recordedVideo,\n recording,\n modes,\n supportsRecording,\n videoSources,\n showVideoSourceDropdown,\n showRecordingLength,\n onSubmit,\n i18n,\n mirror,\n onSnapshot,\n onStartRecording,\n onStopRecording,\n onDiscardRecordedVideo,\n recordingLengthSeconds\n } = this.props;\n const hasRecordedVideo = !!recordedVideo;\n const shouldShowRecordButton = !hasRecordedVideo && supportsRecording && (isModeAvailable(modes, 'video-only') || isModeAvailable(modes, 'audio-only') || isModeAvailable(modes, 'video-audio'));\n const shouldShowSnapshotButton = !hasRecordedVideo && isModeAvailable(modes, 'picture');\n const shouldShowRecordingLength = supportsRecording && showRecordingLength;\n const shouldShowVideoSourceDropdown = showVideoSourceDropdown && videoSources && videoSources.length > 1;\n const videoProps = {\n playsinline: true\n };\n\n if (recordedVideo) {\n videoProps.muted = false;\n videoProps.controls = true;\n videoProps.src = recordedVideo; // reset srcObject in dom. If not resetted, stream sticks in element\n\n if (this.videoElement) {\n this.videoElement.srcObject = undefined;\n }\n } else {\n videoProps.muted = true;\n videoProps.autoplay = true;\n videoProps.srcObject = src;\n }\n\n return h(\"div\", {\n className: \"uppy uppy-Webcam-container\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoContainer\"\n }, h(\"video\", _extends({\n /* eslint-disable-next-line no-return-assign */\n ref: videoElement => this.videoElement = videoElement,\n className: `uppy-Webcam-video ${mirror ? 'uppy-Webcam-video--mirrored' : ''}`\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n\n }, videoProps))), h(\"div\", {\n className: \"uppy-Webcam-footer\"\n }, h(\"div\", {\n className: \"uppy-Webcam-videoSourceContainer\"\n }, shouldShowVideoSourceDropdown ? VideoSourceSelect(this.props) : null), h(\"div\", {\n className: \"uppy-Webcam-buttonContainer\"\n }, shouldShowSnapshotButton && h(SnapshotButton, {\n onSnapshot: onSnapshot,\n i18n: i18n\n }), shouldShowRecordButton && h(RecordButton, {\n recording: recording,\n onStartRecording: onStartRecording,\n onStopRecording: onStopRecording,\n i18n: i18n\n }), hasRecordedVideo && h(SubmitButton, {\n onSubmit: onSubmit,\n i18n: i18n\n }), hasRecordedVideo && h(DiscardButton, {\n onDiscard: onDiscardRecordedVideo,\n i18n: i18n\n })), shouldShowRecordingLength && h(\"div\", {\n className: \"uppy-Webcam-recordingLength\"\n }, h(RecordingLength, {\n recordingLengthSeconds: recordingLengthSeconds,\n i18n: i18n\n }))));\n }\n\n}\n\nmodule.exports = CameraScreen;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst CameraIcon = require('./CameraIcon');\n\nmodule.exports = ({\n onSnapshot,\n i18n\n}) => {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture\",\n type: \"button\",\n title: i18n('takePicture'),\n \"aria-label\": i18n('takePicture'),\n onClick: onSnapshot,\n \"data-uppy-super-focusable\": true\n }, CameraIcon());\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = function RecordButton({\n recording,\n onStartRecording,\n onStopRecording,\n i18n\n}) {\n if (recording) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('stopRecording'),\n \"aria-label\": i18n('stopRecording'),\n onClick: onStopRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"rect\", {\n x: \"15\",\n y: \"15\",\n width: \"70\",\n height: \"70\"\n })));\n }\n\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('startRecording'),\n \"aria-label\": i18n('startRecording'),\n onClick: onStartRecording,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\",\n width: \"100\",\n height: \"100\",\n viewBox: \"0 0 100 100\"\n }, h(\"circle\", {\n cx: \"50\",\n cy: \"50\",\n r: \"40\"\n })));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nconst formatSeconds = require('./formatSeconds');\n\nmodule.exports = function RecordingLength({\n recordingLengthSeconds,\n i18n\n}) {\n const formattedRecordingLengthSeconds = formatSeconds(recordingLengthSeconds);\n return h(\"span\", {\n \"aria-label\": i18n('recordingLength', {\n recording_length: formattedRecordingLengthSeconds\n })\n }, formattedRecordingLengthSeconds);\n};","\"use strict\";\n\n/**\n * Takes an Integer value of seconds (e.g. 83) and converts it into a human-readable formatted string (e.g. '1:23').\n *\n * @param {Integer} seconds\n * @returns {string} the formatted seconds (e.g. '1:23' for 1 minute and 23 seconds)\n *\n */\nmodule.exports = function formatSeconds(seconds) {\n return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, 0)}`;\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = ({\n currentDeviceId,\n videoSources,\n onChangeVideoSource\n}) => {\n return h(\"div\", {\n className: \"uppy-Webcam-videoSource\"\n }, h(\"select\", {\n className: \"uppy-u-reset uppy-Webcam-videoSource-select\",\n onChange: event => {\n onChangeVideoSource(event.target.value);\n }\n }, videoSources.map(videoSource => h(\"option\", {\n key: videoSource.deviceId,\n value: videoSource.deviceId,\n selected: videoSource.deviceId === currentDeviceId\n }, videoSource.label))));\n};","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction SubmitButton({\n onSubmit,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--submit\",\n type: \"button\",\n title: i18n('submitRecordedFile'),\n \"aria-label\": i18n('submitRecordedFile'),\n onClick: onSubmit,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"12\",\n height: \"9\",\n viewBox: \"0 0 12 9\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"path\", {\n fill: \"#fff\",\n fillRule: \"nonzero\",\n d: \"M10.66 0L12 1.31 4.136 9 0 4.956l1.34-1.31L4.136 6.38z\"\n })));\n}\n\nmodule.exports = SubmitButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nfunction DiscardButton({\n onDiscard,\n i18n\n}) {\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button\",\n type: \"button\",\n title: i18n('discardRecordedFile'),\n \"aria-label\": i18n('discardRecordedFile'),\n onClick: onDiscard,\n \"data-uppy-super-focusable\": true\n }, h(\"svg\", {\n width: \"13\",\n height: \"13\",\n viewBox: \"0 0 13 13\",\n xmlns: \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n className: \"uppy-c-icon\"\n }, h(\"g\", {\n fill: \"#FFF\",\n fillRule: \"evenodd\"\n }, h(\"path\", {\n d: \"M.496 11.367L11.103.76l1.414 1.414L1.911 12.781z\"\n }), h(\"path\", {\n d: \"M11.104 12.782L.497 2.175 1.911.76l10.607 10.606z\"\n }))));\n}\n\nmodule.exports = DiscardButton;","\"use strict\";\n\nconst {\n h\n} = require('preact');\n\nmodule.exports = props => {\n return h(\"div\", {\n className: \"uppy-Webcam-permissons\"\n }, h(\"div\", {\n className: \"uppy-Webcam-permissonsIcon\"\n }, props.icon()), h(\"h1\", {\n className: \"uppy-Webcam-title\"\n }, props.hasCamera ? props.i18n('allowAccessTitle') : props.i18n('noCameraTitle')), h(\"p\", null, props.hasCamera ? props.i18n('allowAccessDescription') : props.i18n('noCameraDescription')));\n};","\"use strict\";\n\nvar _class, _enableMirror, _temp;\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError(\"attempted to use private field on non-instance\"); } return receiver; }\n\nvar id = 0;\n\nfunction _classPrivateFieldLooseKey(name) { return \"__private_\" + id++ + \"_\" + name; }\n\nconst {\n h\n} = require('preact');\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst getFileTypeExtension = require('@uppy/utils/lib/getFileTypeExtension');\n\nconst mimeTypes = require('@uppy/utils/lib/mimeTypes');\n\nconst canvasToBlob = require('@uppy/utils/lib/canvasToBlob');\n\nconst supportsMediaRecorder = require('./supportsMediaRecorder');\n\nconst CameraIcon = require('./CameraIcon');\n\nconst CameraScreen = require('./CameraScreen');\n\nconst PermissionsScreen = require('./PermissionsScreen');\n/**\n * Normalize a MIME type or file extension into a MIME type.\n *\n * @param {string} fileType - MIME type or a file extension prefixed with `.`.\n * @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.\n */\n\n\nfunction toMimeType(fileType) {\n if (fileType[0] === '.') {\n return mimeTypes[fileType.slice(1)];\n }\n\n return fileType;\n}\n/**\n * Is this MIME type a video?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isVideoMimeType(mimeType) {\n return /^video\\/[^*]+$/.test(mimeType);\n}\n/**\n * Is this MIME type an image?\n *\n * @param {string} mimeType - MIME type.\n * @returns {boolean}\n */\n\n\nfunction isImageMimeType(mimeType) {\n return /^image\\/[^*]+$/.test(mimeType);\n}\n\nfunction getMediaDevices() {\n // bug in the compatibility data\n // eslint-disable-next-line compat/compat\n return navigator.mediaDevices;\n}\n/**\n * Webcam\n */\n\n\nmodule.exports = (_temp = (_enableMirror = /*#__PURE__*/_classPrivateFieldLooseKey(\"enableMirror\"), _class = class Webcam extends UIPlugin {\n // eslint-disable-next-line global-require\n // enableMirror is used to toggle mirroring, for instance when discarding the video,\n // while `opts.mirror` is used to remember the initial user setting\n constructor(uppy, opts) {\n super(uppy, opts);\n Object.defineProperty(this, _enableMirror, {\n writable: true,\n value: void 0\n });\n this.mediaDevices = getMediaDevices();\n this.supportsUserMedia = !!this.mediaDevices; // eslint-disable-next-line no-restricted-globals\n\n this.protocol = location.protocol.match(/https/i) ? 'https' : 'http';\n this.id = this.opts.id || 'Webcam';\n this.type = 'acquirer';\n this.capturedMediaFile = null;\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#03BFEF\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M22 11c1.133 0 2 .867 2 2v7.333c0 1.134-.867 2-2 2H10c-1.133 0-2-.866-2-2V13c0-1.133.867-2 2-2h2.333l1.134-1.733C13.6 9.133 13.8 9 14 9h4c.2 0 .4.133.533.267L19.667 11H22zm-6 1.533a3.764 3.764 0 0 0-3.8 3.8c0 2.129 1.672 3.801 3.8 3.801s3.8-1.672 3.8-3.8c0-2.13-1.672-3.801-3.8-3.801zm0 6.261c-1.395 0-2.46-1.066-2.46-2.46 0-1.395 1.065-2.461 2.46-2.461s2.46 1.066 2.46 2.46c0 1.395-1.065 2.461-2.46 2.461z\",\n fill: \"#FFF\",\n fillRule: \"nonzero\"\n })));\n\n this.defaultLocale = {\n strings: {\n pluginNameCamera: 'Camera',\n smile: 'Smile!',\n takePicture: 'Take a picture',\n startRecording: 'Begin video recording',\n stopRecording: 'Stop video recording',\n allowAccessTitle: 'Please allow access to your camera',\n allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',\n noCameraTitle: 'Camera Not Available',\n noCameraDescription: 'In order to take pictures or record video, please connect a camera device',\n recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit',\n recordingLength: 'Recording length %{recording_length}',\n submitRecordedFile: 'Submit recorded file',\n discardRecordedFile: 'Discard recorded file'\n }\n }; // set default options\n\n const defaultOptions = {\n onBeforeSnapshot: () => Promise.resolve(),\n countdown: false,\n modes: ['video-audio', 'video-only', 'audio-only', 'picture'],\n mirror: true,\n showVideoSourceDropdown: false,\n facingMode: 'user',\n preferredImageMimeType: null,\n preferredVideoMimeType: null,\n showRecordingLength: false\n };\n this.opts = { ...defaultOptions,\n ...opts\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameCamera');\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = this.opts.mirror;\n this.install = this.install.bind(this);\n this.setPluginState = this.setPluginState.bind(this);\n this.render = this.render.bind(this); // Camera controls\n\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.takeSnapshot = this.takeSnapshot.bind(this);\n this.startRecording = this.startRecording.bind(this);\n this.stopRecording = this.stopRecording.bind(this);\n this.discardRecordedVideo = this.discardRecordedVideo.bind(this);\n this.submit = this.submit.bind(this);\n this.oneTwoThreeSmile = this.oneTwoThreeSmile.bind(this);\n this.focus = this.focus.bind(this);\n this.changeVideoSource = this.changeVideoSource.bind(this);\n this.webcamActive = false;\n\n if (this.opts.countdown) {\n this.opts.onBeforeSnapshot = this.oneTwoThreeSmile;\n }\n\n this.setPluginState({\n hasCamera: false,\n cameraReady: false,\n cameraError: null,\n recordingLengthSeconds: 0,\n videoSources: [],\n currentDeviceId: null\n });\n }\n\n setOptions(newOpts) {\n super.setOptions({ ...newOpts,\n videoConstraints: { // May be undefined but ... handles that\n ...this.opts.videoConstraints,\n ...(newOpts == null ? void 0 : newOpts.videoConstraints)\n }\n });\n }\n\n hasCameraCheck() {\n if (!this.mediaDevices) {\n return Promise.resolve(false);\n }\n\n return this.mediaDevices.enumerateDevices().then(devices => {\n return devices.some(device => device.kind === 'videoinput');\n });\n }\n\n isAudioOnly() {\n return this.opts.modes.length === 1 && this.opts.modes[0] === 'audio-only';\n }\n\n getConstraints(deviceId = null) {\n const acceptsAudio = this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('audio-only') !== -1;\n const acceptsVideo = !this.isAudioOnly() && (this.opts.modes.indexOf('video-audio') !== -1 || this.opts.modes.indexOf('video-only') !== -1 || this.opts.modes.indexOf('picture') !== -1);\n const videoConstraints = { ...(this.opts.videoConstraints || {\n facingMode: this.opts.facingMode\n }),\n // facingMode takes precedence over deviceId, and not needed\n // when specific device is selected\n ...(deviceId ? {\n deviceId,\n facingMode: null\n } : {})\n };\n return {\n audio: acceptsAudio,\n video: acceptsVideo ? videoConstraints : false\n };\n } // eslint-disable-next-line consistent-return\n\n\n start(options = null) {\n if (!this.supportsUserMedia) {\n return Promise.reject(new Error('Webcam access not supported'));\n }\n\n this.webcamActive = true;\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n const constraints = this.getConstraints(options && options.deviceId ? options.deviceId : null);\n this.hasCameraCheck().then(hasCamera => {\n this.setPluginState({\n hasCamera\n }); // ask user for access to their camera\n\n return this.mediaDevices.getUserMedia(constraints).then(stream => {\n this.stream = stream;\n let currentDeviceId = null;\n const tracks = this.isAudioOnly() ? stream.getAudioTracks() : stream.getVideoTracks();\n\n if (!options || !options.deviceId) {\n currentDeviceId = tracks[0].getSettings().deviceId;\n } else {\n tracks.forEach(track => {\n if (track.getSettings().deviceId === options.deviceId) {\n currentDeviceId = track.getSettings().deviceId;\n }\n });\n } // Update the sources now, so we can access the names.\n\n\n this.updateVideoSources();\n this.setPluginState({\n currentDeviceId,\n cameraReady: true\n });\n }).catch(err => {\n this.setPluginState({\n cameraReady: false,\n cameraError: err\n });\n this.uppy.info(err.message, 'error');\n });\n });\n }\n /**\n * @returns {object}\n */\n\n\n getMediaRecorderOptions() {\n const options = {}; // Try to use the `opts.preferredVideoMimeType` or one of the `allowedFileTypes` for the recording.\n // If the browser doesn't support it, we'll fall back to the browser default instead.\n // Safari doesn't have the `isTypeSupported` API.\n\n if (MediaRecorder.isTypeSupported) {\n const {\n restrictions\n } = this.uppy.opts;\n let preferredVideoMimeTypes = [];\n\n if (this.opts.preferredVideoMimeType) {\n preferredVideoMimeTypes = [this.opts.preferredVideoMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredVideoMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isVideoMimeType);\n }\n\n const filterSupportedTypes = candidateType => MediaRecorder.isTypeSupported(candidateType) && getFileTypeExtension(candidateType);\n\n const acceptableMimeTypes = preferredVideoMimeTypes.filter(filterSupportedTypes);\n\n if (acceptableMimeTypes.length > 0) {\n // eslint-disable-next-line prefer-destructuring\n options.mimeType = acceptableMimeTypes[0];\n }\n }\n\n return options;\n }\n\n startRecording() {\n // only used if supportsMediaRecorder() returned true\n // eslint-disable-next-line compat/compat\n this.recorder = new MediaRecorder(this.stream, this.getMediaRecorderOptions());\n this.recordingChunks = [];\n let stoppingBecauseOfMaxSize = false;\n this.recorder.addEventListener('dataavailable', event => {\n this.recordingChunks.push(event.data);\n const {\n restrictions\n } = this.uppy.opts;\n\n if (this.recordingChunks.length > 1 && restrictions.maxFileSize != null && !stoppingBecauseOfMaxSize) {\n const totalSize = this.recordingChunks.reduce((acc, chunk) => acc + chunk.size, 0); // Exclude the initial chunk from the average size calculation because it is likely to be a very small outlier\n\n const averageChunkSize = (totalSize - this.recordingChunks[0].size) / (this.recordingChunks.length - 1);\n const expectedEndChunkSize = averageChunkSize * 3;\n const maxSize = Math.max(0, restrictions.maxFileSize - expectedEndChunkSize);\n\n if (totalSize > maxSize) {\n stoppingBecauseOfMaxSize = true;\n this.uppy.info(this.i18n('recordingStoppedMaxSize'), 'warning', 4000);\n this.stopRecording();\n }\n }\n }); // use a \"time slice\" of 500ms: ondataavailable will be called each 500ms\n // smaller time slices mean we can more accurately check the max file size restriction\n\n this.recorder.start(500);\n\n if (this.opts.showRecordingLength) {\n // Start the recordingLengthTimer if we are showing the recording length.\n this.recordingLengthTimer = setInterval(() => {\n const currentRecordingLength = this.getPluginState().recordingLengthSeconds;\n this.setPluginState({\n recordingLengthSeconds: currentRecordingLength + 1\n });\n }, 1000);\n }\n\n this.setPluginState({\n isRecording: true\n });\n }\n\n stopRecording() {\n const stopped = new Promise(resolve => {\n this.recorder.addEventListener('stop', () => {\n resolve();\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n // Stop the recordingLengthTimer if we are showing the recording length.\n clearInterval(this.recordingLengthTimer);\n this.setPluginState({\n recordingLengthSeconds: 0\n });\n }\n });\n return stopped.then(() => {\n this.setPluginState({\n isRecording: false\n });\n return this.getVideo();\n }).then(file => {\n try {\n this.capturedMediaFile = file; // create object url for capture result preview\n\n this.setPluginState({\n // eslint-disable-next-line compat/compat\n recordedVideo: URL.createObjectURL(file.data)\n });\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = false;\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }).then(() => {\n this.recordingChunks = null;\n this.recorder = null;\n }, error => {\n this.recordingChunks = null;\n this.recorder = null;\n throw error;\n });\n }\n\n discardRecordedVideo() {\n this.setPluginState({\n recordedVideo: null\n });\n\n if (this.opts.mirror) {\n _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror] = true;\n }\n\n this.capturedMediaFile = null;\n }\n\n submit() {\n try {\n if (this.capturedMediaFile) {\n this.uppy.addFile(this.capturedMediaFile);\n }\n } catch (err) {\n // Logging the error, exept restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err, 'error');\n }\n }\n }\n\n async stop() {\n if (this.stream) {\n const audioTracks = this.stream.getAudioTracks();\n const videoTracks = this.stream.getVideoTracks();\n audioTracks.concat(videoTracks).forEach(track => track.stop());\n }\n\n if (this.recorder) {\n await new Promise(resolve => {\n this.recorder.addEventListener('stop', resolve, {\n once: true\n });\n this.recorder.stop();\n\n if (this.opts.showRecordingLength) {\n clearInterval(this.recordingLengthTimer);\n }\n });\n }\n\n this.recordingChunks = null;\n this.recorder = null;\n this.webcamActive = false;\n this.stream = null;\n this.setPluginState({\n recordedVideo: null,\n isRecording: false,\n recordingLengthSeconds: 0\n });\n }\n\n getVideoElement() {\n return this.el.querySelector('.uppy-Webcam-video');\n }\n\n oneTwoThreeSmile() {\n return new Promise((resolve, reject) => {\n let count = this.opts.countdown; // eslint-disable-next-line consistent-return\n\n const countDown = setInterval(() => {\n if (!this.webcamActive) {\n clearInterval(countDown);\n this.captureInProgress = false;\n return reject(new Error('Webcam is not active'));\n }\n\n if (count > 0) {\n this.uppy.info(`${count}...`, 'warning', 800);\n count--;\n } else {\n clearInterval(countDown);\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n setTimeout(() => resolve(), 1500);\n }\n }, 1000);\n });\n }\n\n takeSnapshot() {\n if (this.captureInProgress) return;\n this.captureInProgress = true;\n this.opts.onBeforeSnapshot().catch(err => {\n const message = typeof err === 'object' ? err.message : err;\n this.uppy.info(message, 'error', 5000);\n return Promise.reject(new Error(`onBeforeSnapshot: ${message}`));\n }).then(() => {\n return this.getImage();\n }).then(tagFile => {\n this.captureInProgress = false;\n\n try {\n this.uppy.addFile(tagFile);\n } catch (err) {\n // Logging the error, except restrictions, which is handled in Core\n if (!err.isRestriction) {\n this.uppy.log(err);\n }\n }\n }, error => {\n this.captureInProgress = false;\n throw error;\n });\n }\n\n getImage() {\n const video = this.getVideoElement();\n\n if (!video) {\n return Promise.reject(new Error('No video element found, likely due to the Webcam tab being closed.'));\n }\n\n const width = video.videoWidth;\n const height = video.videoHeight;\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n ctx.drawImage(video, 0, 0);\n const {\n restrictions\n } = this.uppy.opts;\n let preferredImageMimeTypes = [];\n\n if (this.opts.preferredImageMimeType) {\n preferredImageMimeTypes = [this.opts.preferredImageMimeType];\n } else if (restrictions.allowedFileTypes) {\n preferredImageMimeTypes = restrictions.allowedFileTypes.map(toMimeType).filter(isImageMimeType);\n }\n\n const mimeType = preferredImageMimeTypes[0] || 'image/jpeg';\n const ext = getFileTypeExtension(mimeType) || 'jpg';\n const name = `cam-${Date.now()}.${ext}`;\n return canvasToBlob(canvas, mimeType).then(blob => {\n return {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n });\n }\n\n getVideo() {\n // Sometimes in iOS Safari, Blobs (especially the first Blob in the recordingChunks Array)\n // have empty 'type' attributes (e.g. '') so we need to find a Blob that has a defined 'type'\n // attribute in order to determine the correct MIME type.\n const mimeType = this.recordingChunks.find(blob => {\n var _blob$type;\n\n return ((_blob$type = blob.type) == null ? void 0 : _blob$type.length) > 0;\n }).type;\n const fileExtension = getFileTypeExtension(mimeType);\n\n if (!fileExtension) {\n return Promise.reject(new Error(`Could not retrieve recording: Unsupported media type \"${mimeType}\"`));\n }\n\n const name = `webcam-${Date.now()}.${fileExtension}`;\n const blob = new Blob(this.recordingChunks, {\n type: mimeType\n });\n const file = {\n source: this.id,\n name,\n data: new Blob([blob], {\n type: mimeType\n }),\n type: mimeType\n };\n return Promise.resolve(file);\n }\n\n focus() {\n if (!this.opts.countdown) return;\n setTimeout(() => {\n this.uppy.info(this.i18n('smile'), 'success', 1500);\n }, 1000);\n }\n\n changeVideoSource(deviceId) {\n this.stop();\n this.start({\n deviceId\n });\n }\n\n updateVideoSources() {\n this.mediaDevices.enumerateDevices().then(devices => {\n this.setPluginState({\n videoSources: devices.filter(device => device.kind === 'videoinput')\n });\n });\n }\n\n render() {\n if (!this.webcamActive) {\n this.start();\n }\n\n const webcamState = this.getPluginState();\n\n if (!webcamState.cameraReady || !webcamState.hasCamera) {\n return h(PermissionsScreen, {\n icon: CameraIcon,\n i18n: this.i18n,\n hasCamera: webcamState.hasCamera\n });\n }\n\n return h(CameraScreen // eslint-disable-next-line react/jsx-props-no-spreading\n , _extends({}, webcamState, {\n onChangeVideoSource: this.changeVideoSource,\n onSnapshot: this.takeSnapshot,\n onStartRecording: this.startRecording,\n onStopRecording: this.stopRecording,\n onDiscardRecordedVideo: this.discardRecordedVideo,\n onSubmit: this.submit,\n onFocus: this.focus,\n onStop: this.stop,\n i18n: this.i18n,\n modes: this.opts.modes,\n showRecordingLength: this.opts.showRecordingLength,\n showVideoSourceDropdown: this.opts.showVideoSourceDropdown,\n supportsRecording: supportsMediaRecorder(),\n recording: webcamState.isRecording,\n mirror: _classPrivateFieldLooseBase(this, _enableMirror)[_enableMirror],\n src: this.stream\n }));\n }\n\n install() {\n this.setPluginState({\n cameraReady: false,\n recordingLengthSeconds: 0\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n\n if (this.mediaDevices) {\n this.updateVideoSources();\n\n this.mediaDevices.ondevicechange = () => {\n this.updateVideoSources();\n\n if (this.stream) {\n let restartStream = true;\n const {\n videoSources,\n currentDeviceId\n } = this.getPluginState();\n videoSources.forEach(videoSource => {\n if (currentDeviceId === videoSource.deviceId) {\n restartStream = false;\n }\n });\n\n if (restartStream) {\n this.stop();\n this.start();\n }\n }\n };\n }\n }\n\n uninstall() {\n this.stop();\n this.unmount();\n }\n\n onUnmount() {\n this.stop();\n }\n\n}), _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[8],{529:function(e,i,t){"use strict";var o=t(19),n=t(20),r=t(453),s=t(149),l=t(24),a=t(25),u=t(460).ProviderViews;e.exports=function(e){l(t,e);var i=a(t);function t(){return o(this,t),i.apply(this,arguments)}return n(t,[{key:"toggleCheckbox",value:function(e,i){e.stopPropagation(),e.preventDefault(),i.custom.isSharedDrive||r(s(t.prototype),"toggleCheckbox",this).call(this,e,i)}}]),t}(u)},539:function(e,i,t){"use strict";var o,n,r=t(19),s=t(20),l=t(56),a=t(24),u=t(25),p=t(53).UIPlugin,c=t(450).Provider,h=t(17).h,v=t(529);e.exports=(n=o=function(e){a(t,e);var i=u(t);function t(e,o){var n;return r(this,t),(n=i.call(this,e,o)).id=n.opts.id||"GoogleDrive",n.title=n.opts.title||"Google Drive",c.initPlugin(l(n),o),n.title=n.opts.title||"Google Drive",n.icon=function(){return h("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},h("g",{fill:"none",fillRule:"evenodd"},h("rect",{className:"uppy-ProviderIconBg",fill:"#4285F4",width:"32",height:"32",rx:"16"}),h("path",{d:"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z",fill:"#FFF"})))},n.provider=new c(e,{companionUrl:n.opts.companionUrl,companionHeaders:n.opts.companionHeaders,companionKeysParams:n.opts.companionKeysParams,companionCookiesRule:n.opts.companionCookiesRule,provider:"drive",pluginId:n.id}),n.defaultLocale={strings:{pluginNameGoogleDrive:"Google Drive"}},n.i18nInit(),n.title=n.i18n("pluginNameGoogleDrive"),n.onFirstRender=n.onFirstRender.bind(l(n)),n.render=n.render.bind(l(n)),n}return s(t,[{key:"install",value:function(){this.view=new v(this,{provider:this.provider});var e=this.opts.target;e&&this.mount(e,this)}},{key:"uninstall",value:function(){this.view.tearDown(),this.unmount()}},{key:"onFirstRender",value:function(){return Promise.all([this.provider.fetchPreAuthToken(),this.view.getFolder("root","/")])}},{key:"render",value:function(e){return this.view.render(e)}}]),t}(p),o.VERSION="2.0.4",n)}}]);
|
|
2
|
-
//# sourceMappingURL=8.959d6a7c.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@uppy/google-drive/lib/DriveProviderViews.js","../../../node_modules/@uppy/google-drive/lib/index.js"],"names":["ProviderViews","require","module","exports","e","file","stopPropagation","preventDefault","custom","isSharedDrive","_class","_temp","UIPlugin","Provider","h","DriveProviderViews","uppy","opts","id","title","initPlugin","icon","focusable","width","height","viewBox","fill","fillRule","className","rx","d","provider","companionUrl","companionHeaders","companionKeysParams","companionCookiesRule","pluginId","defaultLocale","strings","pluginNameGoogleDrive","i18nInit","i18n","onFirstRender","bind","render","this","view","target","mount","tearDown","unmount","Promise","all","fetchPreAuthToken","getFolder","state","VERSION"],"mappings":"8LAGEA,EACEC,EAAQ,KADVD,cAGFE,EAAOC,QAAP,4HACE,SAAeC,EAAGC,GAChBD,EAAEE,kBACFF,EAAEG,iBAEGF,EAAKG,OAAOC,eACf,kDAAqBL,EAAGC,OAN9B,GAAkDL,I,qCCJ9CU,EAAQC,E,wCAGVC,EACEX,EAAQ,IADVW,SAIAC,EACEZ,EAAQ,KADVY,SAIAC,EACEb,EAAQ,IADVa,EAGIC,EAAqBd,EAAQ,KAEnCC,EAAOC,SAAWQ,EAAQD,EAAM,8BAC9B,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GAA6B3C,GAyE1DF,EAAO8C,QAAU,QAAS7C","file":"static/js/8.959d6a7c.chunk.js","sourcesContent":["\"use strict\";\n\nconst {\n ProviderViews\n} = require('@uppy/provider-views');\n\nmodule.exports = class DriveProviderViews extends ProviderViews {\n toggleCheckbox(e, file) {\n e.stopPropagation();\n e.preventDefault(); // Shared Drives aren't selectable; for all else, defer to the base ProviderView.\n\n if (!file.custom.isSharedDrive) {\n super.toggleCheckbox(e, file);\n }\n }\n\n};","\"use strict\";\n\nvar _class, _temp;\n\nconst {\n UIPlugin\n} = require('@uppy/core');\n\nconst {\n Provider\n} = require('@uppy/companion-client');\n\nconst {\n h\n} = require('preact');\n\nconst DriveProviderViews = require('./DriveProviderViews');\n\nmodule.exports = (_temp = _class = class GoogleDrive extends UIPlugin {\n constructor(uppy, opts) {\n super(uppy, opts);\n this.id = this.opts.id || 'GoogleDrive';\n this.title = this.opts.title || 'Google Drive';\n Provider.initPlugin(this, opts);\n this.title = this.opts.title || 'Google Drive';\n\n this.icon = () => h(\"svg\", {\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 32 32\"\n }, h(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n }, h(\"rect\", {\n className: \"uppy-ProviderIconBg\",\n fill: \"#4285F4\",\n width: \"32\",\n height: \"32\",\n rx: \"16\"\n }), h(\"path\", {\n d: \"M25.216 17.736L19.043 7h-6.086l6.175 10.736h6.084zm-11.275.896L10.9 24h11.723l3.04-5.368H13.942zm-1.789-10.29l-5.816 10.29L9.38 24l5.905-10.29-3.132-5.369z\",\n fill: \"#FFF\"\n })));\n\n this.provider = new Provider(uppy, {\n companionUrl: this.opts.companionUrl,\n companionHeaders: this.opts.companionHeaders,\n companionKeysParams: this.opts.companionKeysParams,\n companionCookiesRule: this.opts.companionCookiesRule,\n provider: 'drive',\n pluginId: this.id\n });\n this.defaultLocale = {\n strings: {\n pluginNameGoogleDrive: 'Google Drive'\n }\n };\n this.i18nInit();\n this.title = this.i18n('pluginNameGoogleDrive');\n this.onFirstRender = this.onFirstRender.bind(this);\n this.render = this.render.bind(this);\n }\n\n install() {\n this.view = new DriveProviderViews(this, {\n provider: this.provider\n });\n const {\n target\n } = this.opts;\n\n if (target) {\n this.mount(target, this);\n }\n }\n\n uninstall() {\n this.view.tearDown();\n this.unmount();\n }\n\n onFirstRender() {\n return Promise.all([this.provider.fetchPreAuthToken(), this.view.getFolder('root', '/')]);\n }\n\n render(state) {\n return this.view.render(state);\n }\n\n}, _class.VERSION = \"2.0.4\", _temp);"],"sourceRoot":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[9],{499:function(e,t,o){"use strict";var r=o(19),n=o(20);function a(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=0;function i(e){return"__private_"+s+++"_"+e}var p=i("aliveTimer"),u=i("isDone"),d=i("onTimedOut"),l=i("timeout"),c=function(){function e(t,o){r(this,e),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:!1}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),a(this,l)[l]=t,a(this,d)[d]=o}return n(e,[{key:"progress",value:function(){a(this,u)[u]||a(this,l)[l]>0&&(clearTimeout(a(this,p)[p]),a(this,p)[p]=setTimeout(a(this,d)[d],a(this,l)[l]))}},{key:"done",value:function(){a(this,u)[u]||(clearTimeout(a(this,p)[p]),a(this,p)[p]=null,a(this,u)[u]=!0)}}]),e}();e.exports=c},534:function(e,t,o){"use strict";var r,n,a=o(29),s=o(19),i=o(20),p=o(56),u=o(24),d=o(25),l=o(150),c=o(111).nanoid,h=o(450),f=h.Provider,m=h.RequestClient,v=h.Socket,y=o(468),g=o(469),b=o(470),E=o(471),w=o(499),U=o(473),R=U.RateLimitedQueue,O=U.internalRateLimitedQueue,T=o(452),k=o(472);function F(e,t){var o=t;return o||(o=new Error("Upload error")),"string"===typeof o&&(o=new Error(o)),o instanceof Error||(o=Object.assign(new Error("Upload error"),{data:o})),k(e)?o=new T(o,e):(o.request=e,o)}function x(e){return e.data.slice(0,e.data.size,e.meta.type)}e.exports=(n=r=function(e){u(o,e);var t=d(o);function o(e,r){var n;s(this,o),(n=t.call(this,e,r)).type="uploader",n.id=n.opts.id||"XHRUpload",n.title="XHRUpload",n.defaultLocale={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}};var i={formData:!0,fieldName:r.bundle?"files[]":"file",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},timeout:3e4,limit:5,withCredentials:!1,responseType:"",getResponseData:function(t){var o={};try{o=JSON.parse(t)}catch(r){e.log(r)}return o},getResponseError:function(e,t){var o=new Error("Upload error");return k(t)&&(o=new T(o,t)),o},validateStatus:function(e){return e>=200&&e<300}};if(n.opts=a(a({},i),r),n.i18nInit(),n.handleUpload=n.handleUpload.bind(p(n)),O in n.opts?n.requests=n.opts[O]:n.requests=new R(n.opts.limit),n.opts.bundle&&!n.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return n.uploaderEvents=Object.create(null),n}return i(o,[{key:"getOptions",value:function(e){var t=this.uppy.getState().xhrUpload,o=this.opts.headers,r=a(a(a(a({},this.opts),t||{}),e.xhrUpload||{}),{},{headers:{}});return"function"===typeof o?r.headers=o(e):Object.assign(r.headers,this.opts.headers),t&&Object.assign(r.headers,t.headers),e.xhrUpload&&Object.assign(r.headers,e.xhrUpload.headers),r}},{key:"addMetadata",value:function(e,t,o){(Array.isArray(o.metaFields)?o.metaFields:Object.keys(t)).forEach((function(o){e.append(o,t[o])}))}},{key:"createFormDataUpload",value:function(e,t){var o=new FormData;this.addMetadata(o,e.meta,t);var r=x(e);return e.name?o.append(t.fieldName,r,e.meta.name):o.append(t.fieldName,r),o}},{key:"createBundledUpload",value:function(e,t){var o=this,r=new FormData,n=this.uppy.getState().meta;return this.addMetadata(r,n,t),e.forEach((function(e){var t=o.getOptions(e),n=x(e);e.name?r.append(t.fieldName,n,e.name):r.append(t.fieldName,n)})),r}},{key:"upload",value:function(e,t,o){var r=this,n=this.getOptions(e);return this.uppy.log("uploading ".concat(t," of ").concat(o)),new Promise((function(t,o){r.uppy.emit("upload-started",e);var a=n.formData?r.createFormDataUpload(e,n):e.data,s=new XMLHttpRequest;r.uploaderEvents[e.id]=new E(r.uppy);var i=new w(n.timeout,(function(){s.abort(),u.done();var t=new Error(r.i18n("timedOut",{seconds:Math.ceil(n.timeout/1e3)}));r.uppy.emit("upload-error",e,t),o(t)})),p=c();s.upload.addEventListener("loadstart",(function(){r.uppy.log("[XHRUpload] ".concat(p," started"))})),s.upload.addEventListener("progress",(function(t){r.uppy.log("[XHRUpload] ".concat(p," progress: ").concat(t.loaded," / ").concat(t.total)),i.progress(),t.lengthComputable&&r.uppy.emit("upload-progress",e,{uploader:r,bytesUploaded:t.loaded,bytesTotal:t.total})})),s.addEventListener("load",(function(a){if(r.uppy.log("[XHRUpload] ".concat(p," finished")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null),n.validateStatus(a.target.status,s.responseText,s)){var d=n.getResponseData(s.responseText,s),l=d[n.responseUrlFieldName],c={status:a.target.status,body:d,uploadURL:l};return r.uppy.emit("upload-success",e,c),l&&r.uppy.log("Download ".concat(e.name," from ").concat(l)),t(e)}var h=n.getResponseData(s.responseText,s),f=F(s,n.getResponseError(s.responseText,s)),m={status:a.target.status,body:h};return r.uppy.emit("upload-error",e,f,m),o(f)})),s.addEventListener("error",(function(){r.uppy.log("[XHRUpload] ".concat(p," errored")),i.done(),u.done(),r.uploaderEvents[e.id]&&(r.uploaderEvents[e.id].remove(),r.uploaderEvents[e.id]=null);var t=F(s,n.getResponseError(s.responseText,s));return r.uppy.emit("upload-error",e,t),o(t)})),s.open(n.method.toUpperCase(),n.endpoint,!0),s.withCredentials=n.withCredentials,""!==n.responseType&&(s.responseType=n.responseType);var u=r.requests.run((function(){r.uppy.emit("upload-started",e);var t=r.getOptions(e);return Object.keys(t.headers).forEach((function(e){s.setRequestHeader(e,t.headers[e])})),s.send(a),function(){i.done(),s.abort()}}));r.onFileRemove(e.id,(function(){u.abort(),o(new Error("File removed"))})),r.onCancelAll(e.id,(function(){u.abort(),o(new Error("Upload cancelled"))}))}))}},{key:"uploadRemote",value:function(e){var t=this,o=this.getOptions(e);return new Promise((function(r,n){var s={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(e.meta)).forEach((function(t){s[t]=e.meta[t]})),new(e.remote.providerOptions.provider?f:m)(t.uppy,e.remote.providerOptions).post(e.remote.url,a(a({},e.remote.body),{},{endpoint:o.endpoint,size:e.data.size,fieldname:o.fieldName,metadata:s,httpMethod:o.method,useFormData:o.formData,headers:o.headers})).then((function(a){var s=a.token,i=g(e.remote.companionUrl),p=new v({target:"".concat(i,"/api/").concat(s),autoOpen:!1});t.uploaderEvents[e.id]=new E(t.uppy),t.onFileRemove(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was removed"))})),t.onCancelAll(e.id,(function(){p.send("pause",{}),u.abort(),r("upload ".concat(e.id," was canceled"))})),t.onRetry(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),t.onRetryAll(e.id,(function(){p.send("pause",{}),p.send("resume",{})})),p.on("progress",(function(o){return y(t,o,e)})),p.on("success",(function(n){var a=o.getResponseData(n.response.responseText,n.response),s=a[o.responseUrlFieldName],i={status:n.response.status,body:a,uploadURL:s};return t.uppy.emit("upload-success",e,i),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),r()})),p.on("error",(function(r){var a=r.response,s=a?o.getResponseError(a.responseText,a):Object.assign(new Error(r.error.message),{cause:r.error});t.uppy.emit("upload-error",e,s),u.done(),t.uploaderEvents[e.id]&&(t.uploaderEvents[e.id].remove(),t.uploaderEvents[e.id]=null),n(s)}));var u=t.requests.run((function(){return p.open(),e.isPaused&&p.send("pause",{}),function(){return p.close()}}))})).catch((function(o){t.uppy.emit("upload-error",e,o),n(o)}))}))}},{key:"uploadBundle",value:function(e){var t=this;return new Promise((function(o,r){var n=t.opts.endpoint,s=t.opts.method,i=t.uppy.getState().xhrUpload,p=t.createBundledUpload(e,a(a({},t.opts),i||{})),u=new XMLHttpRequest,d=new w(t.opts.timeout,(function(){u.abort();var e=new Error(t.i18n("timedOut",{seconds:Math.ceil(t.opts.timeout/1e3)}));l(e),r(e)})),l=function(o){e.forEach((function(e){t.uppy.emit("upload-error",e,o)}))};u.upload.addEventListener("loadstart",(function(){t.uppy.log("[XHRUpload] started uploading bundle"),d.progress()})),u.upload.addEventListener("progress",(function(o){d.progress(),o.lengthComputable&&e.forEach((function(e){t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:o.loaded/o.total*e.size,bytesTotal:e.size})}))})),u.addEventListener("load",(function(n){if(d.done(),t.opts.validateStatus(n.target.status,u.responseText,u)){var a=t.opts.getResponseData(u.responseText,u),s={status:n.target.status,body:a};return e.forEach((function(e){t.uppy.emit("upload-success",e,s)})),o()}var i=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return i.request=u,l(i),r(i)})),u.addEventListener("error",(function(){d.done();var e=t.opts.getResponseError(u.responseText,u)||new Error("Upload error");return l(e),r(e)})),t.uppy.on("cancel-all",(function(){d.done(),u.abort()})),u.open(s.toUpperCase(),n,!0),u.withCredentials=t.opts.withCredentials,""!==t.opts.responseType&&(u.responseType=t.opts.responseType),Object.keys(t.opts.headers).forEach((function(e){u.setRequestHeader(e,t.opts.headers[e])})),u.send(p),e.forEach((function(e){t.uppy.emit("upload-started",e)}))}))}},{key:"uploadFiles",value:function(e){var t=this,o=e.map((function(o,r){var n=parseInt(r,10)+1,a=e.length;return o.error?Promise.reject(new Error(o.error)):o.isRemote?t.uploadRemote(o,n,a):t.upload(o,n,a)}));return b(o)}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(o){e===o.id&&t(o.id)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(o){e===o&&t()}))}},{key:"onRetryAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("retry-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var o=this;this.uploaderEvents[e].on("cancel-all",(function(){o.uppy.getFile(e)&&t()}))}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();0!==this.opts.limit||this.opts[O]||this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");var o=e.map((function(e){return t.uppy.getFile(e)}));if(this.opts.bundle){if(o.some((function(e){return e.isRemote})))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if("function"===typeof this.opts.headers)throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");return this.uploadBundle(o)}return this.uploadFiles(o).then((function(){return null}))}},{key:"install",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!1})})}this.uppy.addUploader(this.handleUpload)}},{key:"uninstall",value:function(){if(this.opts.bundle){var e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:a(a({},e),{},{individualCancellation:!0})})}this.uppy.removeUploader(this.handleUpload)}}]),o}(l),r.VERSION="2.0.5",n)}}]);
|
|
2
|
-
//# sourceMappingURL=9.13a28a70.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/@uppy/utils/lib/ProgressTimeout.js","../../../node_modules/@uppy/xhr-upload/lib/index.js"],"names":["_classPrivateFieldLooseBase","receiver","privateKey","Object","prototype","hasOwnProperty","call","TypeError","id","_classPrivateFieldLooseKey","name","_aliveTimer","_isDone","_onTimedOut","_timeout","ProgressTimeout","timeout","timeoutHandler","defineProperty","this","writable","value","clearTimeout","setTimeout","module","exports","_class","_temp","BasePlugin","require","nanoid","Provider","RequestClient","Socket","emitSocketProgress","getSocketHost","settle","EventTracker","RateLimitedQueue","internalRateLimitedQueue","NetworkError","isNetworkError","buildResponseError","xhr","err","error","Error","assign","data","request","setTypeInBlob","file","slice","size","meta","type","uppy","opts","title","defaultLocale","strings","timedOut","defaultOptions","formData","fieldName","bundle","method","metaFields","responseUrlFieldName","headers","limit","withCredentials","responseType","getResponseData","responseText","parsedResponse","JSON","parse","log","getResponseError","_","response","validateStatus","status","i18nInit","handleUpload","bind","requests","uploaderEvents","create","overrides","getState","xhrUpload","Array","isArray","keys","forEach","item","append","formPost","FormData","addMetadata","dataWithUpdatedType","files","options","getOptions","current","total","Promise","resolve","reject","emit","createFormDataUpload","XMLHttpRequest","timer","abort","queuedRequest","done","i18n","seconds","Math","ceil","upload","addEventListener","ev","loaded","progress","lengthComputable","uploader","bytesUploaded","bytesTotal","remove","target","body","uploadURL","uploadResp","open","toUpperCase","endpoint","run","currentOpts","header","setRequestHeader","send","onFileRemove","onCancelAll","fields","remote","providerOptions","provider","post","url","fieldname","metadata","httpMethod","useFormData","then","res","token","host","companionUrl","socket","autoOpen","onRetry","onRetryAll","on","progressData","errData","resp","message","cause","isPaused","close","optsFromState","createBundledUpload","emitError","promises","map","i","parseInt","length","isRemote","uploadRemote","fileID","cb","targetFileID","getFile","fileIDs","some","uploadBundle","uploadFiles","capabilities","setState","individualCancellation","addUploader","removeUploader","VERSION"],"mappings":"4JAEA,SAASA,EAA4BC,EAAUC,GAAc,IAAKC,OAAOC,UAAUC,eAAeC,KAAKL,EAAUC,GAAe,MAAM,IAAIK,UAAU,kDAAqD,OAAON,EAEhN,IAAIO,EAAK,EAET,SAASC,EAA2BC,GAAQ,MAAO,aAAeF,I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AAKkI,YAG/C,MAAM,IAAIvI,MAAM,wEAGlB,GAAiC,oBAAtB3B,KAAKsC,KAAKY,QACnB,MAAM,IAAI9D,UAAU,yEAGtB,OAAOY,KAAK0K,aAAatF,GAG3B,OAAOpF,KAAK2K,YAAYvF,GAAOqD,MAAK,kBAAM,UAziBd,qBA4iB9B,WACE,GAAIzI,KAAKsC,KAAKQ,OAAQ,CACpB,IACE8H,EACE5K,KAAKqC,KAAKmC,WADZoG,aAEF5K,KAAKqC,KAAKwI,SAAS,CACjBD,aAAc,EAAF,KAAOA,GAAP,IACVE,wBAAwB,MAK9B9K,KAAKqC,KAAK0I,YAAY/K,KAAKkE,gBAxjBC,uBA2jB9B,WACE,GAAIlE,KAAKsC,KAAKQ,OAAQ,CACpB,IACE8H,EACE5K,KAAKqC,KAAKmC,WADZoG,aAEF5K,KAAKqC,KAAKwI,SAAS,CACjBD,aAAc,EAAF,KAAOA,GAAP,IACVE,wBAAwB,MAK9B9K,KAAKqC,KAAK2I,eAAehL,KAAKkE,kBAvkBF,GAA2BzD,GA0kBxDF,EAAO0K,QAAU,QAASzK","file":"static/js/9.13a28a70.chunk.js","sourcesContent":["\"use strict\";\n\nfunction _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError(\"attempted to use private field on non-instance\"); } return receiver; }\n\nvar id = 0;\n\nfunction _classPrivateFieldLooseKey(name) { return \"__private_\" + id++ + \"_\" + name; }\n\nvar _aliveTimer = /*#__PURE__*/_classPrivateFieldLooseKey(\"aliveTimer\");\n\nvar _isDone = /*#__PURE__*/_classPrivateFieldLooseKey(\"isDone\");\n\nvar _onTimedOut = /*#__PURE__*/_classPrivateFieldLooseKey(\"onTimedOut\");\n\nvar _timeout = /*#__PURE__*/_classPrivateFieldLooseKey(\"timeout\");\n\n/**\n * Helper to abort upload requests if there has not been any progress for `timeout` ms.\n * Create an instance using `timer = new ProgressTimeout(10000, onTimeout)`\n * Call `timer.progress()` to signal that there has been progress of any kind.\n * Call `timer.done()` when the upload has completed.\n */\nclass ProgressTimeout {\n constructor(timeout, timeoutHandler) {\n Object.defineProperty(this, _aliveTimer, {\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, _isDone, {\n writable: true,\n value: false\n });\n Object.defineProperty(this, _onTimedOut, {\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, _timeout, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldLooseBase(this, _timeout)[_timeout] = timeout;\n _classPrivateFieldLooseBase(this, _onTimedOut)[_onTimedOut] = timeoutHandler;\n }\n\n progress() {\n // Some browsers fire another progress event when the upload is\n // cancelled, so we have to ignore progress after the timer was\n // told to stop.\n if (_classPrivateFieldLooseBase(this, _isDone)[_isDone]) return;\n\n if (_classPrivateFieldLooseBase(this, _timeout)[_timeout] > 0) {\n clearTimeout(_classPrivateFieldLooseBase(this, _aliveTimer)[_aliveTimer]);\n _classPrivateFieldLooseBase(this, _aliveTimer)[_aliveTimer] = setTimeout(_classPrivateFieldLooseBase(this, _onTimedOut)[_onTimedOut], _classPrivateFieldLooseBase(this, _timeout)[_timeout]);\n }\n }\n\n done() {\n if (!_classPrivateFieldLooseBase(this, _isDone)[_isDone]) {\n clearTimeout(_classPrivateFieldLooseBase(this, _aliveTimer)[_aliveTimer]);\n _classPrivateFieldLooseBase(this, _aliveTimer)[_aliveTimer] = null;\n _classPrivateFieldLooseBase(this, _isDone)[_isDone] = true;\n }\n }\n\n}\n\nmodule.exports = ProgressTimeout;","\"use strict\";\n\nvar _class, _temp;\n\nconst BasePlugin = require('@uppy/core/lib/BasePlugin');\n\nconst {\n nanoid\n} = require('nanoid');\n\nconst {\n Provider,\n RequestClient,\n Socket\n} = require('@uppy/companion-client');\n\nconst emitSocketProgress = require('@uppy/utils/lib/emitSocketProgress');\n\nconst getSocketHost = require('@uppy/utils/lib/getSocketHost');\n\nconst settle = require('@uppy/utils/lib/settle');\n\nconst EventTracker = require('@uppy/utils/lib/EventTracker');\n\nconst ProgressTimeout = require('@uppy/utils/lib/ProgressTimeout');\n\nconst {\n RateLimitedQueue,\n internalRateLimitedQueue\n} = require('@uppy/utils/lib/RateLimitedQueue');\n\nconst NetworkError = require('@uppy/utils/lib/NetworkError');\n\nconst isNetworkError = require('@uppy/utils/lib/isNetworkError');\n\nfunction buildResponseError(xhr, err) {\n let error = err; // No error message\n\n if (!error) error = new Error('Upload error'); // Got an error message string\n\n if (typeof error === 'string') error = new Error(error); // Got something else\n\n if (!(error instanceof Error)) {\n error = Object.assign(new Error('Upload error'), {\n data: error\n });\n }\n\n if (isNetworkError(xhr)) {\n error = new NetworkError(error, xhr);\n return error;\n }\n\n error.request = xhr;\n return error;\n}\n/**\n * Set `data.type` in the blob to `file.meta.type`,\n * because we might have detected a more accurate file type in Uppy\n * https://stackoverflow.com/a/50875615\n *\n * @param {object} file File object with `data`, `size` and `meta` properties\n * @returns {object} blob updated with the new `type` set from `file.meta.type`\n */\n\n\nfunction setTypeInBlob(file) {\n const dataWithUpdatedType = file.data.slice(0, file.data.size, file.meta.type);\n return dataWithUpdatedType;\n}\n\nmodule.exports = (_temp = _class = class XHRUpload extends BasePlugin {\n // eslint-disable-next-line global-require\n constructor(uppy, opts) {\n super(uppy, opts);\n this.type = 'uploader';\n this.id = this.opts.id || 'XHRUpload';\n this.title = 'XHRUpload';\n this.defaultLocale = {\n strings: {\n timedOut: 'Upload stalled for %{seconds} seconds, aborting.'\n }\n }; // Default options\n\n const defaultOptions = {\n formData: true,\n fieldName: opts.bundle ? 'files[]' : 'file',\n method: 'post',\n metaFields: null,\n responseUrlFieldName: 'url',\n bundle: false,\n headers: {},\n timeout: 30 * 1000,\n limit: 5,\n withCredentials: false,\n responseType: '',\n\n /**\n * @typedef respObj\n * @property {string} responseText\n * @property {number} status\n * @property {string} statusText\n * @property {object.<string, string>} headers\n *\n * @param {string} responseText the response body string\n * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)\n */\n getResponseData(responseText) {\n let parsedResponse = {};\n\n try {\n parsedResponse = JSON.parse(responseText);\n } catch (err) {\n uppy.log(err);\n }\n\n return parsedResponse;\n },\n\n /**\n *\n * @param {string} responseText the response body string\n * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)\n */\n getResponseError(_, response) {\n let error = new Error('Upload error');\n\n if (isNetworkError(response)) {\n error = new NetworkError(error, response);\n }\n\n return error;\n },\n\n /**\n * Check if the response from the upload endpoint indicates that the upload was successful.\n *\n * @param {number} status the response status code\n */\n validateStatus(status) {\n return status >= 200 && status < 300;\n }\n\n };\n this.opts = { ...defaultOptions,\n ...opts\n };\n this.i18nInit();\n this.handleUpload = this.handleUpload.bind(this); // Simultaneous upload limiting is shared across all uploads with this plugin.\n\n if (internalRateLimitedQueue in this.opts) {\n this.requests = this.opts[internalRateLimitedQueue];\n } else {\n this.requests = new RateLimitedQueue(this.opts.limit);\n }\n\n if (this.opts.bundle && !this.opts.formData) {\n throw new Error('`opts.formData` must be true when `opts.bundle` is enabled.');\n }\n\n this.uploaderEvents = Object.create(null);\n }\n\n getOptions(file) {\n const overrides = this.uppy.getState().xhrUpload;\n const {\n headers\n } = this.opts;\n const opts = { ...this.opts,\n ...(overrides || {}),\n ...(file.xhrUpload || {}),\n headers: {}\n }; // Support for `headers` as a function, only in the XHRUpload settings.\n // Options set by other plugins in Uppy state or on the files themselves are still merged in afterward.\n //\n // ```js\n // headers: (file) => ({ expires: file.meta.expires })\n // ```\n\n if (typeof headers === 'function') {\n opts.headers = headers(file);\n } else {\n Object.assign(opts.headers, this.opts.headers);\n }\n\n if (overrides) {\n Object.assign(opts.headers, overrides.headers);\n }\n\n if (file.xhrUpload) {\n Object.assign(opts.headers, file.xhrUpload.headers);\n }\n\n return opts;\n } // eslint-disable-next-line class-methods-use-this\n\n\n addMetadata(formData, meta, opts) {\n const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields : Object.keys(meta); // Send along all fields by default.\n\n metaFields.forEach(item => {\n formData.append(item, meta[item]);\n });\n }\n\n createFormDataUpload(file, opts) {\n const formPost = new FormData();\n this.addMetadata(formPost, file.meta, opts);\n const dataWithUpdatedType = setTypeInBlob(file);\n\n if (file.name) {\n formPost.append(opts.fieldName, dataWithUpdatedType, file.meta.name);\n } else {\n formPost.append(opts.fieldName, dataWithUpdatedType);\n }\n\n return formPost;\n }\n\n createBundledUpload(files, opts) {\n const formPost = new FormData();\n const {\n meta\n } = this.uppy.getState();\n this.addMetadata(formPost, meta, opts);\n files.forEach(file => {\n const options = this.getOptions(file);\n const dataWithUpdatedType = setTypeInBlob(file);\n\n if (file.name) {\n formPost.append(options.fieldName, dataWithUpdatedType, file.name);\n } else {\n formPost.append(options.fieldName, dataWithUpdatedType);\n }\n });\n return formPost;\n }\n\n upload(file, current, total) {\n const opts = this.getOptions(file);\n this.uppy.log(`uploading ${current} of ${total}`);\n return new Promise((resolve, reject) => {\n this.uppy.emit('upload-started', file);\n const data = opts.formData ? this.createFormDataUpload(file, opts) : file.data;\n const xhr = new XMLHttpRequest();\n this.uploaderEvents[file.id] = new EventTracker(this.uppy);\n const timer = new ProgressTimeout(opts.timeout, () => {\n xhr.abort();\n queuedRequest.done();\n const error = new Error(this.i18n('timedOut', {\n seconds: Math.ceil(opts.timeout / 1000)\n }));\n this.uppy.emit('upload-error', file, error);\n reject(error);\n });\n const id = nanoid();\n xhr.upload.addEventListener('loadstart', () => {\n this.uppy.log(`[XHRUpload] ${id} started`);\n });\n xhr.upload.addEventListener('progress', ev => {\n this.uppy.log(`[XHRUpload] ${id} progress: ${ev.loaded} / ${ev.total}`); // Begin checking for timeouts when progress starts, instead of loading,\n // to avoid timing out requests on browser concurrency queue\n\n timer.progress();\n\n if (ev.lengthComputable) {\n this.uppy.emit('upload-progress', file, {\n uploader: this,\n bytesUploaded: ev.loaded,\n bytesTotal: ev.total\n });\n }\n });\n xhr.addEventListener('load', ev => {\n this.uppy.log(`[XHRUpload] ${id} finished`);\n timer.done();\n queuedRequest.done();\n\n if (this.uploaderEvents[file.id]) {\n this.uploaderEvents[file.id].remove();\n this.uploaderEvents[file.id] = null;\n }\n\n if (opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {\n const body = opts.getResponseData(xhr.responseText, xhr);\n const uploadURL = body[opts.responseUrlFieldName];\n const uploadResp = {\n status: ev.target.status,\n body,\n uploadURL\n };\n this.uppy.emit('upload-success', file, uploadResp);\n\n if (uploadURL) {\n this.uppy.log(`Download ${file.name} from ${uploadURL}`);\n }\n\n return resolve(file);\n }\n\n const body = opts.getResponseData(xhr.responseText, xhr);\n const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));\n const response = {\n status: ev.target.status,\n body\n };\n this.uppy.emit('upload-error', file, error, response);\n return reject(error);\n });\n xhr.addEventListener('error', () => {\n this.uppy.log(`[XHRUpload] ${id} errored`);\n timer.done();\n queuedRequest.done();\n\n if (this.uploaderEvents[file.id]) {\n this.uploaderEvents[file.id].remove();\n this.uploaderEvents[file.id] = null;\n }\n\n const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));\n this.uppy.emit('upload-error', file, error);\n return reject(error);\n });\n xhr.open(opts.method.toUpperCase(), opts.endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`\n // before `open()` is called.\n\n xhr.withCredentials = opts.withCredentials;\n\n if (opts.responseType !== '') {\n xhr.responseType = opts.responseType;\n }\n\n const queuedRequest = this.requests.run(() => {\n this.uppy.emit('upload-started', file); // When using an authentication system like JWT, the bearer token goes as a header. This\n // header needs to be fresh each time the token is refreshed so computing and setting the\n // headers just before the upload starts enables this kind of authentication to work properly.\n // Otherwise, half-way through the list of uploads the token could be stale and the upload would fail.\n\n const currentOpts = this.getOptions(file);\n Object.keys(currentOpts.headers).forEach(header => {\n xhr.setRequestHeader(header, currentOpts.headers[header]);\n });\n xhr.send(data);\n return () => {\n timer.done();\n xhr.abort();\n };\n });\n this.onFileRemove(file.id, () => {\n queuedRequest.abort();\n reject(new Error('File removed'));\n });\n this.onCancelAll(file.id, () => {\n queuedRequest.abort();\n reject(new Error('Upload cancelled'));\n });\n });\n }\n\n uploadRemote(file) {\n const opts = this.getOptions(file);\n return new Promise((resolve, reject) => {\n const fields = {};\n const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields // Send along all fields by default.\n : Object.keys(file.meta);\n metaFields.forEach(name => {\n fields[name] = file.meta[name];\n });\n const Client = file.remote.providerOptions.provider ? Provider : RequestClient;\n const client = new Client(this.uppy, file.remote.providerOptions);\n client.post(file.remote.url, { ...file.remote.body,\n endpoint: opts.endpoint,\n size: file.data.size,\n fieldname: opts.fieldName,\n metadata: fields,\n httpMethod: opts.method,\n useFormData: opts.formData,\n headers: opts.headers\n }).then(res => {\n const {\n token\n } = res;\n const host = getSocketHost(file.remote.companionUrl);\n const socket = new Socket({\n target: `${host}/api/${token}`,\n autoOpen: false\n });\n this.uploaderEvents[file.id] = new EventTracker(this.uppy);\n this.onFileRemove(file.id, () => {\n socket.send('pause', {});\n queuedRequest.abort();\n resolve(`upload ${file.id} was removed`);\n });\n this.onCancelAll(file.id, () => {\n socket.send('pause', {});\n queuedRequest.abort();\n resolve(`upload ${file.id} was canceled`);\n });\n this.onRetry(file.id, () => {\n socket.send('pause', {});\n socket.send('resume', {});\n });\n this.onRetryAll(file.id, () => {\n socket.send('pause', {});\n socket.send('resume', {});\n });\n socket.on('progress', progressData => emitSocketProgress(this, progressData, file));\n socket.on('success', data => {\n const body = opts.getResponseData(data.response.responseText, data.response);\n const uploadURL = body[opts.responseUrlFieldName];\n const uploadResp = {\n status: data.response.status,\n body,\n uploadURL\n };\n this.uppy.emit('upload-success', file, uploadResp);\n queuedRequest.done();\n\n if (this.uploaderEvents[file.id]) {\n this.uploaderEvents[file.id].remove();\n this.uploaderEvents[file.id] = null;\n }\n\n return resolve();\n });\n socket.on('error', errData => {\n const resp = errData.response;\n const error = resp ? opts.getResponseError(resp.responseText, resp) : Object.assign(new Error(errData.error.message), {\n cause: errData.error\n });\n this.uppy.emit('upload-error', file, error);\n queuedRequest.done();\n\n if (this.uploaderEvents[file.id]) {\n this.uploaderEvents[file.id].remove();\n this.uploaderEvents[file.id] = null;\n }\n\n reject(error);\n });\n const queuedRequest = this.requests.run(() => {\n socket.open();\n\n if (file.isPaused) {\n socket.send('pause', {});\n }\n\n return () => socket.close();\n });\n }).catch(err => {\n this.uppy.emit('upload-error', file, err);\n reject(err);\n });\n });\n }\n\n uploadBundle(files) {\n return new Promise((resolve, reject) => {\n const {\n endpoint\n } = this.opts;\n const {\n method\n } = this.opts;\n const optsFromState = this.uppy.getState().xhrUpload;\n const formData = this.createBundledUpload(files, { ...this.opts,\n ...(optsFromState || {})\n });\n const xhr = new XMLHttpRequest();\n const timer = new ProgressTimeout(this.opts.timeout, () => {\n xhr.abort();\n const error = new Error(this.i18n('timedOut', {\n seconds: Math.ceil(this.opts.timeout / 1000)\n }));\n emitError(error);\n reject(error);\n });\n\n const emitError = error => {\n files.forEach(file => {\n this.uppy.emit('upload-error', file, error);\n });\n };\n\n xhr.upload.addEventListener('loadstart', () => {\n this.uppy.log('[XHRUpload] started uploading bundle');\n timer.progress();\n });\n xhr.upload.addEventListener('progress', ev => {\n timer.progress();\n if (!ev.lengthComputable) return;\n files.forEach(file => {\n this.uppy.emit('upload-progress', file, {\n uploader: this,\n bytesUploaded: ev.loaded / ev.total * file.size,\n bytesTotal: file.size\n });\n });\n });\n xhr.addEventListener('load', ev => {\n timer.done();\n\n if (this.opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {\n const body = this.opts.getResponseData(xhr.responseText, xhr);\n const uploadResp = {\n status: ev.target.status,\n body\n };\n files.forEach(file => {\n this.uppy.emit('upload-success', file, uploadResp);\n });\n return resolve();\n }\n\n const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');\n error.request = xhr;\n emitError(error);\n return reject(error);\n });\n xhr.addEventListener('error', () => {\n timer.done();\n const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');\n emitError(error);\n return reject(error);\n });\n this.uppy.on('cancel-all', () => {\n timer.done();\n xhr.abort();\n });\n xhr.open(method.toUpperCase(), endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`\n // before `open()` is called.\n\n xhr.withCredentials = this.opts.withCredentials;\n\n if (this.opts.responseType !== '') {\n xhr.responseType = this.opts.responseType;\n }\n\n Object.keys(this.opts.headers).forEach(header => {\n xhr.setRequestHeader(header, this.opts.headers[header]);\n });\n xhr.send(formData);\n files.forEach(file => {\n this.uppy.emit('upload-started', file);\n });\n });\n }\n\n uploadFiles(files) {\n const promises = files.map((file, i) => {\n const current = parseInt(i, 10) + 1;\n const total = files.length;\n\n if (file.error) {\n return Promise.reject(new Error(file.error));\n }\n\n if (file.isRemote) {\n return this.uploadRemote(file, current, total);\n }\n\n return this.upload(file, current, total);\n });\n return settle(promises);\n }\n\n onFileRemove(fileID, cb) {\n this.uploaderEvents[fileID].on('file-removed', file => {\n if (fileID === file.id) cb(file.id);\n });\n }\n\n onRetry(fileID, cb) {\n this.uploaderEvents[fileID].on('upload-retry', targetFileID => {\n if (fileID === targetFileID) {\n cb();\n }\n });\n }\n\n onRetryAll(fileID, cb) {\n this.uploaderEvents[fileID].on('retry-all', () => {\n if (!this.uppy.getFile(fileID)) return;\n cb();\n });\n }\n\n onCancelAll(fileID, cb) {\n this.uploaderEvents[fileID].on('cancel-all', () => {\n if (!this.uppy.getFile(fileID)) return;\n cb();\n });\n }\n\n handleUpload(fileIDs) {\n if (fileIDs.length === 0) {\n this.uppy.log('[XHRUpload] No files to upload!');\n return Promise.resolve();\n } // No limit configured by the user, and no RateLimitedQueue passed in by a \"parent\" plugin\n // (basically just AwsS3) using the internal symbol\n\n\n if (this.opts.limit === 0 && !this.opts[internalRateLimitedQueue]) {\n this.uppy.log('[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0', 'warning');\n }\n\n this.uppy.log('[XHRUpload] Uploading...');\n const files = fileIDs.map(fileID => this.uppy.getFile(fileID));\n\n if (this.opts.bundle) {\n // if bundle: true, we don’t support remote uploads\n const isSomeFileRemote = files.some(file => file.isRemote);\n\n if (isSomeFileRemote) {\n throw new Error('Can’t upload remote files when the `bundle: true` option is set');\n }\n\n if (typeof this.opts.headers === 'function') {\n throw new TypeError('`headers` may not be a function when the `bundle: true` option is set');\n }\n\n return this.uploadBundle(files);\n }\n\n return this.uploadFiles(files).then(() => null);\n }\n\n install() {\n if (this.opts.bundle) {\n const {\n capabilities\n } = this.uppy.getState();\n this.uppy.setState({\n capabilities: { ...capabilities,\n individualCancellation: false\n }\n });\n }\n\n this.uppy.addUploader(this.handleUpload);\n }\n\n uninstall() {\n if (this.opts.bundle) {\n const {\n capabilities\n } = this.uppy.getState();\n this.uppy.setState({\n capabilities: { ...capabilities,\n individualCancellation: true\n }\n });\n }\n\n this.uppy.removeUploader(this.handleUpload);\n }\n\n}, _class.VERSION = \"2.0.5\", _temp);"],"sourceRoot":""}
|