{"size": 13515, "ext": "js", "max_stars_repo_path": "ihaa2017_files/mediaCommon.min.js", "max_stars_repo_name": "2clyde4you/ih-trail", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ihaa2017_files/mediaCommon.min.js", "max_issues_repo_name": "2clyde4you/ih-trail", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ihaa2017_files/mediaCommon.min.js", "max_forks_repo_name": "2clyde4you/ih-trail", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 6757.5, "max_line_length": 13471, "alphanum_fraction": 0.8121346652}
"use strict";define("mediaCommon/mediaLogic/fillLogicMixin",["lodash","react","santaProps","coreUtils","balata"],function(e,a,t,i,s){function p(a){return e.get(a.compDesign,["background","mediaRef"],e.get(a.compData,["background","mediaRef"]))||{}}function o(a,t){var i=e.pick(a,l.playback.SUPPORTED_MEDIA_ATTRIBUTES),s=e.pick(t,l.playback.SUPPORTED_MEDIA_ATTRIBUTES);return e.assign(i,s)}var l=i.mediaConsts;return{propTypes:e.defaults({id:t.Types.Component.id.isRequired,styleId:t.Types.Component.styleId.isRequired,compProp:t.Types.Component.compProp,compData:t.Types.Component.compData,compDesign:t.Types.Component.compDesign,compStaticBehaviors:t.Types.Component.compStaticBehaviors,compDynamicBehaviors:t.Types.Component.compDynamicBehaviors,bgStyle:a.PropTypes.object,onClick:a.PropTypes.func,mediaAspect:t.Types.SiteAspects.mediaAspect.isRequired,mediaQuality:t.Types.Media.mediaQuality,isDesktopDevice:t.Types.Device.isDesktopDevice.isRequired,isMobileView:t.Types.isMobileView.isRequired,isPlayingAllowed:t.Types.RenderFlags.isPlayingAllowed.isRequired},t.santaTypesUtils.getSantaTypesByDefinition(s)),getInitialState:function(){return this.registerPlayer(this.props),this.mediaAPI=null,this.mediaQuality=this.props.mediaQuality,{}},componentWillReceiveProps:function(e){this.handleVideoDataChange(this.props,e)},handleAutoplay:function(e){var a=p(e).autoplay;this.props.mediaAspect.shouldPlay(e.id)&&a&&e.isPlayingAllowed&&this.playMedia()},handleVideoDataChange:function(e,a){var t=p(a),i=p(e);t.videoId!==i.videoId?(this.mediaQuality=a.mediaQuality,this.unregisterPlayer(e),this.registerPlayer(a)):t.autoplay!==i.autoplay&&e.isPlayingAllowed&&(t.autoplay?this.playMedia():this.pauseMedia())},registerPlayer:function(a){var t=p(a);if("WixVideo"===e.get(t,"type")){var i={playerType:"mediaContainer",mediaData:t,services:{viewport:{callback:this.onViewportChange,eventTypes:["in","out"]},visibility:{callback:this.onVisibilityChange},fileAvailability:{callback:this.onFileAvailability,mediaQuality:a.mediaQuality}}};a.mediaAspect.registerPlayer(a.id,i)}},unregisterPlayer:function(e){e.mediaAspect.unregisterPlayer(e.id)},updatePlayerState:function(e,a){e.mediaAspect.updatePlayerState(e.id,a)},updateQualityState:function(e,a,t){e.mediaAspect.updateQualityState(a,t)},onMediaChange:function(e){var a=this.props.mediaAspect.getData(this.props.id)||{},t=this.mediaStateChangeLogic(e,a);e.type===l.eventTypes.LOAD&&t.playbackState===l.playbackTypes.READY&&this.handleAutoplay(this.props),this.updatePlayerState(this.props,t)},mediaStateChangeLogic:function(a,t){var i={},s=o(p(this.props),this.props.compProp),y=a.playbackState===l.playbackTypes.SEEKING_ENDED||a.playbackState===l.playbackTypes.SEEKING,d=a.playbackState===l.playbackTypes.PAUSED&&s.loop&&t.currentTime>=t.duration;switch(a.type){case l.eventTypes.MOUNT:i={playbackState:a.playbackState,volume:1,fullscreen:!1,muted:!0,currentTime:0,progress:0};break;case l.eventTypes.LOAD:i=e.omit(a,["type","originalEventType"]);break;case l.eventTypes.PLAYSTATE:switch(a.playbackState){case l.playbackTypes.PLAY_ENDED:s.loop?this.playMedia(0):(this.pauseMedia(),i={playbackState:l.playbackTypes.PLAY_ENDED});break;default:i=y||d?{playbackState:t.playbackState}:{playbackState:a.playbackState}}break;case l.eventTypes.ERROR:break;case l.eventTypes.TIME_UPDATE:i={currentTime:a.currentTime};break;case l.eventTypes.PROGRESS:i={progress:a.progress};break;case l.eventTypes.VOLUME:i={volume:a.volume,muted:a.muted};break;case l.eventTypes.RATE:}return i},onViewportChange:function(e){if(this.props.isPlayingAllowed&&!e.isFixed){var a=this.props.mediaAspect.getData(this.props.id);e.in?a.previousPlaybackState===l.playbackTypes.PLAYING?(this.updatePlayerState(this.props,{previousPlaybackState:""}),this.playMedia()):a.playbackState!==l.playbackTypes.IDLE&&a.playbackState!==l.playbackTypes.READY||this.handleAutoplay(this.props):e.out&&(a.playbackState===l.playbackTypes.PLAYING?(this.updatePlayerState(this.props,{previousPlaybackState:l.playbackTypes.PLAYING}),this.pauseMedia()):a.previousPlaybackState||this.updatePlayerState(this.props,{previousPlaybackState:a.playbackState}))}},onVisibilityChange:function(e){if(this.props.isPlayingAllowed){var a=this.props.mediaAspect.getData(this.props.id);e.hidden?e.hidden&&(a.playbackState===l.playbackTypes.PLAYING?(this.updatePlayerState(this.props,{previousPlaybackState:l.playbackTypes.PLAYING}),this.pauseMedia()):a.previousPlaybackState||this.updatePlayerState(this.props,{previousPlaybackState:a.playbackState})):a.previousPlaybackState===l.playbackTypes.PLAYING?(this.updatePlayerState(this.props,{previousPlaybackState:""}),this.playMedia()):a.playbackState!==l.playbackTypes.IDLE&&a.playbackState!==l.playbackTypes.READY||this.handleAutoplay(this.props)}},onFileAvailability:function(e){this.updateQualityState(this.props,e.videoId,{mediaQuality:e.mediaQuality,mediaReadyState:e.readyState}),this.updatePlayerState(this.props,{mediaQuality:e.mediaQuality,mediaReadyState:e.readyState}),e.mediaQuality&&"video"===e.type&&this.mediaCommandsLogic("setSrc",e.mediaQuality)},setMediaAPI:function(e){this.mediaAPI=e},mediaCommandsLogic:function(a){var t=e.tail(arguments),i=e.isEmpty(t)?void 0:t;this.mediaAPI&&this.mediaAPI(a,i)},playMedia:function(){this.mediaCommandsLogic("play")},pauseMedia:function(){this.mediaCommandsLogic("pause")},stopMedia:function(){this.mediaCommandsLogic("stop")},createFillLayers:function(a){var t=e.assign({},this.props,a),i={skin:"skins.viewer.balata.balataBaseSkin",styleId:t.styleId+l.balataConsts.BALATA},s=t.isMobileView?"mobile":"desktop",y={ref:l.balataConsts.BALATA,id:t.id+l.balataConsts.BALATA,key:(t.isPlayingAllowed?"playback":"no-playback")+s,parentId:t.id,style:t.bgStyle||l.defaultStyle,compBehaviors:t.compStaticBehaviors,compProp:o(p(this.props),this.props.compProp),compDesign:t.compDesign,onClick:t.onClick,mediaQuality:this.mediaQuality,notifyMediaState:this.onMediaChange,setMediaAPI:this.setMediaAPI,isPlayingAllowed:t.isPlayingAllowed,enableVideo:t.isDesktopDevice&&!t.isMobileView};return this.createChildComponent(t.compData,"wysiwyg.viewer.components.background.Balata",i,y)}}}),define("mediaCommon/mediaLogic/mediaPlayerLogicMixin",["lodash","react","santaProps","coreUtils","balata"],function(e,a,t,i,s){function p(a){return e.get(a.compDesign,["background","mediaRef"],e.get(a.compData,["background","mediaRef"]))||{}}var o=i.mediaConsts;return{propTypes:e.defaults({id:t.Types.Component.id.isRequired,styleId:t.Types.Component.styleId.isRequired,compData:t.Types.Component.compData,compProp:t.Types.Component.compProp,compDesign:t.Types.Component.compDesign,compStaticBehaviors:t.Types.Component.compStaticBehaviors,compDynamicBehaviors:t.Types.Component.compDynamicBehaviors,bgStyle:a.PropTypes.object,onClick:a.PropTypes.func,mediaAspect:t.Types.SiteAspects.mediaAspect.isRequired,mediaQuality:t.Types.Media.mediaQuality,isPlayingAllowed:t.Types.RenderFlags.isPlayingAllowed.isRequired},t.santaTypesUtils.getSantaTypesByDefinition(s)),getInitialState:function(){return this.registerPlayer(this.props),this.mediaAPI=null,this.mediaQuality=this.props.mediaQuality,{}},componentWillReceiveProps:function(e){this.handleVideoDataChange(this.props,e)},handleVideoDataChange:function(e,a){var t=p(a),i=p(e);t.videoId!==i.videoId&&(this.mediaQuality=a.mediaQuality,this.unregisterPlayer(e),this.registerPlayer(a))},registerPlayer:function(a){var t=p(a);if("WixVideo"===e.get(t,"type")){var i={playerType:"mediaPlayer",mediaData:t,services:{fileAvailability:{callback:this.onFileAvailability,mediaQuality:a.mediaQuality}}};a.mediaAspect.registerPlayer(a.id,i)}},unregisterPlayer:function(e){e.mediaAspect.unregisterPlayer(e.id)},updatePlayerState:function(e,a){e.mediaAspect.updatePlayerState(e.id,a)},updateQualityState:function(e,a,t){e.mediaAspect.updateQualityState(a,t)},onMediaChange:function(e){var a=this.props.mediaAspect.getData(this.props.id),t=this.mediaStateChangeLogic(e,a);this.updatePlayerState(this.props,t)},mediaStateChangeLogic:function(a,t){var i={},s=t.playbackState===o.playbackTypes.PLAYING,p=t.playbackState===o.playbackTypes.SEEK_PLAYING||t.playbackState===o.playbackTypes.SEEK_PAUSED,l=t.currentTime>=t.duration,y=t.playbackState===o.playbackTypes.SEEK_PLAYING&&!l||t.playbackState===o.playbackTypes.SEEK_PLAYING&&l&&this.props.compProp.loop;switch(a.type){case o.eventTypes.MOUNT:i={playbackState:a.playbackState,volume:1,fullscreen:!1,muted:!1,currentTime:0,progress:0};break;case o.eventTypes.LOAD:i=e.omit(a,["type","originalEventType"]);break;case o.eventTypes.PLAYSTATE:switch(a.playbackState){case o.playbackTypes.SEEKING:p||(i={playbackState:s||t.playbackState===o.playbackTypes.PLAY_ENDED?o.playbackTypes.SEEK_PLAYING:o.playbackTypes.SEEK_PAUSED});break;case o.playbackTypes.SEEKING_ENDED:i=!y&&l?{playbackState:o.playbackTypes.PLAY_ENDED}:{playbackState:y?o.playbackTypes.PLAYING:o.playbackTypes.PAUSED},y?this.playMedia():this.pauseMedia();break;case o.playbackTypes.PLAY_ENDED:this.props.compProp.loop&&t.playbackState===o.playbackTypes.PLAYING?this.playMedia(0):l&&(i={playbackState:o.playbackTypes.PLAY_ENDED});break;case o.playbackTypes.PAUSED:s&&l?i={playbackState:o.playbackTypes.PLAYING}:p||(i={playbackState:a.playbackState});break;default:p||(i={playbackState:a.playbackState})}break;case o.eventTypes.ERROR:break;case o.eventTypes.TIME_UPDATE:i={currentTime:a.currentTime};break;case o.eventTypes.PROGRESS:i={progress:a.progress};break;case o.eventTypes.VOLUME:i={volume:a.volume,muted:a.muted};break;case o.eventTypes.RATE:}return i},onFileAvailability:function(e){switch(e.type){case"video":if(this.updateQualityState(this.props,e.videoId,{mediaQuality:e.mediaQuality,mediaReadyState:e.readyState}),this.updatePlayerState(this.props,{mediaQuality:e.mediaQuality,mediaReadyState:e.readyState}),e.mediaQuality){var a=this.props.mediaAspect.getData(this.props.id);a.playbackState!==o.playbackTypes.READY&&a.playbackState!==o.playbackTypes.IDLE||this.mediaCommandsLogic("setSrc",e.mediaQuality)}break;case"storyboard":this.updateQualityState(this.props,e.videoId,{storyboardQuality:e.mediaQuality,storyboardReadyState:e.readyState}),this.updatePlayerState(this.props,{storyboardQuality:e.mediaQuality,storyboardReadyState:e.readyState})}},setMediaAPI:function(e){this.mediaAPI=e},mediaCommandsLogic:function(a){if(this.mediaAPI){var t=this.props.mediaAspect.getData(this.props.id),i=e.tail(arguments),s=t.playbackState===o.playbackTypes.PLAYING,p=e.includes([o.playbackTypes.SEEK_PLAYING,o.playbackTypes.SEEK_PAUSED,o.playbackTypes.SEEKING],t.playbackState);switch(a){case"togglePlay":s?this.pauseMedia():this.playMedia();break;case"play":var l=e.head(i)||-1;t.playbackState===o.playbackTypes.PLAY_ENDED&&l<0&&(l=0),l>=0&&this.seekMedia(l),this.mediaAPI("play");break;case"pause":var y=e.head(i)||-1;this.mediaAPI("pause"),y>=0&&this.seekMedia(y);break;case"seekStart":if(p)break;this.updatePlayerState(this.props,{playbackState:s?o.playbackTypes.SEEK_PLAYING:o.playbackTypes.SEEK_PAUSED}),s&&this.pauseMedia();break;case"seekEnd":var d=e.head(i);this.seekMedia(d);break;default:this.mediaAPI(a,i)}}},togglePlayMedia:function(){this.mediaCommandsLogic("togglePlay")},playMedia:function(e){this.mediaCommandsLogic("play",e)},pauseMedia:function(e){this.mediaCommandsLogic("pause",e)},stopMedia:function(){this.mediaCommandsLogic("stop")},setMediaVolume:function(e){this.mediaCommandsLogic("setVolume",e)},muteMedia:function(){this.mediaCommandsLogic("mute")},unMuteMedia:function(){this.mediaCommandsLogic("unMute")},seekMedia:function(e){this.mediaCommandsLogic("seek",e)},startSeekMedia:function(e){this.mediaCommandsLogic("seekStart",e)},endSeekMedia:function(e){this.mediaCommandsLogic("seekEnd",e)},createFillLayers:function(a){var t=e.assign({},this.props,a),i={skin:"skins.viewer.balata.balataBaseSkin",styleId:t.styleId+o.balataConsts.BALATA},s={ref:o.balataConsts.BALATA,id:t.id+o.balataConsts.BALATA,parentId:t.id,style:t.bgStyle||o.defaultStyle,compBehaviors:t.compStaticBehaviors,compProp:t.compProp,compDesign:t.compDesign,onClick:t.onClick,mediaQuality:this.mediaQuality,notifyMediaState:this.onMediaChange,setMediaAPI:this.setMediaAPI,enableVideo:!0,isPlayingAllowed:this.props.isPlayingAllowed,playerInteraction:t.playerInteraction||t.compProps.playerInteraction};return this.createChildComponent(t.compData,"wysiwyg.viewer.components.background.Balata",i,s)}}}),define("mediaCommon",["lodash","coreUtils","balata","mediaCommon/mediaLogic/fillLogicMixin","mediaCommon/mediaLogic/mediaPlayerLogicMixin"],function(e,a,t,i,s){var p=a.mediaConsts;return{balata:t,defaultMediaStyle:p.defaultMediaStyle,popupMediaStyle:p.popupMediaStyle,mediaLogicMixins:{fill:i,mediaPlayer:s},mediaBehaviors:{fill:{play:{methodName:"playMedia",params:[{name:"time",defaultValue:-1}]},pause:{methodName:"pauseMedia",params:[{name:"time",defaultValue:-1}]},stop:{methodName:"stopMedia"}},mediaPlayer:{togglePlay:{methodName:"togglePlayMedia"},play:{methodName:"playMedia",params:[{name:"time",defaultValue:-1}]},pause:{methodName:"pauseMedia",params:[{name:"time",defaultValue:-1}]},stop:{methodName:"stopMedia"},setVolume:{methodName:"setMediaVolume",params:["volume"]},mute:{methodName:"muteMedia"},unMute:{methodName:"unMuteMedia"},seek:{methodName:"seekMedia",params:["time"]},seekStart:{methodName:"startSeekMedia"},seekEnd:{methodName:"endSeekMedia",params:["time"]},enterFullScreen:{methodName:"enterFullscreen"},exitFullScreen:{methodName:"exitFullscreen"}}}}});
//# sourceMappingURL=mediaCommon.min.js.map