@micromag/viewer-build 0.2.404 → 0.2.405

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.
Files changed (54) hide show
  1. package/build/static/css/main.c82d5346.css +5 -0
  2. package/build/static/css/main.c82d5346.css.map +1 -0
  3. package/build/static/css/main.f4d95294.chunk.css +2 -0
  4. package/build/static/css/main.f4d95294.chunk.css.map +1 -0
  5. package/build/static/js/0.a8781713.chunk.js +2 -0
  6. package/build/static/js/0.a8781713.chunk.js.map +1 -0
  7. package/build/static/js/1.310fc8fa.chunk.js +2 -0
  8. package/build/static/js/1.310fc8fa.chunk.js.map +1 -0
  9. package/build/static/js/10.1621cab3.chunk.js +2 -0
  10. package/build/static/js/10.1621cab3.chunk.js.map +1 -0
  11. package/build/static/js/11.c52bdfa2.chunk.js +2 -0
  12. package/build/static/js/11.c52bdfa2.chunk.js.map +1 -0
  13. package/build/static/js/12.703b846d.chunk.js +2 -0
  14. package/build/static/js/12.703b846d.chunk.js.map +1 -0
  15. package/build/static/js/13.e2bba628.chunk.js +2 -0
  16. package/build/static/js/13.e2bba628.chunk.js.map +1 -0
  17. package/build/static/js/14.68d2783a.chunk.js +2 -0
  18. package/build/static/js/14.68d2783a.chunk.js.map +1 -0
  19. package/build/static/js/15.f1290dcc.chunk.js +2 -0
  20. package/build/static/js/15.f1290dcc.chunk.js.map +1 -0
  21. package/build/static/js/4.1b97e2f2.chunk.js +3 -0
  22. package/build/static/js/{main.f0bf47ba.js.LICENSE.txt → 4.1b97e2f2.chunk.js.LICENSE.txt} +9 -0
  23. package/build/static/js/4.1b97e2f2.chunk.js.map +1 -0
  24. package/build/static/js/5.02c40704.chunk.js +2 -0
  25. package/build/static/js/5.02c40704.chunk.js.map +1 -0
  26. package/build/static/js/6.9364266f.chunk.js +2 -0
  27. package/build/static/js/6.9364266f.chunk.js.map +1 -0
  28. package/build/static/js/7.7aec7172.chunk.js +2 -0
  29. package/build/static/js/7.7aec7172.chunk.js.map +1 -0
  30. package/build/static/js/8.6cb2151e.chunk.js +2 -0
  31. package/build/static/js/8.6cb2151e.chunk.js.map +1 -0
  32. package/build/static/js/9.54c11089.chunk.js +2 -0
  33. package/build/static/js/9.54c11089.chunk.js.map +1 -0
  34. package/build/static/js/main.be16dbbf.js +2 -0
  35. package/build/static/js/main.be16dbbf.js.map +1 -0
  36. package/build/static/js/main.d8c7f159.chunk.js +2 -0
  37. package/build/static/js/main.d8c7f159.chunk.js.map +1 -0
  38. package/build/static/js/runtime-main.ba9f82db.js +2 -0
  39. package/build/static/js/runtime-main.ba9f82db.js.map +1 -0
  40. package/package.json +7 -7
  41. package/build/static/css/main.bf425f45.css +0 -2
  42. package/build/static/css/main.bf425f45.css.map +0 -1
  43. package/build/static/js/584.712e20c9.js +0 -3
  44. package/build/static/js/584.712e20c9.js.LICENSE.txt +0 -109
  45. package/build/static/js/584.712e20c9.js.map +0 -1
  46. package/build/static/js/596.16611391.chunk.js +0 -2
  47. package/build/static/js/596.16611391.chunk.js.map +0 -1
  48. package/build/static/js/main.1db78e0c.js +0 -2
  49. package/build/static/js/main.1db78e0c.js.map +0 -1
  50. package/build/static/js/main.d207f62a.js +0 -2
  51. package/build/static/js/main.d207f62a.js.map +0 -1
  52. package/build/static/js/main.f0bf47ba.js +0 -3
  53. package/build/static/js/main.f0bf47ba.js.map +0 -1
  54. package/build/static/media/index.06ad11ea3e32fd3e4303.cjs +0 -1
@@ -0,0 +1,2 @@
1
+ (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[5],{459:function(e,t,i){var r=i(461);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},461:function(e,t,i){var r=i(150);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e}},475: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"}))}},489: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}},490:function(e,t,i){"use strict";e.exports=function(e,t,i){return new Promise((function(r){e.toBlob(r,t,i)}))}},491:function(e,t,i){"use strict";e.exports=function(){return"function"===typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"===typeof MediaRecorder.prototype.start}},492: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(493),l=i(494),h=i(495),g=i(497),v=i(498),m=i(499);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&&!I,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})),u("div",{className:"uppy-Webcam-recordingLength"},V&&u(h,{recordingLengthSeconds:P,i18n:w}))))}}]),i}(d);e.exports=y},493:function(e,t,i){"use strict";var r=i(17).h,n=i(475);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())}},494: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"})))}},495:function(e,t,i){"use strict";var r=i(17).h,n=i(496);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)}},496:function(e,t,i){"use strict";e.exports=function(e){return"".concat(Math.floor(e/60),":").concat(String(e%60).padStart(2,0))}},497: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)}))))}},498: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"})))}},499: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 uppy-Webcam-button--discard",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"}))))}},500: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")))}},501:function(e,t,i){"use strict";e.exports={strings:{pluginNameCamera:"Camera",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",submitRecordedFile:"Submit recorded file",discardRecordedFile:"Discard recorded file",smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",recordingLength:"Recording length %{recording_length}",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."}}},528:function(e,t,i){"use strict";var r,n,o,s=i(46),a=i(111),c=i(30),u=i(19),d=i(20),p=i(56),l=i(459),h=i(150),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(489),k=i(233),C=i(490),x=i(491),P=i(475),I=i(492),M=i(500),T=i(501);function V(e){return"."===e[0]?k[e.slice(1)]:e}function L(e){return/^video\/[^*]+$/.test(e)}function D(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=T;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(e){void 0===e&&(e=null);var 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(e){var t=this;if(void 0===e&&(e=null),!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(e&&e.deviceId?e.deviceId:null);this.hasCameraCheck().then((function(r){return t.setPluginState({hasCamera:r}),t.mediaDevices.getUserMedia(i).then((function(i){t.stream=i;var r=null,n=t.isAudioOnly()?i.getAudioTracks():i.getVideoTracks();e&&e.deviceId?n.forEach((function(t){t.getSettings().deviceId===e.deviceId&&(r=t.getSettings().deviceId)})):r=n[0].getSettings().deviceId,t.updateVideoSources(),t.setPluginState({currentDeviceId:r,cameraReady:!0})})).catch((function(e){t.setPluginState({cameraReady:!1,cameraError:e}),t.uppy.info(e.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(V).filter(L));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(V).filter(D));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.5",o)}}]);
2
+ //# sourceMappingURL=5.02c40704.chunk.js.map
@@ -0,0 +1 @@
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/locale.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","_ref","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","strings","pluginNameCamera","noCameraTitle","noCameraDescription","recordingStoppedMaxSize","submitRecordedFile","discardRecordedFile","smile","takePicture","startRecording","stopRecording","recordingLength","allowAccessTitle","allowAccessDescription","_class","_enableMirror","_temp","_classPrivateFieldLooseBase","privateKey","TypeError","id","_classPrivateFieldLooseKey","name","UIPlugin","getFileTypeExtension","mimeTypes","canvasToBlob","supportsMediaRecorder","PermissionsScreen","locale","toMimeType","fileType","slice","isVideoMimeType","test","isImageMimeType","uppy","opts","defineProperty","writable","mediaDevices","navigator","supportsUserMedia","protocol","location","match","capturedMediaFile","rx","defaultLocale","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,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,EAAKP,OAAQ,CACf,IAAI8E,GAAgB,EACpB,EAGI,EAAK1C,iBAFPtL,EADF,EACEA,aACA4C,EAFF,EAEEA,gBAEF5C,EAAasJ,SAAQ,SAAArG,GACfL,IAAoBK,EAAYC,WAClC8K,GAAgB,MAIhBA,IACF,EAAK5G,OACL,EAAKjJ,cArkByF,uBA4kBxG,WACES,KAAKwI,OACLxI,KAAKqP,YA9kBiG,uBAilBxG,WACErP,KAAKwI,WAllBiG,GAAwBrC,GAqlB9HT,EAAO4J,QAAU,QAAS1J","file":"static/js/5.02c40704.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 && !hasRecordedVideo;\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 })), h(\"div\", {\n className: \"uppy-Webcam-recordingLength\"\n }, shouldShowRecordingLength && 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 = _ref => {\n let {\n onSnapshot,\n i18n\n } = _ref;\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(_ref) {\n let {\n recording,\n onStartRecording,\n onStopRecording,\n i18n\n } = _ref;\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(_ref) {\n let {\n recordingLengthSeconds,\n i18n\n } = _ref;\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 = _ref => {\n let {\n currentDeviceId,\n videoSources,\n onChangeVideoSource\n } = _ref;\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(_ref) {\n let {\n onSubmit,\n i18n\n } = _ref;\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(_ref) {\n let {\n onDiscard,\n i18n\n } = _ref;\n return h(\"button\", {\n className: \"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--discard\",\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\nmodule.exports = {\n strings: {\n pluginNameCamera: 'Camera',\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 submitRecordedFile: 'Submit recorded file',\n discardRecordedFile: 'Discard recorded file',\n // Shown before a picture is taken when the `countdown` option is set.\n smile: 'Smile!',\n // Used as the label for the button that takes a picture.\n // This is not visibly rendered but is picked up by screen readers.\n takePicture: 'Take a picture',\n // Used as the label for the button that starts a video recording.\n // This is not visibly rendered but is picked up by screen readers.\n startRecording: 'Begin video recording',\n // Used as the label for the button that stops a video recording.\n // This is not visibly rendered but is picked up by screen readers.\n stopRecording: 'Stop video recording',\n // Used as the label for the recording length counter. See the showRecordingLength option.\n // This is not visibly rendered but is picked up by screen readers.\n recordingLength: 'Recording length %{recording_length}',\n // Title on the “allow access” screen\n allowAccessTitle: 'Please allow access to your camera',\n // Description on the “allow access” screen\n allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.'\n }\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\nconst locale = require('./locale.js');\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 = locale; // 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) {\n if (deviceId === void 0) {\n deviceId = null;\n }\n\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) {\n if (options === void 0) {\n options = null;\n }\n\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.5\", _temp);"],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ (this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[6],{481:function(e,t,r){"use strict";r.r(t),r.d(t,"Upload",(function(){return pe})),r.d(t,"canStoreURLs",(function(){return z})),r.d(t,"defaultOptions",(function(){return ce})),r.d(t,"isSupported",(function(){return ve})),r.d(t,"enableDebugLog",(function(){return m})),r.d(t,"HttpStack",(function(){return N}));var n=r(482),o=r(483),i=r.n(o);function a(e){return a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return!t||"object"!==a(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){var t="function"===typeof Map?new Map:void 0;return l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return c(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,e)},l(e)}function c(e,t,r){return c=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&f(o,r.prototype),o},c.apply(null,arguments)}function p(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}var h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,e);var t,r=(t=n,function(){var e,r=d(t);if(p()){var n=d(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return u(this,e)});function n(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(s(this,n),(t=r.call(this,e)).originalRequest=i,t.originalResponse=a,t.causingError=o,null!=o&&(e+=", caused by ".concat(o.toString())),null!=i){var u=i.getHeader("X-Request-ID")||"n/a",l=i.getMethod(),c=i.getURL(),p=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(l,", url: ").concat(c,", response code: ").concat(p,", response text: ").concat(f,", request id: ").concat(u,")")}return t.message=e,t}return n}(l(Error)),v=h,y=!1;function m(){y=!0}function g(e){y&&console.log(e)}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var S={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,_onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:null,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},R=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}var t,r,n;return t=e,r=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(t){e.options[t]&&e._emitError(new Error("tus: cannot use the ".concat(t," option when parallelUploads is enabled")))})),this.options.fingerprint(t,this.options).then((function(r){return g(null==r?"No fingerprint was calculated meaning that the upload cannot be stored in the URL storage.":"Calculated fingerprint: ".concat(r)),e._fingerprint=r,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){e._source=t,e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t=this,r=this._size=this._source.size,n=0;this._parallelUploads=[];var o=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,i=function(e,t,r){for(var n=Math.floor(e/t),o=[],i=0;i<t;i++)o.push({start:n*i,end:n*(i+1)});return o[t-1].end=e,r&&o.forEach((function(e,t){e.uploadUrl=r[t]||null})),o}(this._source.size,o,this._parallelUploadUrls);this._parallelUploadUrls=new Array(i.length);var a,s=i.map((function(o,a){var s=0;return t._source.slice(o.start,o.end).then((function(u){var l=u.value;return new Promise((function(u,c){var p=b({},t.options,{uploadUrl:o.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,metadata:{},headers:b({},t.options.headers,{"Upload-Concat":"partial"}),onSuccess:u,onError:c,onProgress:function(e){n=n-s+e,s=e,t._emitProgress(n,r)},_onUploadUrlAvailable:function(){t._parallelUploadUrls[a]=f.url,t._parallelUploadUrls.filter((function(e){return!!e})).length===i.length&&t._saveUploadInUrlStorage()}}),f=new e(l,p);f.start(),t._parallelUploads.push(f)}))}))}));Promise.all(s).then((function(){(a=t._openRequest("POST",t.options.endpoint)).setHeader("Upload-Concat","final;".concat(t._parallelUploadUrls.join(" ")));var e=k(t.options.metadata);return""!==e&&a.setHeader("Upload-Metadata",e),t._sendRequest(a,null)})).then((function(e){if(P(e.getStatus(),200)){var r=e.getHeader("Location");null!=r?(t.url=A(t.options.endpoint,r),g("Created upload at ".concat(t.url)),t._emitSuccess()):t._emitHttpError(a,e,"tus: invalid or missing Location header")}else t._emitHttpError(a,e,"tus: unexpected response while creating upload")})).catch((function(e){t._emitError(e)}))}},{key:"_startSingleUpload",value:function(){if(this.options.uploadLengthDeferred)this._size=null;else if(null!=this.options.uploadSize){if(this._size=+this.options.uploadSize,isNaN(this._size))return void this._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(this._size=this._source.size,null==this._size)return void this._emitError(new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option"));return this._aborted=!1,null!=this.url?(g("Resuming upload from previous URL: ".concat(this.url)),void this._resumeUpload()):null!=this.options.uploadUrl?(g("Resuming upload from provided URL: ".concat(this.options.url)),this.url=this.options.uploadUrl,void this._resumeUpload()):(g("Creating a new upload"),void this._createUpload())}},{key:"abort",value:function(t){var r=this;if(arguments.length>1&&"function"===typeof arguments[1])throw new Error("tus: the abort function does not accept a callback since v2 anymore; please use the returned Promise instead");return null!=this._parallelUploads&&this._parallelUploads.forEach((function(e){e.abort(t)})),null!==this._req&&(this._req.abort(),this._source.close()),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),t&&null!=this.url?e.terminate(this.url,this.options).then((function(){return r._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(e,t,r,n){this._emitError(new v(r,n,e,t))}},{key:"_emitError",value:function(e){var t=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),x(e,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),r))}if("function"!==typeof this.options.onError)throw e;this.options.onError(e)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"===typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(e,t){"function"===typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,r){"function"===typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,r)}},{key:"_createUpload",value:function(){var e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length",1):t.setHeader("Upload-Length",this._size);var r,n=k(this.options.metadata);""!==n&&t.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(t)):r=this._sendRequest(t,null),r.then((function(r){if(P(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(e.url=A(e.options.endpoint,n),g("Created upload at ".concat(e.url)),"function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),0===e._size)return e._emitSuccess(),void e._source.close();e._saveUploadInUrlStorage(),e.options.uploadDataDuringCreation?e._handleUploadResponse(t,r):(e._offset=0,e._performUpload())}else e._emitHttpError(t,r,"tus: invalid or missing Location header")}else e._emitHttpError(t,r,"tus: unexpected response while creating upload")})).catch((function(r){e._emitHttpError(t,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(r){var n=r.getStatus();if(!P(n,200))return P(n,400)&&e._removeFromUrlStorage(),423===n?void e._emitHttpError(t,r,"tus: upload is currently locked; retry later"):e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var o=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(o))e._emitHttpError(t,r,"tus: invalid or missing offset value");else{var i=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(i)||e.options.uploadLengthDeferred){if("function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),o===i)return e._emitProgress(i,i),void e._emitSuccess();e._offset=o,e._performUpload()}else e._emitHttpError(t,r,"tus: invalid or missing length value")}})).catch((function(r){e._emitHttpError(t,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then((function(r){P(r.getStatus(),200)?t._handleUploadResponse(e,r):t._emitHttpError(e,r,"tus: unexpected response while uploading chunk")})).catch((function(r){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(t._offset),r)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,r=this._offset,n=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(r+e,t._size)})),e.setHeader("Content-Type","application/offset+octet-stream"),(n===1/0||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,o=r.done;return t.options.uploadLengthDeferred&&o&&(t._size=t._offset+(n&&n.size?n.size:0),e.setHeader("Upload-Length",t._size)),null===n?t._sendRequest(e):(t._emitProgress(t._offset,t._size),t._sendRequest(e,n))}))}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(e,t,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var r=O(e,t,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){return e._urlStorageKey=t})).catch((function(t){e._emitError(t)}))}}},{key:"_sendRequest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return E(e,t,this.options)}}],n=[{key:"terminate",value:function(t,r){if(arguments.length>1&&"function"===typeof arguments[arguments.length-1])throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");void 0===r&&(r={});var n=O("DELETE",t,r);return E(n,null,r).then((function(e){if(204!==e.getStatus())throw new v("tus: unexpected response while terminating upload",null,n,e)})).catch((function(o){if(o instanceof v||(o=new v("tus: failed to terminate upload",o,n,null)),!x(o,0,r))throw o;var i=r.retryDelays[0],a=r.retryDelays.slice(1),s=b({},r,{retryDelays:a});return new Promise((function(e){return setTimeout(e,i)})).then((function(){return e.terminate(t,s)}))}))}}],r&&U(t.prototype,r),n&&U(t,n),e}();function k(e){var t=[];for(var r in e)t.push("".concat(r," ").concat(n.Base64.encode(e[r])));return t.join(",")}function P(e,t){return e>=t&&e<t+100}function O(e,t,r){var n=r.httpStack.createRequest(e,t);n.setHeader("Tus-Resumable","1.0.0");var o=r.headers||{};for(var i in o)n.setHeader(i,o[i]);if(r.addRequestId){var a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}));n.setHeader("X-Request-ID",a)}return n}function E(e,t,r){return("function"===typeof r.onBeforeRequest?Promise.resolve(r.onBeforeRequest(e)):Promise.resolve()).then((function(){return e.send(t).then((function(t){return("function"===typeof r.onAfterResponse?Promise.resolve(r.onAfterResponse(e,t)):Promise.resolve()).then((function(){return t}))}))}))}function x(e,t,r){if(null==r.retryDelays||t>=r.retryDelays.length||null==e.originalRequest)return!1;if(r&&"function"===typeof r.onShouldRetry)return r.onShouldRetry(e,t,r);var n=e.originalResponse?e.originalResponse.getStatus():0;return(!P(n,400)||409===n||423===n)&&function(){var e=!0;return"undefined"!==typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(e=!1),e}()}function A(e,t){return new i.a(t,e).toString()}R.defaultOptions=S;var j=R;function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var q=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,(r=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(e){return Promise.resolve([])}},{key:"removeUpload",value:function(e){return Promise.resolve()}},{key:"addUpload",value:function(e,t){return Promise.resolve(null)}}])&&C(t.prototype,r),n&&C(t,n),e}();function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var F=!1;try{F="localStorage"in window;var T="tusSupport";localStorage.setItem(T,localStorage.getItem(T))}catch(ye){if(ye.code!==ye.SECURITY_ERR&&ye.code!==ye.QUOTA_EXCEEDED_ERR)throw ye;F=!1}var z=F,H=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=[{key:"findAllUploads",value:function(){var e=this._findEntries("tus::");return Promise.resolve(e)}},{key:"findUploadsByFingerprint",value:function(e){var t=this._findEntries("tus::".concat(e,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(e){return localStorage.removeItem(e),Promise.resolve()}},{key:"addUpload",value:function(e,t){var r=Math.round(1e12*Math.random()),n="tus::".concat(e,"::").concat(r);return localStorage.setItem(n,JSON.stringify(t)),Promise.resolve(n)}},{key:"_findEntries",value:function(e){for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(e))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,t.push(o)}catch(ye){}}return t}}],r&&D(t.prototype,r),n&&D(t,n),e}();function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e,t,r){return t&&L(e.prototype,t),r&&L(e,r),e}var N=function(){function e(){B(this,e)}return I(e,[{key:"createRequest",value:function(e,t){return new M(e,t)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),e}(),M=function(){function e(t,r){B(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,!0),this._method=t,this._url=r,this._headers={}}return I(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(e,t){this._xhr.setRequestHeader(e,t),this._headers[e]=t}},{key:"getHeader",value:function(e){return this._headers[e]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){e._xhr.onload=function(){r(new K(e._xhr))},e._xhr.onerror=function(e){n(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),K=function(){function e(t){B(this,e),this._xhr=t}return I(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),X=function(){return"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};var J=function(){return"undefined"!=typeof window&&("undefined"!=typeof window.PhoneGap||"undefined"!=typeof window.Cordova||"undefined"!=typeof window.cordova)};function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q(e,t,r){return t&&G(e.prototype,t),r&&G(e,r),e}var V=function(){function e(t){Z(this,e),this._file=t,this.size=t.size}return Q(e,[{key:"slice",value:function(e,t){if(J())return r=this._file.slice(e,t),new Promise((function(e,t){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result);e({value:t})},n.onerror=function(e){t(e)},n.readAsArrayBuffer(r)}));var r,n=this._file.slice(e,t);return Promise.resolve({value:n})}},{key:"close",value:function(){}}]),e}(),W=function(){function e(t,r){Z(this,e),this._chunkSize=r,this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}return Q(e,[{key:"slice",value:function(e,t){return e<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t){var r=this,n=t<=this._bufferOffset+Y(this._buffer);if(this._done||n){var o=this._getDataFromBuffer(e,t),i=null==o&&this._done;return Promise.resolve({value:o,done:i})}return this._reader.read().then((function(n){var o=n.value;return n.done?r._done=!0:void 0===r._buffer?r._buffer=o:r._buffer=function(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}(r._buffer,o),r._readUntilEnoughDataOrDone(e,t)}))}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===Y(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),e}();function Y(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var $=function(){function e(){Z(this,e)}return Q(e,[{key:"openFile",value:function(e,t){return X()&&e&&"undefined"!==typeof e.uri?(r=e.uri,new Promise((function(e,t){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=n.response;e(t)},n.onerror=function(e){t(e)},n.open("GET",r),n.send()}))).then((function(e){return new V(e)})).catch((function(e){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(e))})):"function"===typeof e.slice&&"undefined"!==typeof e.size?Promise.resolve(new V(e)):"function"===typeof e.read?(t=+t,isFinite(t)?Promise.resolve(new W(e,t)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"));var r}}]),e}();function ee(e){return ee="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ne(e,t)}function oe(e,t){return!t||"object"!==ee(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(ye){return!1}}function ae(e){return ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ae(e)}function se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?se(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ce=ue({},j.defaultOptions,{httpStack:new N,fileReader:new $,urlStorage:z?new H:new q,fingerprint:function(e,t){return X()?Promise.resolve(function(e,t){var r=e.exif?function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t}(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}}),pe=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ne(e,t)}(a,e);var t,r,n,o,i=(t=a,function(){var e,r=ae(t);if(ie()){var n=ae(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return oe(this,e)});function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return te(this,a),t=ue({},ce,{},t),i.call(this,e,t)}return r=a,o=[{key:"terminate",value:function(e,t,r){return t=ue({},ce,{},t),j.terminate(e,t,r)}}],(n=null)&&re(r.prototype,n),o&&re(r,o),a}(j),fe=window,de=fe.XMLHttpRequest,he=fe.Blob,ve=de&&he&&"function"===typeof he.prototype.slice},482:function(e,t,r){(function(r){var n;!function(r,o){e.exports=function(r){"use strict";var o,i=(r=r||{}).Base64,a="2.6.4",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(s),l=String.fromCharCode,c=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?l(192|t>>>6)+l(128|63&t):l(224|t>>>12&15)+l(128|t>>>6&63)+l(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return l(240|t>>>18&7)+l(128|t>>>12&63)+l(128|t>>>6&63)+l(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(e){return e.replace(p,c)},d=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[s.charAt(r>>>18),s.charAt(r>>>12&63),t>=2?"=":s.charAt(r>>>6&63),t>=1?"=":s.charAt(63&r)].join("")},h=r.btoa&&"function"==typeof r.btoa?function(e){return r.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,d)},v=function(e){return h(f(String(e)))},y=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},m=function(e,t){return t?y(v(e)):v(e)},g=function(e){return m(e,!0)};r.Uint8Array&&(o=function(e,t){for(var r="",n=0,o=e.length;n<o;n+=3){var i=e[n],a=e[n+1],u=e[n+2],l=i<<16|a<<8|u;r+=s.charAt(l>>>18)+s.charAt(l>>>12&63)+("undefined"!=typeof a?s.charAt(l>>>6&63):"=")+("undefined"!=typeof u?s.charAt(63&l):"=")}return t?y(r):r});var _,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return l(55296+(t>>>10))+l(56320+(1023&t));case 3:return l((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return l((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},U=function(e){return e.replace(b,w)},S=function(e){var t=e.length,r=t%4,n=(t>0?u[e.charAt(0)]<<18:0)|(t>1?u[e.charAt(1)]<<12:0)|(t>2?u[e.charAt(2)]<<6:0)|(t>3?u[e.charAt(3)]:0),o=[l(n>>>16),l(n>>>8&255),l(255&n)];return o.length-=[0,0,2,1][r],o.join("")},R=r.atob&&"function"==typeof r.atob?function(e){return r.atob(e)}:function(e){return e.replace(/\S{1,4}/g,S)},k=function(e){return R(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},P=function(e){return U(R(e))},O=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},E=function(e){return P(O(e))};r.Uint8Array&&(_=function(e){return Uint8Array.from(k(O(e)),(function(e){return e.charCodeAt(0)}))});var x=function(){var e=r.Base64;return r.Base64=i,e};if(r.Base64={VERSION:a,atob:k,btoa:h,fromBase64:E,toBase64:m,utob:f,encode:m,encodeURI:g,btou:U,decode:E,noConflict:x,fromUint8Array:o,toUint8Array:_},"function"===typeof Object.defineProperty){var A=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};r.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",A((function(){return E(this)}))),Object.defineProperty(String.prototype,"toBase64",A((function(e){return m(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",A((function(){return m(this,!0)})))}}r.Meteor&&(Base64=r.Base64);e.exports?e.exports.Base64=r.Base64:void 0===(n=function(){return r.Base64}.apply(t,[]))||(e.exports=n);return{Base64:r.Base64}}(r)}("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof r?r:this)}).call(this,r(50))},483:function(e,t,r){"use strict";(function(t){var n=r(484),o=r(485),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,s=/^[a-zA-Z]:/,u=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(u,"")}var c=[["#","hash"],["?","query"],function(e,t){return d(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],p={hash:1,query:1};function f(e){var r,n=("undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{}).location||{},o={},a=typeof(e=e||n);if("blob:"===e.protocol)o=new v(unescape(e.pathname),{});else if("string"===a)for(r in o=new v(e,{}),p)delete o[r];else if("object"===a){for(r in e)r in p||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=i.test(e.href))}return o}function d(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function h(e,t){e=l(e),t=t||{};var r,n=a.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],s=!!n[3],u=0;return i?s?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):s?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):d(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&d(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||d(o),slashesCount:u,rest:r}}function v(e,t,r){if(e=l(e),!(this instanceof v))return new v(e,t,r);var i,a,u,p,y,m,g=c.slice(),_=typeof t,b=this,w=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!==typeof r&&(r=o.parse),i=!(a=h(e||"",t=f(t))).protocol&&!a.slashes,b.slashes=a.slashes||i&&t.slashes,b.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||s.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!d(b.protocol)))&&(g[3]=[/(.*)/,"pathname"]);w<g.length;w++)"function"!==typeof(p=g[w])?(u=p[0],m=p[1],u!==u?b[m]=e:"string"===typeof u?~(y=e.indexOf(u))&&("number"===typeof p[2]?(b[m]=e.slice(0,y),e=e.slice(y+p[2])):(b[m]=e.slice(y),e=e.slice(0,y))):(y=u.exec(e))&&(b[m]=y[1],e=e.slice(0,y.index)),b[m]=b[m]||i&&p[3]&&t[m]||"",p[4]&&(b[m]=b[m].toLowerCase())):e=p(e,b);r&&(b.query=r(b.query)),i&&t.slashes&&"/"!==b.pathname.charAt(0)&&(""!==b.pathname||""!==t.pathname)&&(b.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(b.pathname,t.pathname)),"/"!==b.pathname.charAt(0)&&d(b.protocol)&&(b.pathname="/"+b.pathname),n(b.port,b.protocol)||(b.host=b.hostname,b.port=""),b.username=b.password="",b.auth&&(p=b.auth.split(":"),b.username=p[0]||"",b.password=p[1]||""),b.origin="file:"!==b.protocol&&d(b.protocol)&&b.host?b.protocol+"//"+b.host:"null",b.href=b.toString()}v.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"===typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,/:\d+$/.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";i[e]=t.charAt(0)!==a?a+t:t}else i[e]=t;break;default:i[e]=t}for(var s=0;s<c.length;s++){var u=c[s];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.origin="file:"!==i.protocol&&d(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"===typeof e||(e=o.stringify);var t,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes||d(r.protocol)?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(t="object"===typeof r.query?e(r.query):r.query)&&(i+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(i+=r.hash),i}},v.extractProtocol=h,v.location=f,v.trimLeft=l,v.qs=o,e.exports=v}).call(this,r(50))},484:function(e,t,r){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},485:function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function i(e){try{return encodeURIComponent(e)}catch(t){return null}}t.stringify=function(e,t){t=t||"";var r,o,a=[];for(o in"string"!==typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!==r&&undefined!==r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;a.push(o+"="+r)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),a=o(t[2]);null===i||null===a||i in n||(n[i]=a)}return n}},486:function(e,t,r){"use strict";var n=r(481);e.exports=function(e){return function(t,r){if("undefined"!==typeof window&&("undefined"!==typeof window.PhoneGap||"undefined"!==typeof window.Cordova||"undefined"!==typeof window.cordova)||"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return n.defaultOptions.fingerprint(t,r);var o=["tus",e.id,r.endpoint].join("-");return Promise.resolve(o)}}},526:function(e,t,r){"use strict";var n,o,i,a=r(30),s=r(19),u=r(20),l=r(56),c=r(24),p=r(25);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 d=0;function h(e){return"__private_"+d+++"_"+e}var v=r(151),y=r(481),m=r(457),g=m.Provider,_=m.RequestClient,b=m.Socket,w=r(469),U=r(470),S=r(471),R=r(472),k=r(460),P=r(473),O=r(474).RateLimitedQueue,E=r(231),x=r(486),A={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1};e.exports=(o=h("retryDelayIterator"),i=n=function(e){c(r,e);var t=p(r);function r(e,n){var i,u;s(this,r),i=t.call(this,e,n),Object.defineProperty(l(i),o,{writable:!0,value:void 0}),i.type="uploader",i.id=i.opts.id||"Tus",i.title="Tus";var c={useFastRemoteRetry:!0,limit:20,retryDelays:A.retryDelays,withCredentials:!1};if(i.opts=a(a({},c),n),"autoRetry"in n)throw new Error("The `autoRetry` option was deprecated and has been removed.");return i.requests=new O(i.opts.limit),f(l(i),o)[o]=null==(u=i.opts.retryDelays)?void 0:u.values(),i.uploaders=Object.create(null),i.uploaderEvents=Object.create(null),i.uploaderSockets=Object.create(null),i.handleResetProgress=i.handleResetProgress.bind(l(i)),i.handleUpload=i.handleUpload.bind(l(i)),i}return u(r,[{key:"handleResetProgress",value:function(){var e=a({},this.uppy.getState().files);Object.keys(e).forEach((function(t){if(e[t].tus&&e[t].tus.uploadUrl){var r=a({},e[t].tus);delete r.uploadUrl,e[t]=a(a({},e[t]),{},{tus:r})}})),this.uppy.setState({files:e})}},{key:"resetUploaderReferences",value:function(e,t){if(void 0===t&&(t={}),this.uploaders[e]){var r=this.uploaders[e];r.abort(),t.abort&&r.abort(!0),this.uploaders[e]=null}this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null),this.uploaderSockets[e]&&(this.uploaderSockets[e].close(),this.uploaderSockets[e]=null)}},{key:"upload",value:function(e){var t=this;return this.resetUploaderReferences(e.id),new Promise((function(r,n){var i,s;t.uppy.emit("upload-started",e);var u=a(a({},t.opts),e.tus||{});"function"===typeof u.headers&&(u.headers=u.headers(e));var l=a(a({},A),u);l.fingerprint=x(e),l.onBeforeRequest=function(e){e.getUnderlyingObject().withCredentials=!!u.withCredentials,"function"===typeof u.onBeforeRequest&&u.onBeforeRequest(e)},l.onError=function(r){t.uppy.log(r);var o=r.originalRequest?r.originalRequest.getUnderlyingObject():null;P(o)&&(r=new k(r,o)),t.resetUploaderReferences(e.id),i.abort(),t.uppy.emit("upload-error",e,r),n(r)},l.onProgress=function(r,n){t.onReceiveUploadUrl(e,d.url),t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:r,bytesTotal:n})},l.onSuccess=function(){var n={uploadURL:d.url};t.resetUploaderReferences(e.id),i.done(),t.uppy.emit("upload-success",e,n),d.url&&t.uppy.log("Download ".concat(d.file.name," from ").concat(d.url)),r(d)},l.onShouldRetry=function(e,r,n){var a,u=null==e||null==(a=e.originalResponse)?void 0:a.getStatus();if(429===u){if(!t.requests.isPaused){var l,c=null==(l=f(t,o)[o])?void 0:l.next();if(null==c||c.done)return!1;t.requests.rateLimit(c.value)}i.abort(),i=t.requests.run(s)}else{if(u>400&&u<500&&409!==u)return!1;"undefined"!==typeof navigator&&!1===navigator.onLine?(t.requests.isPaused||(t.requests.pause(),window.addEventListener("online",(function(){t.requests.resume()}),{once:!0})),i.abort(),i=t.requests.run(s)):setTimeout((function(){i.abort(),i=t.requests.run(s)}),n.retryDelays[r])}return queueMicrotask((function(){return clearTimeout(i._retryTimeout)})),!0};var c=function(e,t,r){E(e,t)&&!E(e,r)&&(e[r]=e[t])},p={};(Array.isArray(u.metaFields)?u.metaFields:Object.keys(e.meta)).forEach((function(t){p[t]=e.meta[t]})),c(p,"type","filetype"),c(p,"name","filename"),l.metadata=p;var d=new y.Upload(e.data,l);t.uploaders[e.id]=d,t.uploaderEvents[e.id]=new R(t.uppy),s=function(){return e.isPaused||d.start(),function(){}},d.findPreviousUploads().then((function(r){var n=r[0];n&&(t.uppy.log("[Tus] Resuming upload of ".concat(e.id," started at ").concat(n.creationTime)),d.resumeFromPreviousUpload(n))})),i=t.requests.run(s),t.onFileRemove(e.id,(function(n){i.abort(),t.resetUploaderReferences(e.id,{abort:!!d.url}),r("upload ".concat(n," was removed"))})),t.onPause(e.id,(function(e){e?(i.abort(),d.abort()):(i.abort(),i=t.requests.run(s))})),t.onPauseAll(e.id,(function(){i.abort(),d.abort()})),t.onCancelAll(e.id,(function(){i.abort(),t.resetUploaderReferences(e.id,{abort:!!d.url}),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){i.abort(),e.error&&d.abort(),i=t.requests.run(s)}))})).catch((function(r){throw t.uppy.emit("upload-error",e,r),r}))}},{key:"uploadRemote",value:function(e){var t=this;this.resetUploaderReferences(e.id);var r=a({},this.opts);return e.tus&&Object.assign(r,e.tus),this.uppy.emit("upload-started",e),this.uppy.log(e.remote.url),e.serverToken?this.connectToServerSocket(e):new Promise((function(n,o){new(e.remote.providerOptions.provider?g:_)(t.uppy,e.remote.providerOptions).post(e.remote.url,a(a({},e.remote.body),{},{endpoint:r.endpoint,uploadUrl:r.uploadUrl,protocol:"tus",size:e.data.size,headers:r.headers,metadata:e.meta})).then((function(r){return t.uppy.setFileState(e.id,{serverToken:r.token}),e=t.uppy.getFile(e.id),t.connectToServerSocket(e)})).then((function(){n()})).catch((function(r){t.uppy.emit("upload-error",e,r),o(r)}))}))}},{key:"connectToServerSocket",value:function(e){var t=this;return new Promise((function(r,n){var o,i=e.serverToken,a=U(e.remote.companionUrl),s=new b({target:"".concat(a,"/api/").concat(i),autoOpen:!1});t.uploaderSockets[e.id]=s,t.uploaderEvents[e.id]=new R(t.uppy),t.onFileRemove(e.id,(function(){o.abort(),s.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was removed"))})),t.onPause(e.id,(function(e){e?(o.abort(),s.send("pause",{})):(o.abort(),o=t.requests.run((function(){return s.send("resume",{}),function(){}})))})),t.onPauseAll(e.id,(function(){o.abort(),s.send("pause",{})})),t.onCancelAll(e.id,(function(){o.abort(),s.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){o.abort(),e.error&&s.send("pause",{}),o=t.requests.run((function(){return s.send("resume",{}),function(){}}))})),t.onRetry(e.id,(function(){s.isOpen&&(s.send("pause",{}),s.send("resume",{}))})),t.onRetryAll(e.id,(function(){s.isOpen&&(s.send("pause",{}),s.send("resume",{}))})),s.on("progress",(function(r){return w(t,r,e)})),s.on("error",(function(r){var i=r.error.message,a=Object.assign(new Error(i),{cause:r.error});t.opts.useFastRemoteRetry?s.close():(t.resetUploaderReferences(e.id),t.uppy.setFileState(e.id,{serverToken:null})),t.uppy.emit("upload-error",e,a),o.done(),n(a)})),s.on("success",(function(n){var i={uploadURL:n.url};t.uppy.emit("upload-success",e,i),t.resetUploaderReferences(e.id),o.done(),r()})),o=t.requests.run((function(){return s.open(),e.isPaused&&s.send("pause",{}),function(){}}))}))}},{key:"onReceiveUploadUrl",value:function(e,t){var r=this.uppy.getFile(e.id);r&&(r.tus&&r.tus.uploadUrl===t||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:a(a({},r.tus),{},{uploadUrl:t})})))}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(r){e===r.id&&t(r.id)}))}},{key:"onPause",value:function(e,t){this.uploaderEvents[e].on("upload-pause",(function(r,n){e===r&&t(n)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(r){e===r&&t()}))}},{key:"onRetryAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("retry-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onPauseAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("pause-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("cancel-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onResumeAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("resume-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"uploadFiles",value:function(e){var t=this,r=e.map((function(r,n){var o=n+1,i=e.length;return"error"in r&&r.error?Promise.reject(new Error(r.error)):r.isRemote?(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.uploadRemote(r,o,i)):(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.upload(r,o,i))}));return S(r)}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[Tus] No files to upload"),Promise.resolve();0===this.opts.limit&&this.uppy.log("[Tus] 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/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");var r=e.map((function(e){return t.uppy.getFile(e)}));return this.uploadFiles(r).then((function(){return null}))}},{key:"install",value:function(){this.uppy.setState({capabilities:a(a({},this.uppy.getState().capabilities),{},{resumableUploads:!0})}),this.uppy.addUploader(this.handleUpload),this.uppy.on("reset-progress",this.handleResetProgress)}},{key:"uninstall",value:function(){this.uppy.setState({capabilities:a(a({},this.uppy.getState().capabilities),{},{resumableUploads:!1})}),this.uppy.removeUploader(this.handleUpload)}}]),r}(v),n.VERSION="2.2.0",i)}}]);
2
+ //# sourceMappingURL=6.9364266f.chunk.js.map