/*!
 * @license MIT
 * @name vlitejs
 * @version 4.1.1
 * @copyright 2022 Joris DANIEL
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VlitejsPip=t():e.VlitejsPip=t()}(globalThis,(()=>(()=>{var e={391:function(e,t,i){var n,r,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n=[i,t,i(377)],r=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i=o(i);t.default=class{constructor({player:e}){this.providers=["html5"],this.types=["video"],this.player=e,this.onClickOnPipButton=this.onClickOnPipButton.bind(this),this.onEnterPip=this.onEnterPip.bind(this),this.onLeavePip=this.onLeavePip.bind(this)}init(){this.isPipApiAvailable()&&this.player.options.controls&&(this.render(),this.pipButton=this.player.elements.container.querySelector(".v-pipButton"),this.addEvents())}isPipApiAvailable(){return"pictureInPictureEnabled"in document&&!this.player.media.hasAttribute("disablePictureInPicture")}render(){const e=`<button class="v-pipButton v-controlButton">${i.default}</button>`,t=this.player.elements.container.querySelector(".v-controlBar"),n=this.player.elements.container.querySelector(".v-fullscreenButton");t&&(n?n.insertAdjacentHTML("beforebegin",e):t.insertAdjacentHTML("beforeend",e))}addEvents(){this.pipButton.addEventListener("click",this.onClickOnPipButton),this.player.media.addEventListener("enterpictureinpicture",this.onEnterPip),this.player.media.addEventListener("leavepictureinpicture",this.onLeavePip)}async onClickOnPipButton(e){e.preventDefault();try{this.player.media!==document.pictureInPictureElement?await this.player.media.requestPictureInPicture():await document.exitPictureInPicture()}catch(e){console.warn(`vlitejs :: ${e}`)}}onEnterPip(){this.player.dispatchEvent("enterpip")}onLeavePip(){this.player.dispatchEvent("leavepip")}}}.apply(t,n),void 0===r||(e.exports=r)},377:e=>{"use strict";e.exports='<svg viewBox="0 0 22 18" xmlns="http://www.w3.org/2000/svg"><path d="M18 8h-8v6h8V8Zm-2 4h-4v-2h4v2Zm4-12H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V1.98C22 .88 21.1 0 20 0Zm0 16.02H2V1.97h18v14.05Z"/></svg>'}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";i.d(n,{default:()=>t});var e=i(391);const t=i.n(e)()})(),n=n.default})()));