/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/@u-wave/react-vimeo@0.9.12/dist/react-vimeo.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),PropTypes=require("prop-types"),Player=require("@vimeo/player");function _inheritsLoose(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,_setPrototypeOf(e,o)}function _setPrototypeOf(e,o){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,o){return e.__proto__=o,e},_setPrototypeOf(e,o)}var eventNames={play:"onPlay",playing:"onPlaying",pause:"onPause",ended:"onEnd",timeupdate:"onTimeUpdate",progress:"onProgress",seeked:"onSeeked",texttrackchange:"onTextTrackChange",cuechange:"onCueChange",cuepoint:"onCuePoint",volumechange:"onVolumeChange",playbackratechange:"onPlaybackRateChange",error:"onError",loaded:"onLoaded"},Vimeo=function(e){function o(o){var t;return(t=e.call(this,o)||this).refContainer=t.refContainer.bind(t),t}_inheritsLoose(o,e);var t=o.prototype;return t.componentDidMount=function(){this.createPlayer()},t.componentDidUpdate=function(e){var o=this,t=Object.keys(this.props).filter((function(t){return o.props[t]!==e[t]}));this.updateProps(t)},t.componentWillUnmount=function(){this.player.destroy()},t.getInitialOptions=function(){var e,o=this.props.video;return(e={})[/^https?:/i.test(o)?"url":"id"]=o,e.width=this.props.width,e.height=this.props.height,e.autopause=this.props.autopause,e.autoplay=this.props.autoplay,e.byline=this.props.showByline,e.color=this.props.color,e.controls=this.props.controls,e.loop=this.props.loop,e.portrait=this.props.showPortrait,e.title=this.props.showTitle,e.muted=this.props.muted,e.background=this.props.background,e.responsive=this.props.responsive,e.dnt=this.props.dnt,e.speed=this.props.speed,e.keyboard=this.props.keyboard,e.pip=this.props.pip,e.playsinline=this.props.playsInline,e.quality=this.props.quality,e.texttrack=this.props.textTrack,e.transparent=this.props.transparent,e},t.updateProps=function(e){var o=this,t=this.player;e.forEach((function(e){var p=o.props[e];switch(e){case"autopause":t.setAutopause(p);break;case"color":t.setColor(p);break;case"loop":t.setLoop(p);break;case"volume":t.setVolume(p);break;case"paused":t.getPaused().then((function(e){return p&&!e?t.pause():!p&&e?t.play():null}));break;case"width":case"height":t.element[e]=p;break;case"video":if(p){var r=o.props.start,s=t.loadVideo(p);"number"==typeof r&&s.then((function(){t.setCurrentTime(r)}))}else t.unload();break;case"playbackRate":t.setPlaybackRate(p);break;case"quality":t.setQuality(p)}}))},t.createPlayer=function(){var e=this,o=this.props,t=o.start,p=o.volume,r=o.playbackRate;this.player=new Player(this.container,this.getInitialOptions()),Object.keys(eventNames).forEach((function(o){var t=eventNames[o];e.player.on(o,(function(o){var p=e.props[t];p&&p(o)}))}));var s=this.props,n=s.onError,a=s.onReady;this.player.ready().then((function(){a&&a(e.player)}),(function(e){if(!n)throw e;n(e)})),"number"==typeof t&&this.player.setCurrentTime(t),"number"==typeof p&&this.updateProps(["volume"]),"number"==typeof r&&this.updateProps(["playbackRate"])},t.refContainer=function(e){this.container=e},t.render=function(){var e=this.props,o=e.id,t=e.className,p=e.style;return React.createElement("div",{id:o,className:t,style:p,ref:this.refContainer})},o}(React.Component);"production"!==process.env.NODE_ENV&&(Vimeo.propTypes={video:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),id:PropTypes.string,className:PropTypes.string,style:PropTypes.object,width:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),height:PropTypes.oneOfType([PropTypes.number,PropTypes.string]),paused:PropTypes.bool,volume:PropTypes.number,start:PropTypes.number,autopause:PropTypes.bool,autoplay:PropTypes.bool,showByline:PropTypes.bool,color:PropTypes.string,dnt:PropTypes.bool,controls:PropTypes.bool,loop:PropTypes.bool,showPortrait:PropTypes.bool,showTitle:PropTypes.bool,muted:PropTypes.bool,background:PropTypes.bool,responsive:PropTypes.bool,playbackRate:PropTypes.number,speed:PropTypes.bool,keyboard:PropTypes.bool,pip:PropTypes.bool,playsInline:PropTypes.bool,quality:PropTypes.string,textTrack:PropTypes.string,transparent:PropTypes.bool,onReady:PropTypes.func,onError:PropTypes.func,onPlay:PropTypes.func,onPlaying:PropTypes.func,onPause:PropTypes.func,onEnd:PropTypes.func,onTimeUpdate:PropTypes.func,onProgress:PropTypes.func,onSeeked:PropTypes.func,onTextTrackChange:PropTypes.func,onCueChange:PropTypes.func,onCuePoint:PropTypes.func,onVolumeChange:PropTypes.func,onPlaybackRateChange:PropTypes.func,onLoaded:PropTypes.func}),Vimeo.defaultProps={autopause:!0,autoplay:!1,showByline:!0,controls:!0,loop:!1,showPortrait:!0,showTitle:!0,muted:!1,background:!1,responsive:!1,dnt:!1,speed:!1,keyboard:!0,pip:!1,playsInline:!0,transparent:!0},exports.default=Vimeo;
//# sourceMappingURL=/sm/092ca1b869c45ecea8e37555269cd6f603be42ffa72280b7497de573baf2bd25.map