!function($){"use strict";var e={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"https://www.youtube-nocookie.com/embed/$4",thumb:"https://img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(e){return"//maps.google."+e[2]+"/?ll="+(e[9]?e[9]+"&z="+Math.floor(e[10])+(e[12]?e[12].replace(/^\//,"&"):""):e[12]+"").replace(/\?/,"&")+"&output="+(e[12]&&e[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(e){return"//maps.google."+e[2]+"/maps?q="+e[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}},t=function(e,t,a){if(e)return a=a||"","object"===$.type(a)&&(a=$.param(a,!0)),$.each(t,(function(t,a){e=e.replace("$"+t,a||"")})),a.length&&(e+=(e.indexOf("?")>0?"&":"?")+a),e};$(document).on("objectNeedsType.fb",(function(a,o,n){var r,i,c,u,m,p,l,s=n.src||"",d=!1;r=$.extend(!0,{},e,n.opts.media),$.each(r,(function(e,a){if(c=s.match(a.matcher)){if(d=a.type,l=e,p={},a.paramPlace&&c[a.paramPlace]){"?"==(m=c[a.paramPlace])[0]&&(m=m.substring(1)),m=m.split("&");for(var o=0;o<m.length;++o){var r=m[o].split("=",2);2==r.length&&(p[r[0]]=decodeURIComponent(r[1].replace(/\+/g," ")))}}return u=$.extend(!0,{},a.params,n.opts[e],p),s="function"===$.type(a.url)?a.url.call(this,c,u,n):t(a.url,c,u),i="function"===$.type(a.thumb)?a.thumb.call(this,c,u,n):t(a.thumb,c),"youtube"===e?s=s.replace(/&t=((\d+)m)?(\d+)s/,(function(e,t,a,o){return"&start="+((a?60*parseInt(a,10):0)+parseInt(o,10))})):"vimeo"===e&&(s=s.replace("&%23","#")),!1}})),d?(n.opts.thumb||n.opts.$thumb&&n.opts.$thumb.length||(n.opts.thumb=i),"iframe"===d&&(n.opts=$.extend(!0,n.opts,{iframe:{preload:!1,attr:{scrolling:"no"}}})),$.extend(n,{type:d,src:s,origSrc:n.src,contentSource:l,contentType:"image"===d?"image":"gmap_place"==l||"gmap_search"==l?"map":"video"})):s&&(n.type=n.opts.defaultType)}));var a={youtube:{src:"https://www.youtube.com/iframe_api",class:"YT",loading:!1,loaded:!1},vimeo:{src:"https://player.vimeo.com/api/player.js",class:"Vimeo",loading:!1,loaded:!1},load:function(e){var t,a=this;this[e].loaded?setTimeout((function(){a.done(e)})):this[e].loading||(this[e].loading=!0,(t=document.createElement("script")).type="text/javascript",t.src=this[e].src,"youtube"===e?window.onYouTubeIframeAPIReady=function(){a[e].loaded=!0,a.done(e)}:t.onload=function(){a[e].loaded=!0,a.done(e)},document.body.appendChild(t))},done:function(e){var t,a;"youtube"===e&&delete window.onYouTubeIframeAPIReady,(t=$.fancybox.getInstance())&&(a=t.current.$content.find("iframe"),"youtube"===e&&void 0!==YT&&YT?new YT.Player(a.attr("id"),{events:{onStateChange:function(e){0==e.data&&t.next()}}}):"vimeo"===e&&void 0!==Vimeo&&Vimeo&&new Vimeo.Player(a).on("ended",(function(){t.next()})))}};$(document).on({"afterShow.fb":function(e,t,o){t.group.length>1&&("youtube"===o.contentSource||"vimeo"===o.contentSource)&&a.load(o.contentSource)}})}(jQuery);