{"version":3,"file":"lg-video.umd.js","sources":["../../../src/plugins/video/lg-video-settings.ts","../../../src/lg-events.ts","../../../src/plugins/video/lg-video-utils.ts","../../../src/plugins/video/lg-video.ts"],"sourcesContent":["import { PlayerParams } from './lg-video-utils';\n\nexport interface VideoSettings {\n    /**\n     * Enable/DIsable first video autoplay.\n     * @description Autoplay has to be managed using this setting.\n     * Autoplay in PlayerParams doesn't have any effect.\n     */\n    autoplayFirstVideo: boolean;\n\n    /**\n     * Change YouTube player parameters.\n     * You can find the list of YouTube player parameters from the following link\n     * <a href=\"https://developers.google.com/youtube/player_parameters\">YouTube player parameters</a>\n     * @example\n     * lightGallery(document.getElementById('lightGallery'), {\n     *     youTubePlayerParams: {\n     *         modestbranding : 1,\n     *         showinfo : 0,\n     *         controls : 0\n     *     }\n     * })\n     */\n    youTubePlayerParams: any;\n\n    /**\n     * Change Vimeo player parameters.\n     * You can find the list of vimeo player parameters from the following link\n     * <a href=\"https://developer.vimeo.com/player/embedding#universal-parameters\">Vimeo player parameters</a>\n     * @example\n     * lightGallery(document.getElementById('lightGallery'), {\n     *     vimeoPlayerParams: {\n     *         byline : 0,\n     *         portrait : 0,\n     *         color : 'CCCCCC'\n     *     }\n     * })\n     */\n    vimeoPlayerParams: PlayerParams;\n\n    /**\n     * Change Wistia player parameters.\n     * You can find the list of Wistia player parameters from the following link\n     * <a href=\"https://wistia.com/support/developers/embed-options#using-embed-options\">Vimeo player parameters</a>\n     */\n    wistiaPlayerParams: any;\n\n    /**\n     * Go to next slide when video is ended\n     * Note - this doesn't work with YouTube videos at the moment\n     */\n    gotoNextSlideOnVideoEnd: boolean;\n\n    /**\n     * Autoplay video on slide change\n     * @description Make sure you set preload:\"none\"\n     */\n    autoplayVideoOnSlide: boolean;\n\n    /**\n     * Enbale videojs custom video player\n     * <div class=\"alert alert-info\" role=\"alert\">\n     *     <b>Dependency</b> - You need to include <a href=\"https://videojs.com/\">videoJs</a> on your document to enable videojs player\n     * </div>\n     */\n    videojs: boolean;\n\n    /**\n     * Class name of the videojs theme\n     * You need to include the theme stylesheet on your document. <a href=\"https://videojs.com/getting-started/#home-page-themes\" target=\"_blank\">More info</a>\n     * @version V2.5.0\n     */\n    videojsTheme: string;\n\n    /**\n     * Videojs player options\n     */\n    videojsOptions: any;\n}\nexport const videoSettings: VideoSettings = {\n    autoplayFirstVideo: true,\n    youTubePlayerParams: false,\n    vimeoPlayerParams: false,\n    wistiaPlayerParams: false,\n    gotoNextSlideOnVideoEnd: true,\n    autoplayVideoOnSlide: false,\n    videojs: false,\n    videojsTheme: '',\n    videojsOptions: {},\n};\n","import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n    [key: string]: string;\n} = {\n    afterAppendSlide: 'lgAfterAppendSlide',\n    init: 'lgInit',\n    hasVideo: 'lgHasVideo',\n    containerResize: 'lgContainerResize',\n    updateSlides: 'lgUpdateSlides',\n    afterAppendSubHtml: 'lgAfterAppendSubHtml',\n    beforeOpen: 'lgBeforeOpen',\n    afterOpen: 'lgAfterOpen',\n    slideItemLoad: 'lgSlideItemLoad',\n    beforeSlide: 'lgBeforeSlide',\n    afterSlide: 'lgAfterSlide',\n    posterClick: 'lgPosterClick',\n    dragStart: 'lgDragStart',\n    dragMove: 'lgDragMove',\n    dragEnd: 'lgDragEnd',\n    beforeNextSlide: 'lgBeforeNextSlide',\n    beforePrevSlide: 'lgBeforePrevSlide',\n    beforeClose: 'lgBeforeClose',\n    afterClose: 'lgAfterClose',\n    rotateLeft: 'lgRotateLeft',\n    rotateRight: 'lgRotateRight',\n    flipHorizontal: 'lgFlipHorizontal',\n    flipVertical: 'lgFlipVertical',\n    autoplay: 'lgAutoplay',\n    autoplayStart: 'lgAutoplayStart',\n    autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n *   const lg = document.getElementById('custom-events-demo');\n *   // Perform any action on lightGallery initialization.\n *   // Init event returns the plugin instance that can be used to call any lightGalley public method\n *   let pluginInstance = null;\n *   lg.addEventListener('lgInit', (event) => {\n *      pluginInstance = event.detail.instance;\n *   });\n *   lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n    /**\n     * lightGallery plugin instance\n     */\n    instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n     * This delay is required for the transition effect when the slide item is displayed\n     * Respect the delay when you use this event\n     */\n    delay: number;\n\n    // Will be true for the first slide\n    isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n *   const lg = document.getElementById('custom-events-demo');\n *   // Perform any action before each slide transition\n *   lg.addEventListener('lgBeforeSlide', (event) => {\n *       const { index, prevIndex } = event.detail;\n *       alert(index, prevIndex);\n *   });\n *   lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n    /**\n     * Index of the previous slide\n     */\n    prevIndex: number;\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n    /**\n     * true if slide function called via thumbnail click\n     */\n    fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n    /**\n     * Index of the previous slide\n     */\n    prevIndex: number;\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n    /**\n     * true if slide function called via thumbnail click\n     */\n    fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n    /**\n     * lightGallery plugin instance\n     */\n    instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n    /**\n     * Index of the slide,\n     */\n    index: number;\n    /**\n     * Video source\n     */\n    src: string;\n    /**\n     * HTML5 video source if available\n     * <p>\n       HTML5 video source = source: {\n            src: string;\n            type: string;\n        }[];\n        attributes: HTMLVideoElement;\n     * </p>\n     */\n    html5Video: VideoSource;\n    /**\n     * True if video has poster\n     */\n    hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n","import { VideoInfo } from '../../types';\nexport type PlayerParams = Record<string, string | number | boolean> | boolean;\n\nexport type YouTubeParams = {\n    [x: string]: string | number | boolean;\n};\n\nexport const param = (obj: YouTubeParams): string => {\n    return Object.keys(obj)\n        .map(function (k) {\n            return encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]);\n        })\n        .join('&');\n};\nexport const paramsToObject = (url: string): YouTubeParams => {\n    const paramas = url\n        .slice(1)\n        .split('&')\n        .map((p) => p.split('='))\n        .reduce((obj: any, pair) => {\n            const [key, value] = pair.map(decodeURIComponent);\n            obj[key] = value;\n            return obj;\n        }, {});\n    return paramas;\n};\n\nexport const getYouTubeParams = (\n    videoInfo: VideoInfo,\n    youTubePlayerParamsSettings: YouTubeParams | false,\n): string => {\n    if (!videoInfo.youtube) return '';\n    const slideUrlParams = videoInfo.youtube[2]\n        ? paramsToObject(videoInfo.youtube[2])\n        : '';\n\n    // For youtube first params gets priority if duplicates found\n    const defaultYouTubePlayerParams = {\n        wmode: 'opaque',\n        autoplay: 0,\n        mute: 1,\n        enablejsapi: 1,\n    };\n\n    const playerParamsSettings = youTubePlayerParamsSettings || {};\n\n    const youTubePlayerParams = {\n        ...defaultYouTubePlayerParams,\n        ...playerParamsSettings,\n        ...slideUrlParams,\n    };\n\n    const youTubeParams = `?${param(youTubePlayerParams)}`;\n    return youTubeParams;\n};\n\nexport const isYouTubeNoCookie = (url: string): boolean => {\n    return url.includes('youtube-nocookie.com');\n};\n\nexport const getVimeoURLParams = (\n    defaultParams: PlayerParams,\n    videoInfo?: VideoInfo,\n): string => {\n    if (!videoInfo || !videoInfo.vimeo) return '';\n    let urlParams = videoInfo.vimeo[2] || '';\n\n    const defaultPlayerParams =\n        defaultParams && Object.keys(defaultParams).length !== 0\n            ? '&' + param(defaultParams as any)\n            : '';\n\n    // Support private video\n    const urlWithHash = videoInfo.vimeo[0].split('/').pop() || '';\n    const urlWithHashWithParams = urlWithHash.split('?')[0] || '';\n    const hash = urlWithHashWithParams.split('#')[0];\n\n    const isPrivate = videoInfo.vimeo[1] !== hash;\n    if (isPrivate) {\n        urlParams = urlParams.replace(`/${hash}`, '');\n    }\n\n    urlParams =\n        urlParams[0] == '?' ? '&' + urlParams.slice(1) : urlParams || '';\n\n    // For vimeo last params gets priority if duplicates found\n    const vimeoPlayerParams = `?autoplay=0&muted=1${\n        isPrivate ? `&h=${hash}` : ''\n    }${defaultPlayerParams}${urlParams}`;\n    return vimeoPlayerParams;\n};\n","/**\n * Video module for lightGallery\n * Supports HTML5, YouTube, Vimeo, wistia videos\n *\n *\n * @ref Wistia\n * https://wistia.com/support/integrations/wordpress(How to get url)\n * https://wistia.com/support/developers/embed-options#using-embed-options\n * https://wistia.com/support/developers/player-api\n * https://wistia.com/support/developers/construct-an-embed-code\n * http://jsfiddle.net/xvnm7xLm/\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video\n * https://wistia.com/support/embed-and-share/sharing-videos\n * https://private-sharing.wistia.com/medias/mwhrulrucj\n *\n * @ref Youtube\n * https://developers.google.com/youtube/player_parameters#enablejsapi\n * https://developers.google.com/youtube/iframe_api_reference\n * https://developer.chrome.com/blog/autoplay/#iframe-delegation\n *\n * @ref Vimeo\n * https://stackoverflow.com/questions/10488943/easy-way-to-get-vimeo-id-from-a-vimeo-url\n * https://vimeo.zendesk.com/hc/en-us/articles/360000121668-Starting-playback-at-a-specific-timecode\n * https://vimeo.zendesk.com/hc/en-us/articles/360001494447-Using-Player-Parameters\n */\n\nimport { VideoSettings, videoSettings } from './lg-video-settings';\nimport { LightGallery } from '../../lightgallery';\nimport { lgQuery } from '../../lgQuery';\nimport {\n    CustomEventAfterSlide,\n    CustomEventHasVideo,\n    CustomEventSlideItemLoad,\n    VideoInfo,\n} from '../../types';\nimport { lGEvents } from '../../lg-events';\nimport { VideoSource } from './types';\nimport {\n    getVimeoURLParams,\n    getYouTubeParams,\n    isYouTubeNoCookie,\n    param,\n} from './lg-video-utils';\n\ndeclare let Vimeo: any;\ndeclare let videojs: any;\ndeclare global {\n    interface Window {\n        _wq: any;\n        Vimeo: any;\n    }\n}\nexport default class Video {\n    private core: LightGallery;\n    private settings: VideoSettings;\n    constructor(instance: LightGallery) {\n        // get lightGallery core plugin instance\n        this.core = instance;\n        this.settings = { ...videoSettings, ...this.core.settings };\n\n        return this;\n    }\n    init() {\n        /**\n         * Event triggered when video url found without poster\n         * Append video HTML\n         * Play if autoplayFirstVideo is true\n         */\n        this.core.LGel.on(\n            `${lGEvents.hasVideo}.video`,\n            this.onHasVideo.bind(this),\n        );\n\n        this.core.LGel.on(`${lGEvents.posterClick}.video`, () => {\n            const $el = this.core.getSlideItem(this.core.index);\n            this.loadVideoOnPosterClick($el);\n        });\n        this.core.LGel.on(\n            `${lGEvents.slideItemLoad}.video`,\n            this.onSlideItemLoad.bind(this),\n        );\n\n        // @desc fired immediately before each slide transition.\n        this.core.LGel.on(\n            `${lGEvents.beforeSlide}.video`,\n            this.onBeforeSlide.bind(this),\n        );\n\n        // @desc fired immediately after each slide transition.\n        this.core.LGel.on(\n            `${lGEvents.afterSlide}.video`,\n            this.onAfterSlide.bind(this),\n        );\n    }\n\n    /**\n     * @desc Event triggered when a slide is completely loaded\n     *\n     * @param {Event} event - lightGalley custom event\n     */\n    onSlideItemLoad(event: CustomEventSlideItemLoad): void {\n        const { isFirstSlide, index } = event.detail;\n\n        // Should check the active slide as well as user may have moved to different slide before the first slide is loaded\n        if (\n            this.settings.autoplayFirstVideo &&\n            isFirstSlide &&\n            index === this.core.index\n        ) {\n            // Delay is just for the transition effect on video load\n            setTimeout(() => {\n                this.loadAndPlayVideo(index);\n            }, 200);\n        }\n\n        // Should not call on first slide. should check only if the slide is active\n        if (\n            !isFirstSlide &&\n            this.settings.autoplayVideoOnSlide &&\n            index === this.core.index\n        ) {\n            this.loadAndPlayVideo(index);\n        }\n    }\n\n    /**\n     * @desc Event triggered when video url or poster found\n     * Append video HTML is poster is not given\n     * Play if autoplayFirstVideo is true\n     *\n     * @param {Event} event - Javascript Event object.\n     */\n    onHasVideo(event: CustomEventHasVideo): void {\n        const { index, src, html5Video, hasPoster } = event.detail;\n        if (!hasPoster) {\n            // All functions are called separately if poster exist in loadVideoOnPosterClick function\n\n            this.appendVideos(this.core.getSlideItem(index), {\n                src,\n                addClass: 'lg-object',\n                index,\n                html5Video,\n            });\n\n            // Automatically navigate to next slide once video reaches the end.\n            this.gotoNextSlideOnVideoEnd(src, index);\n        }\n    }\n\n    /**\n     * @desc fired immediately before each slide transition.\n     * Pause the previous video\n     * Hide the download button if the slide contains YouTube, Vimeo, or Wistia videos.\n     *\n     * @param {Event} event - Javascript Event object.\n     * @param {number} prevIndex - Previous index of the slide.\n     * @param {number} index - Current index of the slide\n     */\n    onBeforeSlide(event: CustomEvent): void {\n        if (this.core.lGalleryOn) {\n            const { prevIndex } = event.detail;\n            this.pauseVideo(prevIndex);\n        }\n    }\n\n    /**\n     * @desc fired immediately after each slide transition.\n     * Play video if autoplayVideoOnSlide option is enabled.\n     *\n     * @param {Event} event - Javascript Event object.\n     * @param {number} prevIndex - Previous index of the slide.\n     * @param {number} index - Current index of the slide\n     * @todo should check on onSlideLoad as well if video is not loaded on after slide\n     */\n    onAfterSlide(event: CustomEventAfterSlide): void {\n        const { index, prevIndex } = event.detail;\n        // Do not call on first slide\n        const $slide = this.core.getSlideItem(index);\n        if (this.settings.autoplayVideoOnSlide && index !== prevIndex) {\n            if ($slide.hasClass('lg-complete')) {\n                setTimeout(() => {\n                    this.loadAndPlayVideo(index);\n                }, 100);\n            }\n        }\n    }\n\n    loadAndPlayVideo(index: number): void {\n        const $slide = this.core.getSlideItem(index);\n        const currentGalleryItem = this.core.galleryItems[index];\n        if (currentGalleryItem.poster) {\n            this.loadVideoOnPosterClick($slide, true);\n        } else {\n            this.playVideo(index);\n        }\n    }\n\n    /**\n     * Play HTML5, Youtube, Vimeo or Wistia videos in a particular slide.\n     * @param {number} index - Index of the slide\n     */\n    playVideo(index: number) {\n        this.controlVideo(index, 'play');\n    }\n\n    /**\n     * Pause HTML5, Youtube, Vimeo or Wistia videos in a particular slide.\n     * @param {number} index - Index of the slide\n     */\n    pauseVideo(index: number) {\n        this.controlVideo(index, 'pause');\n    }\n\n    getVideoHtml(\n        src: any,\n        addClass: any,\n        index: number,\n        html5Video: VideoSource,\n    ): string {\n        let video = '';\n        const videoInfo =\n            this.core.galleryItems[(index as unknown) as number]\n                .__slideVideoInfo || {};\n        const currentGalleryItem = this.core.galleryItems[index];\n        let videoTitle = currentGalleryItem.title || currentGalleryItem.alt;\n        videoTitle = videoTitle ? 'title=\"' + videoTitle + '\"' : '';\n        const commonIframeProps = `allowtransparency=\"true\"\n            frameborder=\"0\"\n            scrolling=\"no\"\n            allowfullscreen\n            mozallowfullscreen\n            webkitallowfullscreen\n            oallowfullscreen\n            msallowfullscreen`;\n\n        if (videoInfo.youtube) {\n            const videoId = 'lg-youtube' + index;\n\n            const youTubeParams = getYouTubeParams(\n                videoInfo,\n                this.settings.youTubePlayerParams,\n            );\n\n            const isYouTubeNoCookieURL = isYouTubeNoCookie(src);\n\n            const youtubeURL = isYouTubeNoCookieURL\n                ? '//www.youtube-nocookie.com/'\n                : '//www.youtube.com/';\n\n            video = `<iframe allow=\"autoplay\" id=${videoId} class=\"lg-video-object lg-youtube ${addClass}\" ${videoTitle} src=\"${youtubeURL}embed/${\n                videoInfo.youtube[1] + youTubeParams\n            }\" ${commonIframeProps}></iframe>`;\n        } else if (videoInfo.vimeo) {\n            const videoId = 'lg-vimeo' + index;\n            const playerParams = getVimeoURLParams(\n                this.settings.vimeoPlayerParams,\n                videoInfo,\n            );\n            video = `<iframe allow=\"autoplay\" id=${videoId} class=\"lg-video-object lg-vimeo ${addClass}\" ${videoTitle} src=\"//player.vimeo.com/video/${\n                videoInfo.vimeo[1] + playerParams\n            }\" ${commonIframeProps}></iframe>`;\n        } else if (videoInfo.wistia) {\n            const wistiaId = 'lg-wistia' + index;\n            let playerParams = param(this.settings.wistiaPlayerParams);\n            playerParams = playerParams ? '?' + playerParams : '';\n            video = `<iframe allow=\"autoplay\" id=\"${wistiaId}\" src=\"//fast.wistia.net/embed/iframe/${\n                videoInfo.wistia[4] + playerParams\n            }\" ${videoTitle} class=\"wistia_embed lg-video-object lg-wistia ${addClass}\" name=\"wistia_embed\" ${commonIframeProps}></iframe>`;\n        } else if (videoInfo.html5) {\n            let html5VideoMarkup = '';\n            for (let i = 0; i < html5Video.source.length; i++) {\n                html5VideoMarkup += `<source src=\"${html5Video.source[i].src}\" type=\"${html5Video.source[i].type}\">`;\n            }\n            if (html5Video.tracks) {\n                for (let i = 0; i < html5Video.tracks.length; i++) {\n                    let trackAttributes = '';\n                    const track = html5Video.tracks[i];\n                    Object.keys(track || {}).forEach(function (key) {\n                        trackAttributes += `${key}=\"${(track as any)[key]}\" `;\n                    });\n                    html5VideoMarkup += `<track ${trackAttributes}>`;\n                }\n            }\n\n            let html5VideoAttrs = '';\n            const videoAttributes = html5Video.attributes || {};\n            Object.keys(videoAttributes || {}).forEach(function (key) {\n                html5VideoAttrs += `${key}=\"${(videoAttributes as any)[key]}\" `;\n            });\n            video = `<video class=\"lg-video-object lg-html5 ${\n                this.settings.videojs && this.settings.videojsTheme\n                    ? this.settings.videojsTheme + ' '\n                    : ''\n            } ${this.settings.videojs ? ' video-js' : ''}\" ${html5VideoAttrs}>\n                ${html5VideoMarkup}\n                Your browser does not support HTML5 video.\n            </video>`;\n        }\n\n        return video;\n    }\n\n    /**\n     * @desc - Append videos to the slide\n     *\n     * @param {HTMLElement} el - slide element\n     * @param {Object} videoParams - Video parameters, Contains src, class, index, htmlVideo\n     */\n    appendVideos(\n        el: lgQuery,\n        videoParams: {\n            src: string;\n            addClass: string;\n            index: number;\n            html5Video: any;\n        },\n    ): any {\n        const videoHtml = this.getVideoHtml(\n            videoParams.src,\n            videoParams.addClass,\n            videoParams.index,\n            videoParams.html5Video,\n        );\n        el.find('.lg-video-cont').append(videoHtml);\n        const $videoElement = el.find('.lg-video-object').first();\n        if (videoParams.html5Video) {\n            $videoElement.on('mousedown.lg.video', (e) => {\n                e.stopPropagation();\n            });\n        }\n        if (\n            this.settings.videojs &&\n            this.core.galleryItems[videoParams.index].__slideVideoInfo?.html5\n        ) {\n            try {\n                return videojs(\n                    $videoElement.get(),\n                    this.settings.videojsOptions,\n                );\n            } catch (e) {\n                console.error(\n                    'lightGallery:- Make sure you have included videojs',\n                );\n            }\n        }\n    }\n\n    gotoNextSlideOnVideoEnd(src: any, index: number) {\n        const $videoElement = this.core\n            .getSlideItem(index)\n            .find('.lg-video-object')\n            .first();\n        const videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};\n        if (this.settings.gotoNextSlideOnVideoEnd) {\n            if (videoInfo.html5) {\n                $videoElement.on('ended', () => {\n                    this.core.goToNextSlide();\n                });\n            } else if (videoInfo.vimeo) {\n                try {\n                    // https://github.com/vimeo/player.js/#ended\n                    new Vimeo.Player($videoElement.get()).on('ended', () => {\n                        this.core.goToNextSlide();\n                    });\n                } catch (e) {\n                    console.error(\n                        'lightGallery:- Make sure you have included //github.com/vimeo/player.js',\n                    );\n                }\n            } else if (videoInfo.wistia) {\n                try {\n                    window._wq = window._wq || [];\n\n                    // @todo Event is gettign triggered multiple times\n                    window._wq.push({\n                        id: $videoElement.attr('id'),\n                        onReady: (video: {\n                            bind: (arg0: string, arg1: () => void) => void;\n                        }) => {\n                            video.bind('end', () => {\n                                this.core.goToNextSlide();\n                            });\n                        },\n                    });\n                } catch (e) {\n                    console.error(\n                        'lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js',\n                    );\n                }\n            }\n        }\n    }\n\n    controlVideo(index: number, action: string) {\n        const $videoElement = this.core\n            .getSlideItem(index)\n            .find('.lg-video-object')\n            .first();\n        const videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};\n\n        if (!$videoElement.get()) return;\n\n        if (videoInfo.youtube) {\n            try {\n                ($videoElement.get() as any).contentWindow.postMessage(\n                    `{\"event\":\"command\",\"func\":\"${action}Video\",\"args\":\"\"}`,\n                    '*',\n                );\n            } catch (e) {\n                console.error(`lightGallery:- ${e}`);\n            }\n        } else if (videoInfo.vimeo) {\n            try {\n                new Vimeo.Player($videoElement.get())[action]();\n            } catch (e) {\n                console.error(\n                    'lightGallery:- Make sure you have included //github.com/vimeo/player.js',\n                );\n            }\n        } else if (videoInfo.html5) {\n            if (this.settings.videojs) {\n                try {\n                    (videojs($videoElement.get()) as any)[action as any]();\n                } catch (e) {\n                    console.error(\n                        'lightGallery:- Make sure you have included videojs',\n                    );\n                }\n            } else {\n                ($videoElement.get() as any)[action]();\n            }\n        } else if (videoInfo.wistia) {\n            try {\n                window._wq = window._wq || [];\n\n                // @todo Find a way to destroy wistia player instance\n                window._wq.push({\n                    id: $videoElement.attr('id'),\n                    onReady: (video: any) => {\n                        video[action]();\n                    },\n                });\n            } catch (e) {\n                console.error(\n                    'lightGallery:- Make sure you have included //fast.wistia.com/assets/external/E-v1.js',\n                );\n            }\n        }\n    }\n\n    loadVideoOnPosterClick($el: lgQuery, forcePlay?: boolean): void {\n        // check slide has poster\n        if (!$el.hasClass('lg-video-loaded')) {\n            // check already video element present\n            if (!$el.hasClass('lg-has-video')) {\n                $el.addClass('lg-has-video');\n\n                let _html;\n\n                const _src = this.core.galleryItems[this.core.index].src;\n                const video = this.core.galleryItems[this.core.index].video;\n                if (video) {\n                    _html =\n                        typeof video === 'string' ? JSON.parse(video) : video;\n                }\n\n                const videoJsPlayer = this.appendVideos($el, {\n                    src: _src as string,\n                    addClass: '',\n                    index: this.core.index,\n                    html5Video: _html,\n                });\n\n                this.gotoNextSlideOnVideoEnd(_src, this.core.index);\n\n                const $tempImg = $el.find('.lg-object').first().get();\n\n                // @todo make sure it is working\n                $el.find('.lg-video-cont').first().append($tempImg);\n                $el.addClass('lg-video-loading');\n\n                videoJsPlayer &&\n                    videoJsPlayer.ready(() => {\n                        videoJsPlayer.on('loadedmetadata', () => {\n                            this.onVideoLoadAfterPosterClick(\n                                $el,\n                                this.core.index,\n                            );\n                        });\n                    });\n\n                $el.find('.lg-video-object')\n                    .first()\n                    .on('load.lg error.lg loadedmetadata.lg', () => {\n                        setTimeout(() => {\n                            this.onVideoLoadAfterPosterClick(\n                                $el,\n                                this.core.index,\n                            );\n                        }, 50);\n                    });\n            } else {\n                this.playVideo(this.core.index);\n            }\n        } else if (forcePlay) {\n            this.playVideo(this.core.index);\n        }\n    }\n    onVideoLoadAfterPosterClick($el: lgQuery, index: number): void {\n        $el.addClass('lg-video-loaded');\n        this.playVideo(index);\n    }\n    destroy(): void {\n        this.core.LGel.off('.lg.video');\n        this.core.LGel.off('.video');\n    }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+EO,IAAM,aAAa,GAAkB;QACxC,kBAAkB,EAAE,IAAI;QACxB,mBAAmB,EAAE,KAAK;QAC1B,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,KAAK;QACzB,uBAAuB,EAAE,IAAI;QAC7B,oBAAoB,EAAE,KAAK;QAC3B,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,EAAE;KACrB;;ICtFD;;;;;IAKO,IAAM,QAAQ,GAEjB;QACA,gBAAgB,EAAE,oBAAoB;QACtC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,YAAY;QACtB,eAAe,EAAE,mBAAmB;QACpC,YAAY,EAAE,gBAAgB;QAC9B,kBAAkB,EAAE,sBAAsB;QAC1C,UAAU,EAAE,cAAc;QAC1B,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,iBAAiB;QAChC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,WAAW;QACpB,eAAe,EAAE,mBAAmB;QACpC,eAAe,EAAE,mBAAmB;QACpC,WAAW,EAAE,eAAe;QAC5B,UAAU,EAAE,cAAc;QAC1B,UAAU,EAAE,cAAc;QAC1B,WAAW,EAAE,eAAe;QAC5B,cAAc,EAAE,kBAAkB;QAClC,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,iBAAiB;QAChC,YAAY,EAAE,gBAAgB;KACjC;;IC9BM,IAAM,KAAK,GAAG,UAAC,GAAkB;QACpC,OAAO,MAA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