!function(){"use strict";function a(){return window.videojs&&window.videojs.VERSION?window.videojs.VERSION:"0.0.0"}var b=angular.module("vjs.video",[]);b.controller("VjsVideoController",["$scope",function(b){function c(a,b){var c,d=null;if(!window.videojs)throw new Error("video.js was not found!");if(b){if(c=a[0].getElementsByTagName("video"),0===c.length)throw new Error("video tag must be defined within container directive!");if(c.length>1)throw new Error("only one video can be defined within the container directive!");d=c[0]}else{if("VIDEO"!==a[0].nodeName)throw new Error("directive must be attached to a video tag!");d=a[0]}return d}function d(a,b){var c,d,e,f=b,g=document.createElement("style"),h=function(a){var b=a.split(":"),c='the ratio must either be "wide", "standard" or decimal values in the format of w:h';if(2!==b.length)throw new Error(c);if(isNaN(b[0])||isNaN(b[1]))throw new Error(c);if(0===Number(b[0])||0===Number(b[1]))throw new Error("neither the width or height ratio can be zero!");return Number(b[1])/Number(b[0])*100},i=function(a){var b,c=a[0].querySelector(".vjs-tech");if(!c)throw new Error("Failed to find instance of video-js class!");return b="vjs-container-"+c.getAttribute("id"),a[0].setAttribute("id",b),b};switch(f||(f="16:9"),f){case"wide":f="16:9";break;case"standard":f="4:3"}c=i(a),d=h(f),e=["#",c," ",".video-js {padding-top:",d,"%;}\n",".vjs-fullscreen {padding-top: 0px;}"].join(""),g.type="text/css",g.rel="stylesheet",g.styleSheet?g.styleSheet.cssText=e:g.appendChild(document.createTextNode(e)),a[0].appendChild(g)}function e(a,b){var c,d,e="a sources and/or tracks element must be defined for the vjs-media attribute",f="sources must be an array of objects with at least one item",g="tracks must be an array of objects with at least one item";if(a.vjsMedia){if(!a.vjsMedia.sources&&!a.vjsMedia.tracks)throw new Error(e);if(a.vjsMedia.sources&&!(a.vjsMedia.sources instanceof Array))throw new Error(f);if(a.vjsMedia.tracks&&!(a.vjsMedia.tracks instanceof Array))throw new Error(g);c=document.createElement("div"),a.vjsMedia.sources&&a.vjsMedia.sources.forEach(function(a){d=document.createElement("source"),d.setAttribute("src",a.src||""),d.setAttribute("type",a.type||""),c.appendChild(d)}),a.vjsMedia.tracks&&a.vjsMedia.tracks.forEach(function(a){d=document.createElement("track"),d.setAttribute("kind",a.kind||""),d.setAttribute("label",a.label||""),d.setAttribute("src",a.src||""),d.setAttribute("srclang",a.srclang||""),a["default"]===!0&&d.setAttribute("default",""),c.appendChild(d)}),b.call(void 0,{element:c})}}function f(c,f,g,h){var i,j=f.vjsSetup||{},k=f.vjsRatio,l="VIDEO"===g[0].nodeName||a().match(/^5\./)?!1:!0;return window.videojs?(f.vjsMedia&&f.vjsMedia.poster&&(j.poster=f.vjsMedia.poster),e(f,h),i=b.$watch(function(){return f.vjsMedia},function(a,d){a&&!angular.equals(a,d)&&(i(),l?(window.videojs(c).dispose(),b.$emit("vjsVideoMediaChanged")):b.$emit("vjsVideoMediaChanged"))}),window.videojs(c,j,function(){l&&d(g,k),b.$emit("vjsVideoReady",{id:c.getAttribute("id"),vid:this})}),void b.$on("$destroy",function(){window.videojs(c).dispose()})):null}var g=this;g.initVideoJs=f,g.getVidElement=c}]),b.directive("vjsVideo",["$compile","$timeout",function(a,b){return{restrict:"A",transclude:!0,scope:{vjsSetup:"=",vjsMedia:"="},controller:"VjsVideoController",controllerAs:"vjsCtrl",bindToController:!0,link:function(c,d,e,f,g){var h,i,j,k,l=function(a){d.children().remove(),d.append(a.element.childNodes)},m=function(){h=f.getVidElement(d),g(function(a){d.append(a),f.initVideoJs(h,f,d,l)})};j=d.clone(),d.parent().hasClass("vjs-video-wrap")||d.wrap('
'),i=d.parent(),c.$on("vjsVideoMediaChanged",function(){var d=i.children()[0];b(function(){c.$destroy()}),k=j.clone(),i.append(k),k=a(k)(c.$parent),d.remove()}),m()}}}]),b.directive("vjsVideoContainer",[function(){return{restrict:"AE",transclude:!0,template:'