!function(e){"use strict";ElementsKit_Helper.registerWidget("elementskit-video.default",(function(t){var i=(p=t.find(".video-content")).find(".ekit-video-popup"),o=p.data("video-player"),n=t.closest("body"),a=p.data("video-setting"),l=t.data("id"),d=a?.bg_color,s=t.closest("[data-elementor-id]").data("elementor-id");if(i.length>0){const c=p.find(".ekit-hidden-icons .ekit-popup-close-icon")[0]?.outerHTML,r=document.createElement("style"),v=`${a?.videoClass}-${l}`;r.textContent=`.${v} { background-color: ${d}; }`,document.head.appendChild(r);const u={type:a.videoType,mainClass:v,removalDelay:160,preloader:!0,fixedContentPos:!1,closeMarkup:`\n\t\t\t\t\t\t\t<div class="mfp-close-btn-wrapeer ekit-wid-con elementor-${s}">\n\t\t\t\t\t\t\t<button title="%title%" type="button" class="mfp-close elementor-element elementor-element-${l}">\n\t\t\t\t\t\t\t${c||"x"}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t`,callbacks:{elementParse:function(i){var o=t.find(".video-content").data("video-setting");if(o&&"self"===o.videoTypeName&&"popup"===o.videoStyle){let t=e(".ekit_self_video_wrap video.video_class");t.length&&(o.autoplay&&(t.prop("autoplay",!0).attr("autoplay"),t[0].play()),o.muted&&t.prop("muted",!0).attr("muted"),o.loop&&t.prop("loop",!0).attr("loop"))}},open:function(){n.find(".mfp-close").addClass("ekit-video-popup-close"),window.dispatchEvent(new Event("resize"))},close:function(){n.find(".mfp-close").removeClass("ekit-video-popup-close"),t.find("video").each((function(){this.pause()}))}}};"iframe"===a.videoType&&(u.iframe={markup:`<div class="mfp-iframe-scaler">\n\t\t\t\t\t\t\t<div class="mfp-close ekit-video-popup-close">${c||'<i class="icon icon-cancel"></i>'}</div>\n\t\t\t\t\t\t\t<iframe class="mfp-iframe"  frameborder="0" allowfullscreen></iframe>\n\t\t\t\t\t\t\t</div>`,patterns:{youtube:{index:"https://youtube.com/",id:"v=",src:"%id%"}}},u.closeMarkup=`\n\t\t\t\t\t\t<div class="mfp-close ekit-video-popup-close">\n\t\t\t\t\t\t\t${c||"x"}\n\t\t\t\t\t\t</div>`),p.find("video").mediaelementplayer({features:o,videoVolume:a.videoVolume,startVolume:a.startVolume,stretching:"responsive",enableAutosize:!0,videoWidth:"900px",videoHeight:"507px"}),e(document).on("click",".mfp-close",(function(){e.magnificPopup.close()})),i.magnificPopup(u)}a=(p=t.find(".ekit-video-frame")).data("video-setting"),o=p.data("video-player");var p,c=t.find(".ekit-inline-video-content"),r=c.find(".ekit-video-inline-btn"),v=c.find(".ekit-inline-video-overlay-image");"inline"===a?.videoType&&"self"===a?.videoTypeName&&p.find("video.inline_video_class").mediaelementplayer({features:o,videoVolume:a?.videoVolume,startVolume:a?.startVolume,autoplay:!!a?.autoplay,muted:!!a?.muted,loop:!!a?.loop,stretching:"responsive",enableAutosize:!0,videoWidth:"100%",videoHeight:"100%"}),v.length>0&&r.length>0&&r.on("click",(function(i){if(i.preventDefault(),"self"===a.videoTypeName&&"inline"===a.videoStyle){let t=e(".ekit-video-frame video.inline_video_class");t.length&&(t.prop("autoplay",!0).attr("autoplay"),t[0].play())}else if(("youtube"===a.videoTypeName||"vimeo"===a.videoTypeName)&&"inline"===a.videoStyle){let e=t.find(".ekit-inline-video-content iframe");if(e.length){let t=e.attr("src")||"";/[?&]autoplay=1/.test(t)||(/[?&]autoplay=\d/.test(t)?t=t.replace(/autoplay=\d/,"autoplay=1"):t+=(t.indexOf("?")>-1?"&":"?")+"autoplay=1",e.attr("src",t))}}var o=e(this).closest(".ekit-inline-video-content");o.find(".ekit-inline-video-overlay-image, .ekit-video-inline-btn").hide(),o.find("iframe, video").show()}));var u=t.find(".ekit-video-frame").find(".ekit-inline-video-content");if(u.length>0){var m=u.css("--video-aspect-ratio");m&&u.css("aspect-ratio",m)}}))}(jQuery);