PageSourceSearch

https://intek-m.ru/themes/intek-m/assets/js/playerjs_new.js

js intek-m.ru collected 2026-10-08 08:57:38 UTC 1,642,216 bytes, 34,879 lines download raw bytes

1if (!window.pljssglobal) {
2    window.pljssglobal = [];
3    window.pljssglobalid
4}
5if (window['PlayerjsAsync']) {
6    setTimeout(PlayerjsAsync, 1)
7};
8
9function Playerjs(options) {
10    var o = {
11        play: false,
12        audiosrc: [],
13        audioctx: [],
14        playerid: 'd1kr8hpoeu2o',
15        default_w: 640,
16        default_h: 360,
17        version: '19.10.1',
18        compilation: ['HLS', ''],
19        compilations: '',
20        fullscreen: false,
21        realfullscreen: false,
22        nativecontrols: false,
23        fullwheel: false,
24        fullscreen_start: false,
25        airplay: true,
26        pipwebkit: false,
27        ispipkit: false,
28        u: '#1fZxnM3xmaK5kc2YWdjw6wkoXAroXAqwTwOFWc2YjMLwjCOTjM29Tc3wjCjwXAroXArojzqxPbKFmwkPYzqxUMLxObK4jCjwUAkohAqoXwrojzqxOdNtlbKJVeqw6AGXjMK5QcKt0bK9VwkPjMKYXbusjzqxiwkPYzqxPwkP1Av0TwNBWcOFZc2Ygeum0cuIjCOTjc3xlaLwjCksTwN9VwkPYzqxiM3FQc24jCjx0bLFTaGwTwOF5duIjCjx0aLi0wjXjdu9nbLFQc24jCjx0c3ojzqxkcumkbZw6AqXjbutVaqw6AqXjeuJ4eqw6wjwTwOaidjw6wOFQeuYmwjXjbumlaGw6AqXjbumlaK9VduYifGw6AqXjMK5QcKt0bK9VwkPjdu9nbLFQc24jzqxjaZw6AGXjMNeiwkPXzkETwNxOdutlaumVaZw6wksZwrs2wrsZwrs2wjXjeum0cuIjCjwjgGXjM29VevxWct9TbK5mwkQ7wN9ZauJZwkPnzqxWcjw6AGXjevmXaGw6wOBPMLpmwjXjMKB0bK9VwkPjcumVaGwTwNhjCklTwOxWeK5lbK5OwkPXzqx3wkPYAroTwNsjCksTwNtjaZw6wkoVAZwTwNtTc2tlwkPjAq40wjXjMK92aLwjCjwXwjXjM29Tc3wjCjxNaNaNaNMjzqxkc2YWdNxOwkPjaNaNaNaNwjXjM29Tc3xTc2tlwkPjaNaNaNaNwjXjM29Tc3xWeNJZwkPjaNaNaNaNwjXjMOJNaNJZwkQ7wN9VwkPXzqxkc2YWdjw6wNaNaNaNajwTwNsjCkoVBL0TwOpWd2m0bK9VwkPjMN90eu9UwjXjcKtZa2mVwkPjAqoYAqo1BGoYAqwTwNiicNFTaGw6AGXjMNeXMKFlbK5OwkPjBGoXwrIhAqwTwOFQdqw6AGXjbumlaGw6AGXjbumlaK9Vcum2aGw6AGXjbutVauYmd2BicuIjCjwYzkAjzqxPMK5lcuJUMLxObK4jCjwXwrohAGoXwjXjbutVauYmbumlaGw6AGXjeumXMNeiwkPjAGwTwOFQduxOM29Tc3wjCjxNaNaNaNMjzqx0bLpkc2YWdjw6wkoXAroXAqwTwOFQduaWcOFnbLQmwkPYAqXjcumVaLFQdu1idNeQcNxWevFWcGw6AHITwOFQdvpiauFQcNdjCjw1wrIhBqo1wO0TwNBWcOFZc2YgduYifGw6fZxWdNFmdjw6AjXjc24jCksTwNmkc24jCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhaNmTcq1ZeKYmDGeVc256aLxWxZp0dNtVd2aWdN09x3FZMK5ncut0aGh1zqonyGd#Dvpieuhhar0OHHsYzkE0BkA0BkwTBj4YBHd4AHw1wsXYzks0Ars5AkAYzroVAHs2BkM2BkdhEnsVArs0Anw2CHwTAq4X
28BrA3BGoXzkh4Brd1CHMZzrohAq43AnM2Crw2CGXXwsAXzkAnAns3Ano4zrohAq4XArA3Ars5AjXXzkAZCrsZBGoXzkoXAndXAHlZzroVBnw5AHM2BkdhHroTAq43AklYBkM2BZpAAqXYAZ4ZBno4AnAnwsXXzkoXAndXAHlZzrsnzkw3ArhnAnAhEnoVAronBnoYCHwTAHAVBkdYCrd1wroVAnAnAHdnArhTAHEhAq43AnM2Crw2CGXYBqprAq44Crh0Bks1BqXYBqoYzkoYBrAZBklZzrsnzkl0Crl1CrAhAG4YBHsZCHhXCqXYAZ44BnMXBrs3wsXYAG40BrMnBrMZzrdVCrEZAHh3BGprAHsVBklXBkdnAGX3zkM0AHM2BkdhAHsVCrE2AHInCqX3zkAnCHo2AkIhAHsVCrE2AHInCqX3wsAYAG44BrMYBHA4zrMVBkMXCHA3BGoYAG42CHo2BnAYzrMVAnMYCHd5AHdhAHsVBrE2AnE2AjX2zks1BnhYAkIhHrsYzkE0BkA0BkwTBj4YBHd4AHw1wtPOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjbKBWckwjCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhaNmTcr0OwnoXAroXAqdhevxicOBNc3xUDGe0dNtVd2YieuIPBqXhAZlODkYXMLFPwuE9x003zkdXBnM5Akw4zroVBnd3Bnd4ArM3wsX3zkdXBnM5Akw4zrsnzkwZAkwZAkwhEndVBno3BklZAkhTAHAVBkIYBnd3wrhVArlYAHwXAksTAHEhCq41BkEYArw1AZXYBqpAAHsVAHAnAnAnAZXYBqprAHsVBko2Ans1BjXYBqoYAG45Crl3BrA1zrsnzkM1AHd3BZoYAG45Crl3BrA1zrsnzkwZAkwZAkwhHrsYzkl4CHd0AnITAq43Bnd3Bnd3BnhhEnsYzkl4CHd0AnITAq4nBrhZAkw5BnwhAHsVBko2Ans1BjXXwrsYzksnAnAnAnATAqpACq41BkEYArw1AZXXwsA4zko5AHsZArwYzrohBZ43Ard2CHwZCqXXzkA0CrwZAkl3Ajo3zkdXBnM5Akw4zroVBnd3Bnd3Bnd4wtPhHHAVBrw1BkEYArsTAHEhHroVCrI2BrsXAkInzrs0wsAXzkA4AnEZBnlnAGXYBqoXzrsnzkM1AHd3BZoXzrsnzkwZAkwZAkwhHroTAq43Bnd3Bnd5AHAhEnoTAq4nBrhZAkw5BnwhAq4nCrA0Akd5AnsTAqoXzkh1BkEYArw1AZXXwsXnzkEZBHM0AHoYzrohEnAVCrl4BkwnAnETAqo0zkw4Ako1AHw3zroVAnE4AkwZCHdZwrEVAkhZArIYAkdTAq43Bnd3Bnd3BnhhHrEVAkhZArIYAkdTAHAVAkwZAkwZAjprBq4ZCrwXBHsZBZXYAZ42BHs3BndhAZ44CHh2AkAnBqXYBqonzkEZBHM0AHoYzrs0wtPOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjbKBWckAjCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhevxicOBNc3xUDGe0dNtVd2YieuIPAjXhAZlODkYXMLFPwuE9x00YBjX3zksnBkMYAHAZwsXYBjX3zksXCHs2CHE1wsXYBG4ZArhYBnh1zrdVAHo5AHM5BrIhHrs0zkw3BHo5AZX3zksXCHs2CHE1wsAYBq4ZBnIXCHATAZ4YCHlYAkMZBGoYAG4XBkAYCHdTAqo3zksnBnI0BkE1zrohEnAVAksYCrl1CHsTAqoXzrAVAHl5AHw2AkIhAqX3zksXCHs2CHE1wsAXzrsYzkoYCHwYAkMhAZ4ZAHs4CHI5AGXYBq4ZAHhnAnh5wrdVAHA3BHE2BrITAHEVAks4AnA4CGpABZ4YAnd1BrM0BGXYAj40BrsXBrM1wsA0zks5AnAXCrI1zrsZzkE0AHo0BkIhAG43CrEnCrM2AjXYAq4XBrs3Ars4wrsVBnh0Anh2BkwTBZ4YArlYBkl0BGprAG43CrEnCrM2AjX0zks3BkMnBno1wrEVAHlnAno4BHITAG43BndZCHwnBjo3zksnBnI0BkE1zrsVBnd3AklZAnMhEnsXzko4AHd4BrETAG43BndZCHwnBjoYAj40CHo3ArMnzrEVAHd2BkA3ArIhAHwVBrlXBno2AZX3zksXCHs2CHE1wsXYAq42BrE1AHM3zrdVAHo5AHM5BrIhHrsnzkA4Akh5CHMTAHsVBHIZBroXBqpAAHMTBZ4YAnM2AHsnAjpbxZpNbKYTDGdkaNaNaNaNxn48Lq9XMLFPDkYdz2d#DtXWd3aODjwTwNtkeumWcjw6wOpTMLljzqxiM3FQc24ZwkPjdut1d2Ijzqx0fLpmwkPjd3aOwjXjd2BicuIjCjwYwjXjd2BicuJWeNJZwkPjzHsjzqxUMLxObK4jCjwXwrohAqoZBGwTwNsjCjwXzkhjzqxic3amdjw6wksjgGXjM29VevxWct9UeLFmwkQ7wN9ZauJZwkP1zqxWcjw6AqXjbKBWcjw6wkYneNdhe2mleuh9xnwXxZpPaKmObvE9xnwXxn48aZp0dNtVd2aWdN09x3FZMK5ncut0aGhYzqoYyGd#DvpWcvmOc24hdu9QcOFnDGdUAG4YAnM4BkhnCuIUAHAhBG43BrI1BHM2BqoUAG4YAnM4BkhnCuIUAHAhAHsVBnE5BkhZBjo0zkoXAkE2BHhZwrsYzkd0CHM4AkMhCG4XArw0BkI4AjoYBj43Brl2Crw2wrlVAroZBrM1CrwhAq43Brh5ArsnBkdhBq4XArw0BkI4Ajo1zkd0BHI1BkM0xZpNbKYTDGdkaNaNaNaNx1XWDkYXMLFPwuE9x00YAG4XArw0BkI4zrEVBnE5BkhZBkwhHrsYzkoXAkE2BHhTAHwVBnE5BkhZBjprAHsVAroZBrM1CqXYAj43Brl2Crw2wrsnzkInBrM5AkETAHsVBrwYCHE4AjoYAZ41AnE2CHw0zrhVBnE5BkhZBkwhEnsnzkInBrM5AkETBj4XBnd0AHM5CGoYAG4XArw0BkI4zrEVBnE5BkhZBkwhAHsVAroZBrM1CqX0zkd0CHM4AkMZwtPOwumlDGeXbOBgeN9TeK1mL2JTaK1mcOEYxZpNbKYTDGdkaNaNaNaNx1XWDkYXMLFPwuE9x00YAq45CHdnArdZzrwVArlYAkh0AHhhEnsYzkIXCHh4BndTAj4ZAnEnBHo1CGoYAj42CrwZCHsYzrwVCrE2Aro1BkdhAHAVAkh4CHhZBGXnzkw5BnhYArI4wsAYBq45CHEXBks5zrEVBHM3BHh4AnwhAHIVCHl2BnI1AjX2zkAnBrw3Ano2wrs1zkl5Ans4CHMTCq43BksXArMZBZprAHIVCHh5BkAXBGXYAG4YCrAZBrhZwrs0zkl5Arw1CHETAHwVCHw5BHdnwrsnzkw5BHA5zrs0zks3Arh4AZprAHwVBklXAkE1AjXYBq42AHEXCrM2wrsYzkEnBHd5AGXYBG4ZBHd2BkMhAHoVCHl3Ano3AjXYBG4nBkoZAkl1wsXYAq45CHdnArdZzrs3zkEnCrAZCHhhEnsYzkh5Bns0BnlTAHdVAkA3AnEnCGoYAZ4YCrA3CHE5zrs2zkdnAHM0BHdhAHEVBrd3AHAXAjXYBG43CrE0AHM0wsAYBj42BHh5Bkd2zrs0zks4BkE1BrMhAHdVCHh4BkA0zrsYzkh2Akl2BrshAHdVCHlnAHh3BqX4zkd2Anl0BrlhEns3zkl5Bnd0BrMTBG42BkwnBrM2BjoYBj42BklXCrsYzrAVAnwYAnwZAHAhAHEVBrhnBHA3BjXYzkM5And0AHA4wsAYAZ4YCHw3CHd5zroVBnAZBHwnBkAnwrsYzkh5BHsnArhTAq4ZAHAnAkwXBrIhAHoVCHl3Ano3AjXXwsXYAq45CHdnArdZzrwVArlYAkh0AHhhKjdhbKE9x3pRd192c2Y1cKJgaKYmcKJVerwOwuaQcuXUdOJTaH0OcN9VfNJZcZdhaNmTcr0Ow2aNaNaNajedzn48Lq9ODkYdz3B2an4jzqxQM29VAjw6wkYneNdhe2mleuh9xnwXxZpPaKmObvE9xnwXxn48aZpNbKYTDGdkAroXAroXxZp0dNtVd2aWdN09x3FZMK5ncut0aGhYzqoYyGd#DvpWcvmOc24hdu9QcOFnDGdUAG4YAn
28M4BkhnCuIUAHAhBG43BrI1BHM2BqoUAG4YAnM4BkhnCuIUAHAhAHsVBnE5BkhZBjo0zkoXAkE2BHhZwrsYzkd0CHM4AkMhCG4XArw0BkI4AjoYBj43Brl2Crw2wrlVAroZBrM1CrwhAq43Brh5ArsnBkdhBq4XArw0BkI4Ajo1zkd0BHI1BkM0xZpNbKYTDGdkaNaNaNaNx1XWDkYXMLFPwuE9x00YAZ41zrdVBnlZCrlnAkwhHrsYzkh1AnI1AnETBj4YBrM0BrM2AGpAAHsVAHE2BrE2BjX2zkh1AnI1AnA5wsXYAj43CHw4CHAZzrhVBGpAAHsVAHE2BrE2BjXYAq4YBrM0BrM2wsXYAG44BHA1BHA0zrsXzkh1AnI1AnEhHrsnzkITCG4ZArdYArM3CqpAAHIVAHE2BrE2BjXYAq44BHA1BHA0wsXYBG44BHA1BHA0zrsXzks0BkE0BkMhHrs0zkwXBnsXBkhTCq41wsXYBG44BHA1BHA0zrMVCrInBHInAnlhHrs1zks0BkE0BkMTBj4YBrM0BrM2AGpAAHAVBGX3zkd5Akh5AnwZwtPOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjMKB0bK9VwkPjcLJ0aGwTwNtkeumWckwjCjx1cN11euIjzqx0fLpmwkPjd3aOwjXjcKtZa2mVwkPjAqoXwrohAkIjzqxiwkPjAq44wjXjaumnduYifLaWcvJUaGw6AL0TwNBWcOFZc2YgeN9TeK1mwkQ7wN9ZauJZwkP2zqxWcjw6AGXjevmXaGw6wOBPMLpmwjXjMKB0bK9VwkPjeN9TeK1mwjXjbqw6BGXjdN91cNFQcNdjCkoTwNB1d3FWcLeQavFPwkPYzqx3wkPYAroTwNsjCksTwNtjaZw6wkoVAZwTwNtWeNJZwkPjAqwTwNBWcu9ZwkPjaNaNaNaNwjXjM29Tc3xjaZw6wNaNaNaNajwTwNBWcu9Zc3amdjw6wNaNaNaNajwTwNiQauIjCksTwNiQauJWeLFUeLFmwkPYzqxZc3FieumWcjw6wkw3AqwTwNxOdutlaumVaZw6wkIhAqo1wrojzqxjaZw6AqXjbutVauYmwkPYzqxUMLxObK4jCjwXwq0YAjoYArohAqwTwNiicNFTaLBkMKYmwkPjAG4nwO0TwNBWcOFZc2YgeumUaGw6fZxWdNFmdjw6BZXjc24jCksTwNtkeumWcjw6wOFQcKIjzqx0fLpmwkPjeuJ4eqwTwOFmfvEjCjwXCkoXwjXjaN9VevBQfNIjCksXzqxUMLxObK4jCjwXwrohAqoYBGwTwNBTbKBSwkPXzqxnaLpidNt0c3wjCjxdzZwTwNsjCjwXzkhjgGXjM29VevxWct9leLxieumWcjw6fZxWdNFmdjw6CqXjc24jCksTwNtkeumWcjw6wNF1dNt0bK9VwjXjevmXaGw6wOFmfvEjzqx0aLi0wkPjLq8hArPXAqwTwNaWcOFnbLQmwkPYAqXjcKtZa2mVwkPjAqoXwrohAqwTwNBTbKBSwkPXzqxiwkPjAq44wO0TwNBWcOFZc2YgMOJNaNJZwkQ7wN9ZauJZwkP5zqxWcjw6AGXjbKBWcjw6wkYlbLMhM2Yid3A9x2YWMKFmdjiZMK5lyGd#DvB2aZpkcutndn0OM2mZM3JTMLwPdNtVaqlOwvaQaLeqc3h9xnw1wrw1wrIXwrIXxn48M2mZM2YmwuBTMLBnDGeXMLFPyvxicNEQxZpnevxWb2I9xZikc2YWdjlOwuB4DGd1AqdhM3l9xnIXxZpZDGdZAqdhaNmTcr0OcN9VaGdhd3FZc2UmzLeQavFPDGdZxZpnevxWb2IUcKm0aLxTbK1Qer0OAHoOLq8#DtXWd3aODkYdz2FQek58gvXVcu9iauJZyvxicNEQwvUXc3BQeumWckPhdNJTMLFQeNI7cKtZa2mVCjoUAkJXfqoXwrohzHw1dvh7e2mleuh6wrIXdvh7gG5Tc2tlaLwPdNtVaql6MNJNc3xmwvUkc250aK50CjoOxnUlbLBXcut5Cjpjcu9kbnUXMKFlbK5OzLFWdrPhAHoXxHU9zNBQdNB1cutZyvxicNEQwvTUe2Jjb2m0zKtVbK1ieumWckPhdN90MLFmwrxnwuYQcNJ
28idjpQcNaQcNm0aHUicNmUMLFQc246wvxWeut0aGoZdZpTbK5mMLwhbK5NbK5QeuI7buJQa2i0CjoYAromCZ13aKxSbLEUevxicOBNc3xUzK9ZbKeQckPhM2JVeuJZwuBmcOFmdkU0dNtVd2aWdN0Uc3xQa2mVCjpkaK50aLwhM2JVeuJZC3eQavFPCjoYAromC3pWd2m0bK9VCjpiMOBWcvJ0aHU0c3o6wro7MN90eu9UCjoXC2YmaOE6wro7dNmObvE6wro7cKtZa2mVCjpieLFWC30Vdut0bqiZMK5lyGp7d3FZc2UmzKFid2iidOxifHPhAGXhAkoXC3B0dN9SaG1lMLBPc2aNd2J0CjoXCZ13aKxSbLEUMK5QcKt0bK9VCjplMLBPwrsVBLAhaKtnaG1Qcj1WeLEhbK5NbK5QeuI7MK5QcKt0bK9VCjplMLBPwrsVBLAhaKtnaG1Qcj1WeLEhbK5NbK5QeuI7gIoUe2Jjb2m0zKUmfKaZMK1mdZpZc3FieuIhfnsXAqIhfZ13aKxSbLEUevxicOBNc3xUCjpZc3FieuIPAnMXauJOyHU0dNtVd2aWdN06wvxWeut0aGhnBkplaKdQC319EuUmfKaZMK1mdZpZc3FieuIhfnsXAqIhfZ13aKxSbLEUevxicOBNc3xUCjpZc3FieuIPAnMXauJOyHU0dNtVd2aWdN06wvxWeut0aGhnBkplaKdQC319Eq13aKxSbLEUb2J5aOxicKJnwuFid2hhfnomwvUnevxWb2IUautnbutZdNt5CjoYzqoZAro7d3FZc2UmzKFid2iWaNanaLE6wro7gHIXxGp7d3FZc2UmzKFid2iidOxifHPhCrlTwrwXArUnevxWb2IUautnbu9NaOBmerPhzHA1dvh7gHsXAqIhf3B0dN9SaG1lMLBPMLxZMLl6wrh5zqoZAro7d3FZc2UmzKFid2iWaNanaLE6wq0YAkFXfrU9gIpSaLmNdNtUaLAhautnbqp7AqIhf3B0dN9SaG1lMLBPMLxZMLl6wrsTwrwXArUnevxWb2IUautnbu9NaOBmerPhArU9BHomwvUnevxWb2IUautnbutZdNt5Cjo4CGXhAkoXC3B0dN9SaG1lMLBPc2aNd2J0CjoUAnJXfrU9AHoXxGp7d3FZc2UmzKFid2iidOxifHPhCrlTwrwXArUnevxWb2IUautnbu9NaOBmerPhzHsZBvp4C319wjXjMKB0bK9VwkPjMOJNaNJZwjXjevmXaGw6wNBndZwTwOpWd2m0bK9VwkPjM2JVeuJZwjXjd2BicuIjCksTwNBTbKBSwkPXzqxPbKFmwkPYgGXjM29VevxWct9naLF0bK5OdZw6fZxWdNFmdjw6AHsTwN9VwkPYzqxQM29VwkPjDvB2aZp3bKF0br0OAkoOwuimbKePer0OAkoODkYOwuaQcuXUdOJTaH0OcN9VfNJZcZdhevxicOBNc3xUDGe0dNtVd2YieuIPAGXhAGlODkYXMLFPwuE9x005zkl1CHwYBkA2zrohHrsYzko3AnEnBHwTAj40Akw5Cro3BGpAAHwVArh0Akd4zrwVCHd2CrA2BnIhHrs0zkI2BHEZBkATAG44BklYAkE3BGpAAHMVAroYAnI1AZXnzkA1BnM2Bkh5wsXYBG4YCHdZBkE3zrIVCrEYBrs3Arlh
28Hrs1zkEYBHE3BHMTBj44Ano2CrEnBGpAAHdVCrdnBno2AZX3zkd4CrA5AHshHrs4zrlVCrEZAkl5BHEhHrs1zkI1AnA1AHETAHoVCroXAro2AZpAAHIVArdXCrE3BZXYAG44Anh0Arh5wsXYBj4XCrs2CHo1zrs0zkA0AkwXCHAhHrs0zkM1BkMXBrwTAHIVCrsnBHE3CGpAAHwVAHInAHI0AZXYBq43BklZArE1wsXYAG4XAkd0BnM2zrs1zkw0Akw0ArhhHrsXzko4BHIYArsTAHdVBko3BkdhHrhVArMnCrw0BHETAHdVBZpABj45CrEYArI0BZXYBG4ZCrh0ArI4wsX1zkhYAkE2CHwTAHEVBnhXBns0CqpAAZ40BrMYBHI3BqXYBG44BHA3BnwYwsXYzkl2Brw2CrsYzrs0zkEnBrInCHAhHrwVCHw5Akd1BHsTAHsVCrh0BHdnCGpAAj4nBkMnAHA0BGXYAq44AkAXAkM5wsXXzrlVCrl5CHd0CrAhHroVArwnArEXCHo2CGX3zkhZAno0BHd4wsXZzkE0Bkd3AHhYzrMVCrEZAns4BrwhHrwVCHEXBnA0AnITBG44Brs0AHdXCGpAAG44CrA5Anw5BZXnzkA1BnM2Bkh5wsXnzkAnAHAZArh1zrsVCrlZAkM5AHAhHrIVCrM5Crh2BkETAj44CHMYBro4BjpABj45Bnw2BrM2AjXZzkE4Ard3CHhhHrdVCHA3BHAXCqXXzko0Bko0AHwYAnMhHrlVCHI5Aks2AnMTAqpbws04zkh0CHlnCrdnzrMhEndVAkd2ArAnBrITBjo2zrdVAkd2ArsnAkhhBjX4zkh0CHlnCHd0wsA2zrsXzkEZAnl4BkdhBZ4ZBnMXAnA0BGXYAG43wrhVCrE5CHA4BnATAHsVBZprAHoVBrwnCHM2BjXYAG43wrsYzkdTAHoVBrwnCHh2BZoYAG43zrhVCrE5CHA5BnEhEnsYzkdTBZ4ZBnMXAHAZCqoYAq40AkA5BkM2zrMhCq44Brl5Anh3AZX2wtPOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjMKB0bK9VwkPjd2J0eumVa3AjzqxXc3BQeumWcjw6wNBWcOFZc2YnzLxQa2i0wjXjcKtZa2mVwkPjAqoXwrohAHIjzqx0fLpmwkPjd3aOwjXjMGw6wkoVCqwTwNtWeNJZwkPjAGx9zqxkc250dN9TL3pTMLmTbLB0wkQ7wN9ZauJZwkPYAjXjc24jCkoTwNmkc24jCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhevxicOBNc3xUDGe0dNtVd2YieuIPAGXhAjlODkYXMLFPwuE9x00XzksYBrl0BrdZBZXnzkw2BnwZBkh5wsAXzko1AHE2AjXnzkw2BnwZBkh5wq0Yzkd3BkA1Bkh0aG0YBGXnzkAYBrI0CHEYwq0Yzkd3BkA1Bkh0aG0YBGXnzkA3AkEZBrw1wsXUAG43BnMnBHM4BuIUAHITAHMVAkAXCHA3AGprzHsVBnd2AnI2CrFmzHs1zrs2zkw4CHonBHdhAq4XBHs2AnI0BHE1zrs2zkAnBksnBrIhAq4YAHE5BrE3AkdTAHMVAnA2AHA0BGpAAHdVCrh1ArI1AZXYBj4nAnMYAnE1wsAYBZ45Brh1AnhTAHMVAnA2AHA0BGoYCqXYBj4ZCrh4AHs5wrs4zrs2zkwnArlnBnshHrs4zrAVAndZBrw0AkIhEns4zrAVAns0Anw1BjoYBZ45BrhnBkE1zrAVAkM3Akw2CrlhAHdVCrh1ArI1AZXnzkw2BnwZBkh5wsXXzksYBrl0BrdZBZXnzkw2BnwZBkh5wtPhHHsVBkA2AnMnBkETzHlVCHlZAro3AkxmzHs2wsXYzkMnBkA2AnM0zroVCrs2Cro2BnwnwsXYBj4nBkA2AnM0zroVCrs2Cro2BnwnwsXYBj4nBkA2AnM0zq05zkl5AkoXBnwZaG0YBjpAAG42AnMnBkA2BqXUCG45CHwXArdZANIUAHMhKjpBAq44AHhYCrs4AHhTAG42AnA2AHA0BGpAAHdVAHhYCrs4AjXYzkMnAnMYAnE1wsXYBZ4YCrs4AHhZzrwVBrIXBrwXAHdhHroVCrs4AHhYCrs4zrwVBrIXBrwXAHdhHroVCrs4AHhYCrs4zrsVBkAnBksnBrIhKjpBBj41BrI0BHE1BGX3zkA1AHw2ArIhHrsZzkw3AkdZBnATCG44Ars2Cro2BZpABj41BrI0BHE1BGXYAj4ZBHwYAro4wsX2zkI0BHE1BrI1zrdVAnIYAkMXBGpbxZpNbKYTDGdkaNaNaNaNx1XWDkYdz2d#DtXWd3aODjwTwNtkeumWcjw6wOpTMLmTbLB0wjXjdu9nbLFQc24jCjxkc250dN9TdZ1ZbKePeqwTwN1idNeQcjw6wkohAqoXwrwXwjXjMNdjCksTwOBkMKYmwkPjAGwTwOF5duIjCjxneNdjzqxicNmUMLFQc24jCjxVc25mwjXjMNeXMKFlbK5OwkPjAZonwrAhAZwTwNxOMGw6Aq40zqxja2tWeNJZwkPXzkhTwOFQdqw6AqXjMGw6wkoVCqwTwNtWeNJZwkPjAGx9zqxkc250dN9TL2a1cuXjCOTjc3xlaLwjCksnzqxWcjw6AGXjbKBWcjw6wkYneNdhe2mleuh9xnwXxZpPaKmObvE9xnwXxn48aZpNbKYTzLx1cuI9x25WcOQmdN8OwvFZMK5naN9ZcH0OevxicOBTMLFmyrsTwrsQxn48dut0bqplDGeBAHMVCrlZBkhnBjXXzkIhEns3zkITAq41wrs3zkITAG4YArdZBnw5CGoYBZ41zrsVAHo3AkdZCHlhHrs3zkITBq43BHo5AHo5AGprAHdVBGX1zko4BksZBHMhAHdVAkw3CHwZAZX1zkA1Crs4AnlhAHMVCrlZBkhnBjX1zkA1Crs4AnlhEns2zkI1BnE0BGX1zkA1Crs4AnlhAHMVAkh1AnM3AjX1zko4BksZBHMhAHMVAkh1AnM3AjX0zkd1ArlYArlYwsXYBj4ZCrInBkdZzrwVBHdnAkw5CHhhHrsYzkw0CHE5CHlTBZ42Arl5BHwYAZprAHsVArsYBrAYCqX3zkh0Bkd4CrMhAHoVBkw3Bko3CGX3zkh0Bkd4CrMhAHoVAnh5BHA5CGX3zkMXCHl1AksnwsAYAq4YBHw2CrM1zrdVAndYCHoYAHwhAHoVAHIZBkh2BGX2zkl4CrsXBrI5wrsXzkA4CHInCHlTBj43BHsZBkhYAZpAAHIVBrw2BkwYCGXYzkdYBrI0BHl3wsXYAZ4ZBrh3CrI0zrsVBns0BHE1CHdhEnsZzklYAnI0BkdTAG43AHE1BrI5BZoYAj42Brs0BklTAG40Brw0Crd2CqoYAj42Brs0BklTAG4YArdZBnw5CGprAHwVBkEYBrM5zroVBndZArI4Akl4wrsZzklYAnI0BkdTAq41wrsnzkw0Crd4BHETAq41wsXYBj44CHw2CrA2zroVBGpbws0YzksXBnAYBkA4zrs3zkIhEnoVBGXYBZ41wroVBGXYBj44CHw3AkdhAq41zrs2zkh5AkdZBZpAAq41zrsnzkw0CHo4CHshEnoVBGXYAj45AHA4BnE0wroVBndZArd3BnA2zrsZzkM0AHhYBkshAG4YArdnAHMnCqXYAj42Brs4AHMYwsAYzkE0AkI1BHoZzrsZzkM0AHhYBkshAG43AHE2Anw3BGXYAj45AHA4BnE0wrsVBns0BkAZBnITAHAVAkE5Arh5AGpAAG43AHE2Anw3BGXYBG40AkM3BZpABj43BHs3AHE3CqXYAq4nCHoXBrd5wsA2zkl4CrI2Crs2zrsXzks1AnwYAHEhBZ4nBnA2ArM3BqXYAq4YBHAZAHs0wrdVBksXBrMXAHATAHoVAnlXArE3CGprBZ44BrdnAHA1AjXYAq42AkM4CrEnwrdVCrE3AnsnBHwTAHsVArsYCrl1Bqo3zkMYArE2ArsnzrsYzkw0CrdnAHlhHrwVBHdnAnd4AHsTAHMVAkh1BrI0wsX0zkd1AHwYBrMnzrs2zkw4BHE1BqprBG4XCrM0BHAZBZXYBj4ZCrI0BHEhBG4nBHh1AnsXAGXYBj41BHd1AHwnwrIVAnI4BHAYArsTAHMVCrlZBnw3wsA1zkA1CrInAHoYzrs3zkwZBnl0AHdhBG4XCrM0BHAZBZXYBZ41wrEVBnIYAks0BkATAHdVBGpAAG4YArdnAHMnCqXYBZ41wtPOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjbKBWckwjCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhaNmTcq1ZeKYmDGeVc256aLxWxZpNbKYTDGdkAroXAroXxZp0dNtVd2aWdN09x3FZMK5ncut0aGhYzqoYyGd#Dvpieuhhar0OHHsXzkhZAkd5BrATBZ43Crw2AnM2AZprAHoVAks1CronAjX3zkd4AkMnBkMnwrsXzkwYBHhXAnwTBZ4YBnI3BnI1AZoYAq4ZAHI4ArAZzrdVAHd1Bnd1BHAhHrsXzkwYBHhXAnwTAZ41AnE2Arh5AZprAHoVAks1CronAjXnzks5CHMZAHMhAHoVBrh3BnA1AjXZzklZBnd0BnhnwrsXzkhZAkd5BrATAj45Akd3Brd4AZprAHsVAHI3CrInBqXZzklZBnd0BnhnwrsYzkEZCHd4BHETAZ4YCHl2Aks2wrsYzkEZCHd4BHETAZ41AnE2Arh5AZpAAHsVBrw5Bnh1BqX1zkdYArhYAkh0wsXYBj40BkEYBkl3zroVBkd3BHo2CrdZwsAYBj43Aro4CHMZzroVBrEXCrAYArEnwrs3zko4BHdZCrMTAq40Bro4AnsXBrAhAHdVAnwZBrI1AGXXzkM3BnIXBkh3AjprAHdVBHI5AHhYBjXXzklYBrs4AkdXAGoYBZ41BHlYCrs2zrsVAkl4CHAZBkEhAHdVAnwZBrI1AGXYzkInBHMXCrE3wsXYAj4ZCrhXBno4zrMVBHM4CHs0BrAhHrs0zkE2Brd0AGX2zkI2CrlYBrEnwsAYBq43CHl4zrMVBHM4CHs0BrAhAHIVArdYBnAZAGX2zkh0Ard4CrwYwrs1zko3AHdnAksTBZ4YBnI3BnI1AZprAHIVArdYBnAZAGX3zkIYArd2Akh2wrs0zkd5CHhTBZ43Crw2AnM2AZoYBq40BkE3BrsTBZ43Crw2AnM2AZpAAHoVCrwZBnl0AZX3zkd4AkMnBkMnwtPhHHdVAHd3Ako1BZXYAq4ZAHdnBkA0wsA3zkd4Brs5BkhYzrsXzkwYBnA2AnEhBZ43CrEYCHM4AGXYAq44AkEZAkE1wrdVBnh0AHl2CrsTAHoVCrw0Akw0BGpABZ43CrEYCHM4AGXYBq40BkInCHsYwsA3zkd4Brs5BkhYzrs0zkhXArA3CrEhBZ41AHwZBkE3CGXYBG4XBnwZBHwZwrdVAHd3Ako1BZXYBG4XBnwZBHwZwsA2zkh0Aks0BkMYzrs1zko3Akw1AkwhBj41BnoZAHE1CGXYBq44AronBnh0wrMVBHdXAks0BHlTAHEVBrM1AnlYAGpABj41BnoZAHE1CGXYAj4ZCrlYCrdZwsXYzkInBno0BrAYzrs3zkAZAkE5AnshEnsVAkl5AHonCqXYBZ41BHlYBklhAq45AHI0CrI0AHETAHdVBHI5AHM5wroVBkd3BHE0Crl5zrs3zkAZAkE5AnshEnoVBrEXCrs4AnM3zrs3zko4BrMXAnMhAq40Bro4AHhnBkdTAHMVBnoYArM3BqoXzkM3BnI0Brh5CGXYBj40BkAYBnd4wsX1zkdYAHlZCHs2zrsYzkEnAHo4BHMhHrAVBHA1AkI5ArETAHsVBrAYArh1BjprAZ4ZAroYCHl5BGXYAG40AnsXCrI2wrwVCHw4AkM3CHATAHsVAHI5AksYCqoZzklZCrw2BnlnzrsXzkhZBrwZBrIhEnwVCHw4AkM3CHATAHoVBrh5AkA3AGonzkwXArs5CHl1zrsXzkwYBnA2AnEhAZ41AnIZBHlXBqXYAq4ZAHdnBkA0wsX3zks3BnwXBHdTAHoVAks3AnMnBqpbxZpNbKYTDGdkaNaNaNaNx1XWDkYdz2d#DtXWd3aODjwTwNtkeumWcjw6wNa1cuYnM3xmaK4jzqxiM3FQc24ZwkPjcN9ZcKtTd2BZaKJVwjXjevmXaGw6wOB2aZwTwOpWd2m0bK9VwkPjM29VevxWcvAUdNmObvEjzqxUMLxObK4jCjwXwrwXwrohAkojzqxnM2tTaGw6wksjzqxnM2tTaK92aLwjCjwUAGwTwNsjCjwXzkhjzqxic3amdjw6wksjgGXjM29VevxWct9neutZeqw6fZxWdNFmdjw6AHETwOpWd2m0bK9VwkPjM2JVeuJZwjXjd2BicuIjCjwnwjXjc24jCksTwNmkc24jCjw8d3aOwveQavFPDGdZAqdhbuJQa2i0DGdZAqd#DudhaNmTcq1ZeKYmDGeVc256aLxWxZp0dNtVd2aWdN09x3FZMK5ncut0aGh1zqonyGd#DvpWcvmTbK5mwvpWbK50dn0OAq41CHA3BGoXzkE4BrA4wroVBHMZBGoYAZ41AHI2AZoYAG40And1wrdhAq41CHA3BGoXzkE4BrA4xZpNbKYTDGdkaNaNaNaNx1XWDkYdz2d#DtXWd3aODjwTwNmkc24nwkPjDvB2aZp3bKF0br0OAkoOwuimbKePer0OAkoODkYOwvFZMK5naN9ZcH0OevxicOBTMLFmyrwTwrAQxn48dut0bqplDGeBAHMTBZ4YAnM2AHsnAjpAAHMTBZ4YArlYBkl0BGpAAHIVAko4AHd4BGX3zksXCHs2CHE1wsXYBq4ZBnIXCHATBZ4YArlYBkl0BGprAHEVAkd1ArlnzrAVAHl5AHw2AkIhAHsVArMnAHl3zrohBZ4YAnd1BrM0BGXXwsAnzkwYAHh5
28BHlYzrohAqXnzks5CHsZBkw1wroTBZ4YArlYBkl0BGprAqXYAG4XAHlZAHw2wrAVAksYCrl1CHsTAHEVAks4AnA4CGo3zksnBnI0BkE1zrs0zkwYCrAnCrlhHrdVAHA3BHE2BrITAHwVBrEYArE2BGprBq4YCHAnArh1BGXYAj40BrsXBrM1wrsVBnh0Anh2BkwTAHoVArEYBnoYCqoYzkd4BrA4BkMZzrdVAHo5AHM5BrIhEnsVBnh0Anh2BkwTBq4YBnM2AndXBGo0zks5AnAXCrI1zrsVBnd3AklZAnMhBZ4YAnd1BrM0BGXYzkd3Bnw5AkA2wsAYAq4XCrs3CrE0zrsVBnd3AklZAnMhAHwVBrlXBno2AZX0zks3BkMnBno1wrsZzkE5ArdXBkATBZ4YArlYBkl0BGpAAHoVBkE0BHs2BZX3zksXCHs2CHE1wsXYAZ4nCrw4CHl2zrsYzkI1AkEXArEhHrs2zrdVAHA2BksYAnwhKjdhaNmTcr0Ow2aNaNaNajd#DtXWdut0br48Lq9ODkYdz3B2an4jzqxiM3FQc24jCjxXcut5wjXjevmXaGw6wOB2aZwTwNxOwkPYzqxja2BWcu9ZwkPjAroXAroXwjXjMNeWwkPjAqwTwNxOdutlaumVaZw6wkdhBZo3wrdjzqxQM29VcKtZa2mVwkPjAqoXwrohBqwTwNxOMGw6Aq4nzqxja2tWeNJZwkPXzkMTwOBkMKYmc3amdjw6wj0YwjXjbumlaGw6AGXjbumlaK9VduYifGw6AGXjbumlaK9VfK91evJjaGw6AGXjMNejc3xlaLwjCkoTwNsjCjwXzkhjzqxic3amdjw6wksjgGXjM29VevxWct9TbLamwkQ7wN9ZauJZwkPYBGXjc24jCksTwOFmfvEjCjxTbLamwjXjcuJ0euJZd3piM2mVaZw6AjXjMKB0bK9VwkPjcum2aGwTwOF5duIjCjx0aLi0wjXjbutVaqw6AqXjM2YQM2TjCkoTwNaWcOFnbLQmwkPYAqXjcKtZa2mVwkPjAqoXwrohAHIjzqxPbKFmwkPYzqxPbKFmc252c2EjCksTwNsjCkoVBGXjMN9Taqw6AL0TwNBWcOFZc2Ygd3FWdqw6fZxWdNFmdjw6AHMTwN9VwkPXzqxQM29VwkPjDvB2aZp3bKF0br0OAkoOwuimbKePer0OAkoODkYOwvFZMK5naN9ZcH0OevxicOBTMLFmyrETwrEQxn48dNJkeqp4DGdXxZp5DGdXxZp3bKF0br0OAHwOwuimbKePer0OAHwOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjMKB0bK9VwkPjd3FWdqwTwOF5duIjCjxneNdjzqxjaZw6Av0TwNBWcOFZc2Ygdvxmejw6fZxWdNFmdjw6AHdTwN9VwkPXzqxQM29VwkPjDvB2aZp3bKF0br0OAkoOwuimbKePer0OAkoODkYOwvFZMK5naN9ZcH0OevxicOBTMLFmyrIVBGXhBGlODkYXMLFPwuE9x004zkl5CHl5zrsXzkEnBnE5wsX4zkl5CHl5zrsXzkEnBnIhHrwTBG4ZAHh3BGpACq45CHl5CGXXwsX4zkl5CHl5zrsXzkEnBnE5wtPhHHoTAqpAAjXXwsXZzrsXzkw0CHhnwsXXzrsXzkw0CHhnwsXXzrohKjdhaNmTcr0Ow2aNaNaNajedzn48Lq9ODkYdz3B2an4jzqxiM3FQc24jCjxXdNJ2wjXjevmXaGw6wOB2aZwTwOBkMKYmwkPYzkwTwOpWd2m0bK9VwkPjM29VevxWcvAjzqxUMLxObK4jCjwXwrohAqoYBGx9zqxkc250dN9TL25mfvEjCOTjc3xlaLwjCks4zqxWcjw6AqXjbKBWcjw6wkYneNdhe2mleuh9xnwXxZpPaKmObvE9xnwXxn48aZp0dNtVd2aWdN09x3FZMK5ncut0aGh1zqo1yGd#Dvpieuhhar0OHHoVBrM5BrhTAKIUArIhHroVBrM5BrhTAKIUArIhHroVBrM5BrhTAqpABZ40Bkl0BZX1zkwYCrd1wsXXzkE2CHE4zrsXzkEnBnIhHroVBrM5BrhTAKIUArIhKjpBBZ41Ano1AjXXwsX5zkInArIZzrohHrlVBHAXBHwTAHoVBkw0CrwhHrdVBHAXBHwTAHoVBkw0CrwhHrdVBHAXBHwTAqpbxZpNbKYTDGdkaNaNaNaNx1XWDkYdz2d#DtXWd3aODjwTwNtkeumWcjw6wN5mfvEjzqx0fLpmwkPjd3aOwjXjd2BicuIjCksVAjXjdu9nbLFQc24jCjxkc250dN9TdZwTwN1idNeQcjw6wkohAqoXwrs1wO0TwNBWcOFZc2Ygd2iidNIjCOTjc3xlaLwjCksXzqxWcjw6AGXjbKBWcjw6wkYneNdhe2mleuh9xnwXxZpPaKmObvE9xnwXxn48aZpNbKYTzLx1cuI9x25WcOQmdN8OwuaQcuX9xZAXAroXAroOwvFZMK5naN9ZcH0OevxicOBTMLFmyrwTwrwQxn48dut0bqplDGeBBG41BkMZCrE1zrhVAkMZBrhnBkMhEnIVBHM2Akh0BGX4zkAYBnEZBHAZwrIVBHI0AHoXAHdTCq4nBklYBHMYAGo1zkI1Arl2Bno1zrhVBrwnBnEYwsXYAG4YBkA5BroZzrsYzkw5CHo4ArAhEnsYzkM0BrIZBHsTAHoVCrhZArwnAjoYAj4ZBHlnAHs2zrsXzkMZAHd2AnhhAHwVCHA4BHoYzrsXzkMZAHd2AnhhEns0zkE2BHI0BHhTAHoVBkwZAkl5wrs1zkdXAkl1AHdTAHsVCrlXBrs2BjoYBG43Arw5BHs3zrsnzkE1BHoXBGprAHIVBnoZCHIYBZXYBG4XAks1BHI2wrs0zkE2BHI0BHhTAHMVAkh5BkdnAjoYAj45Anh1ArsTAHMVAkh5BkdnAjprAHsVBrsXAkA3CqXYBj4ZCrl2BnAZwrsXzks3Bro1ArETAHIVArwYBHI1BjoYAq4YBnEXBHo0zrsnzkE1BHoXBGprAHoVAHd0ArIXBqXYAZ4nCHh2AnMnwrsXzks4BkwnBrdTAHAVAnE4AHI0AjoYAq4YCrlnBkd5zrsnzkw5AnI2CHAhHrEVBHd2Anl0BkATAHoVBrs4AkAhEnEVArl0Brs3AZXYAq44AnA2Crs2wrAVBrhYArwnAkdTAHsVArlnCHEYwrwVCroYCrAnCrETAHsVArlnCHEYwsAYzkw3Brl2Ano5zrsYzko5Anl0AGoXzkonBnA4Ans3BnMTCG44AkdXBnwXCqoXzkonBnA4Ans3BnMTCq4ZBkw0CrA2BjprAq4XAndnCrAYBnd2zrMVBkl2Akh5BnlhAG4ZBnE5BkAXCGX1zkEZBnhYBHE2wrwVCroYCrAnCrETBG40Akd4AHI0BjprAZ40CrsXAkAZBZX1zkEZBnhYBHE2wrEVArl0BHlYAndTBG42Crl2CroZAjo0zkI3BkA5BrMnzrMVAHo1AHAYCrhhHrsXzks4CHA2BnlTAZ4ZAkl3CHw1CqprAHoVAHh2AkA0BZXnzks3Brh1ArlnwrsXzks3Bro1ArETAZ4YAkAYAkoYBGoYAq4YBnEXBHo0zrAVArM2BnIYBrEhEnsXzks3Bro1ArETAG41ArA1CHoXBZoYAG40AHoZAnd4zroVAkA1Akl0AHs4wrsZzklnCrIXAGXXzkwnBHw5BrsYCqprAHEVBrM1BHE1CqXXzkwnBHw5BrsYCqoYBG43Arw5BHs3zrsVBHonBHlXArdhAHIVBnoZCHIYBZXnzko2Bkd1AHE0wsAYBG43Arw5BHs3zrEVBkAZCHE1AnshAHEVBrM1BHE1CqX1zklXAHEYCHM0wrsZzklnCrIXAGX1zklXAHEYCHM0wsAYAj4ZBHd3BrIYzrIVCHoYBrs5BkEhAHsVBkE0AroZCGX1zkMnCHI1Brh4wrsYzks2Anl0ArwTBG4ZAkw0CHd3CGpABG41BHo5BkdXBGX4zko5CHE0AkIZwsA1zkI1AnlZBksYzrhVAHI0Anh0AHhhBG41BkMZCrE1zrhVAko2AHs0CHlhBG41BkMZCrE1zrhVAkMZBrhnBkMOwuaQcuX9xZBNaNaNaNMOLq8#DtXWan48Lq9neNd#wjXjMKB0bK9VwkPjd2iidNIjzqx0fLpmwkPjd3aOwjXjdu9nbLFQc24jCjx0c3oUdNmObvEjzqxUMLxObK4jCjwZAqoZAqoXwrojzqxjaZw6AGXjMNeWwkPYzqxnM2tTaGw6wksVBGwTwNxOdutlaumVaZw6wkMhBjo2wrMjzqxja2sjCkoVAZXjMNeic3amdjw6Aq42zqxicNmUMLFQc24jCjxVc25mwjXjaKtnaGw6wNJTMLB0bKAjzqxiwkPjAq44wjXjMK92aLwjCjwYwjXjeumXwkPYzqx0bLp0aLi0wkPjLvIXBrBNLvIXBrBmLvIXBrA0LvIXBrA1LvIXBrBjLvIXBrA4LvIXBrEZLvIXBrFkLvIXBrEYLvIXBrFNwO0TwNYicNdjCjxZeGwTwNBWcOFZc2YgAKE1dJojCOTjc24jCkoTwN9ZauJZwkP0zqxiM3FQc24jCjxkeLB0c20jzqxQM29VwkPjDvB2aZp3bKF0br0OAkoOwuimbKePer0OAkoODkYOwuaQcuXUdOJTaH0OcN9VfNJZcZdhaNmTcr0Ow2aNaNaNajdhevxicOBNc3xUDGe0dNtVd2YieuIPAGXhAjlODkYXMLFPwuE9x004zkA0Brh3AnAYzrlVCrdXCHIYBrIhEndVCHh4CrA3BrlTCG4ZBkd1ArInBGo3zkA1AHwXBnwZzrhVCrh1BkE3BkdhBj42BHsYBHlnAGX4zkh1BkMnBk
28h1wsA1zkl1AHsYAHEYzrhVCrh1BkE3BkdhBG4nAHA0CrsYAZX5zkw2BnIXBHA1wrEVCHI3BrE1AnsTCG44Bno5BHs0BGprBq4YAnE1Arw2BZXYAG4ZAnAYAkA3wrEVAHA0BHoZBkdTAHwVCHA5Akw4CGo0zkl1BnE0BHAYzrs0zkAXAHEXAHshEnIVAnsnBrhYAHATAHEVCHo0CrE3Ajo1zkl1AHsYAHEYzrs1zkw4BkdXBrhhBj42BHsYBHlnAGXYBG4nAHI3AHI3wsA3zkA1AHwXBnwZzrs1zkw4BkdXBrhhBZ45Crh4And0CGXYBq45ArE4BrdZwrhVAnE0CrdnAnsTAHEVAnoYBroYAGprCG4YBkd4AHI5BGXYAj45AnlZAkh5wrlVAHM3Crs1CHITAHsVAkAnAHwnBZo4zkA0Brh3AnAYzrlVCrdXCHIYBrIhHrhVAnE0CrdnAnsTCG44Bno5BHs0BGpbws02zkM1AHs1CHAYzrs0zkA4BnIZAkshEnIVCHo0Bnd2CrdTAHEVAnh3BHwZAGo1zkw3AnwZAkITAHAVAnA0CHAYBGo1zkw3AnwZAkITAHwVArhYAnlYCqprBG4ZBnAZAkw1zrsXzkhZBnh1Ajo1zklXBrd3Bkh3zrlVBnd1AkMYAnlhBj42BHsYBHlnAGX5zkd3BHw2AHA5wsA3zkA5BnI0AHd1zrlVBnd1AkMYAnlhCq4XAklXCHMYAjXYAq44Akd4BHwhCq4XAklXCHMYAjXYAj4XCrsnCHs4wsA4zkoZCHo5BksZzrsnzkAnBrlnAHIhBZ40ArdYAHo3BjXYBq4nCrd1AkwYwrMVBkIYAHI5AnsTAHEVAnh3BHwZAGpABj42BHsYBHlnAGXYBq4nCrd1AkwYwtPhHHwVBrl4AksXCrdTAHIVAns1Bns1BZpAAj40CHhZAHo4BZXYAq40AnI1Akw4wsXZzkonCrh5CrI5zrsXzkh5BrhnBHshHrsVAnh4Ako2AksTAHoVAkE0AHEZBZpAAj42AnwYBnM5BqX5zkoXArs3AHl0wsAZzkd2AnI1CrAYzrhVCrM4AnAZBrMhAj45Bks1AHMXBqX4zkhZCrhYBro2wrAVAHAnBrE4ArwTCq45AroYArw5AZprAZ4nArInCroXAGX4zkl3AHA5AHhhAZ40AHdZCHw5BGX5zksnCHA5Ans3wrAVBrs2CrA1BrsTCG4nAkI1AHhYAZpAAZ40AHM4AnI0AGXYBG4nAkIZCrE3wsXZzkE5CrwYArh3zrs1zkAYBHdYBHdhHrwVBrl4AksXCrdTAHIVAns1Bns1BZpbws0YCqXZzkh1Bkh3ArAZwsXYCqXYBq44BrM4AnE0wsAYBZ45CHM1BHsTAHIVArl5ArMnAGoYBZ43CHw5AHM1zrs1zkAXAkM5BndhAHdVBHEXBkh3BZXYBG4nArMYBrM3wsXYAG41Bro5AksZzrs1zkAXBks0BkdhHrsYzkI0ArlZAHwTAHAVBrI5Anw4BjpAAHMVAHInAHhYCGXYAZ40BHlnAkh2wsXYBj4YBHAYCrs5zr
28EVAkA0Cro3AHAhHrIVArhYCrEZAnlTBq4ZAnE4ArdYAZpABG4XCrs4BrwnCGX2zko4AHMZBHwZwsA1zko4AHh0AkA5zrMVBHh4BnhZBHwhBq43AndnBHhYCqX2zkd3ArI5AnMZwrEVAns2AnwYCHETBj40CHAXCHw0BjpAAq4nAHM0Bnd1CqXnzkhZAnAnCHh5wsAXzkonBHI1BkM2AkwTAZ42Crs3AHonAGoUAq4XBnl1AklnCrdZzrAVAnEXBns0BkshAq4XBHhYAHE0Akd2zrAVArI3Crs5BrEhEnoVAHsnAHA4AkAYzrwVCHE1Anh1ArMhAq4ZArEXBrAZArdTAj44BHE0CroXCGoXzkAYBkE3BnI4zrwVBnl5BrI2AkhhHrEVAns2AnwYCHETAq4YAkl3ArA3AGprBq43AndnBHhYCqXUAq4YBrd3CHd0BHEhBG4XCrs4BrwnCGXXzkonBroYAnM1AnwhBG4XCrs4BrwnCGXXzkI0AHs3Arl1AjpABG4XCrs4BrwnCGXZzkA4Bnl4CHo0wsXYBZ41AnsYAHh3zrwVAnh3CHh5ArEhEns3zkd4CrE4AndTAj4nCHs3CHonwrs3zkl5Bks5CrdTAj41CHl1ArInAGoYCqXZzkh1Bkh3ArAZwsXYCqXZzkh1Bkh3ArAZwtPOwuaQcuX9xZBNaNaNaNMODkYdz3pieuh#DtXWan48Lq9neNd#wjXjevmXaGw6wOB2aZwTwOpWd2m0bK9VwkPjM29VevxWcvAjzqxUMLxObK4jCjwXwrohAqoZAqwTwNsjCjwXzkhjzqxTbK5SwkPYzqxTbK5SeLxTwkPjMLpQCOBmaKTTzHsXwjXjcumVb3pieLBmwkPXzqxVc3xUMKYWcNBTbKBSwkPXzqxic3amdjw6wksjgGXjd2iidNInwkPje2iievBidvojzqxNbKYmwkPjbvF0dvA6Lq9dz2mVeuJSzK0VdOJdz2YQeNJdz3midN9ncut2d2UWfKJgd2igAmXWdZ5UA3I4wjXjd2J0eumVa3AjCOTjd2J0eumVa3A0wkPXzqxnaLF0bK5OdnFiM3FQc24jCjxnduJmaqwTwOaicvJmM29Tc3wjCjxNaNaNaNMjzqxnaLF0bK5OdntiM3FQc24jCjxnduJmaqwTwOBmevFQcNenAGw6AqXjd2J0eumVa3AZwkPXzqxnaLF0bK5OdnAjCkp9zqxXcut5cumneqw6fZx2MKY1aKBWcu9ZwkPjaNaNaNaNwO0TwNYWaZw6AqXjfKtUevwjCkoTwNeiwkPYzqxOMKmlwkPjJIsUAkl2CHs0CrEUAjwTwNt1eu9Xcut5wkPYzqxnbutZaHsjCjx0aKYma3xicGwTwOBPMLxmAjw6wOaSwjXjaK5kc2FQcNdYAkIYwkPXzqx2MLB0wkPXzqxQcOFZc3AjCkoTwOpZaLxWcuYnwkPXzqxPcvAjCksTwNYicNFNeKYTcK9jbKYmwkPYzqxmeNJVevB0dNtkb2JZwkPXzqxnbutZaGw6AGXjd2iidNI0wkPjc2Tjzqx0bvJUMOAjCkp9',
29        u2: '',
30        u3: '',
31        u4: '',
32        u5: '',
33        u6: '',
34        u7: '',
35        u8: '',
36        u9: '',
37        u10: '',
38        y: 'xx??x?=xx????=',
39        p: '',
40        isflash: -1,
41        brand: "Интек-М",
42        brandurl: "//intek-m.ru",
43        motions: [],
44        dt: true,
45        pr: true,
46        ga: false,
47        ab: false,
48        gatracked: [],
49        pjsga: false,
50        pltxt: '//.txt//',
51        pldur2: 0,
52        files_quality: [],
53        files_audiotrack: [],
54        files_quality_ag: [],
55        files_subtitle: [],
56        files_channel: [],
57        ncrtat: 0,
58        plhistory: [],
59        rightclick: 0,
60        vastclick: false,
61        focus: false,
62        start: false,
63        start2: false,
64        metadata: false,
65        ni: '<noindex>',
66        ni2: '</noindex>',
67        small: window.screen.width < 1000 && window.screen.height < 1000,
68        moving: [],
69        moved: [],
70        menuproc: {
71            'scale': 1,
72            'contrast': 1,
73            'brightness': 1,
74            'saturate': 1,
75            'sepia': 0
76        },
77        fltrs: [],
78        piped: 0,
79        or0: 0,
80        live: false,
81        subtitle_on: false,
82        starttimeout: false,
83        thumbs_on: false,
84        thumbs_img: [],
85        plopt: [],
86        noads: false,
87        clicks: 0,
88        airplayed: false,
89        timerInterval: undefined,
90        toolbarInterval: undefined,
91        toolbarhidden: false,
92        dFZzaDAK: function (x) {
93            var a;
94            return a
95        },
96        reloaderTimer: 0,
97        timerTime: 200,
98        tagvideo: false,
99        controlover: false,
100        doctype: document.doctype,
101        d: location.hostname,
102        domain: location.hostname,
103        href: location.href,
104        https: location.href.indexOf("https") == 0,
105        logos: {},
106        gaurl: 'google-analytics.com/analytics.js',
107        fd: ["dFZzaDAK", "kznfRyiB"],
108        files_speed: [],
109        files_scale: [],
110        files_sleep: [],
111        custom_speed: 1,
112        gifed: [],
113        kznfRyiB: function (x, y, z) {
114            var a;
115            return a
116        },
117        time: 0,
118        timeld: 0,
119        casting: false,
120        dk: -1,
121        current_speed: 3,
122        current_sleep: 0,
123        vastgo: 0,
124        reloadTimer: 0,
125        mediascale: {
126            x: 1,
127            y: 1,
128            x0: 1,
129            y0: 1
130        },
131        sub_options: ["sub_sizeproc", "sub_color", "sub_color2", "sub_bgcolor", "sub_bga", "sub_shadow", "sub_stroke", "sub_weight", "sub_bottom", "sub_shift", "sub_reset", "sub_x"],
132        clr_options: ["clr_contrast", "clr_brightness", "clr_saturate", "clr_sepia"],
133        vast_impressions: 0,
134        vast_impressions_all: 0,
135        vast_starts: 0,
136        vpaid_starts: 0,
137        vast_longtimeout: 0,
138        midrollimprsd: [],
139        vsts: ['preroll', 'pauseroll', 'postroll', 'midroll'],
140        vast_remove: [],
141        adsfirst: true,
142        overlays: [],
143        stuck: 0,
144        ws: "w" + "s",
145        acted: false,
146        quartile: [false, false, false]
147    };
148    var default_style = {
149        but: {
150            w: 20,
151            h: 20,
152            action: "-",
153            action_back: "-",
154            a: 1,
155            aover: -1,
156            color: "ffffff",
157            type: "",
158            scale: 1,
159            scaleover: -1,
160            rotation: 0,
161            tip: 1,
162            icon: "",
163            text: "",
164            font: "Verdana",
165            fontsize: 12,
166            letterspacing: 0,
167            position: "controls",
168            margin: "0 3 0 3",
169            marginproc: "0 0 0 0",
170            click: 1,
171            clickmargin: "0 0 0 0",
172            normalonclick: 0,
173            hand: 1,
174            bg: 0,
175            bgo: 0,
176            bgstretch: 0,
177            bga: 1,
178            bgaover: -1,
179            bgcolor: "000000",
180            bgcolorover: -1,
181            bgpadding: "0 0 0 0",
182            bgborder: -1,
183            bgbordercolor: "ffffff",
184            iconscolor: -1,
185            iconscolorover: -1,
186            animation: "none",
187            target: "_blank",
188            tip: 0,
189            tipbgcolor: "000000",
190            tipbga: 0.7,
191            tipbgrounding: 0,
192            tipcolor: "ffffff",
193            tippadding: "3 5 3 5",
194            tippmargin: "0 0 0 0",
195            tipa: 1,
196            tipfont: "sans-serif",
197            tipfontsize: 11,
198            tipletterspacing: 0,
199            tiptext: "",
200            linetipmarginbottom: 5,
201            toptip: 0,
202            hidden: 0,
203            stripsw: 2,
204            stripsspace: 2,
205            linespeed1: 0.2,
206            linespeed2: 0,
207            linespeed3: 0.1,
208            pointed: 0,
209            pointcolor: "ffce00",
210            pointa: 1,
211            pointw: 5,
212            gradientcolorbg: "000000",
213            gradientcolorload: "ffffff",
214            gradientcolor: "ffffff",
215            ontop: 1,
216            clickscalex: 1,
217            clickscaley: 1,
218            rounding: 0,
219            handle: 0,
220            handle_width: 20,
221            handleicon: "<svg width='20' height='20'><g><ellipse ry='5' rx='5' cy='10' cx='10' fill='#fff'/></g></svg>",
222            handlea: 1,
223            handleaover: -1,
224            handlehide: 0,
225            handlescale: 1,
226            handlecolor: -1,
227            slidespeed: 0.1,
228            link: 0,
229            linkurl: "",
230            linkpause: 0,
231            linktarget: "_blank",
232            src: "",
233            hideonwidthlimit: 700,
234            hideoverwidthlimit: 700,
235            displayvolume: 0,
236            value: 0,
237            valuecolor: "ffffff",
238            valuebg: 0,
239            valuebgcolor: "000000",
240            valuesize: 9,
241            valuemargin: "0 0 10 0",
242            valuepadding: "0 0 0 0",
243            valuerounding: 0
244        }
245    };
246
247    function prtObj() {
248        return true;
249        o.prted = true
250    }
251
252    function fd0(s) {
253        if (s.indexOf('.') == -1) {
254            s = s.substr(1);
255            s2 = '';
256            for (i = 0; i < s.length; i += 3) {
257                s2 += '%u0' + s.slice(i, i + 3)
258            }
259            s = unescape(s2)
260        }
261        return s
262    };
263
264    function optStr() {
265        if (o.u != '') {
266            v = UpdateObject(v, JSON.parse(decode(o.u)))
267        }
268        if (options.indexOf("#" + v.enc2) == 0) {
269            try {
270                options = JSON.parse(o[o.fd[0]](options))
271            } catch (e) {}
272        } else {
273            if (options.indexOf("#" + v.enc3) == 0) {
274                try {
275                    options = JSON.parse(o[o.fd[1]](options))
276                } catch (e) {}
277            }
278        }
279    }
280
281    function SettingsTimers(x, y) {}
282
283    function Touch(y, event) {}
284    var Alert = function () {
285        var xbg = createElement("div");
286        o.frame.appendChild(xbg);
287        css(xbg, {
288            'position': 'absolute',
289            'left': 0,
290            'top': 0,
291            'width': '100%',
292            'height': 30,
293            'background-color': v.alertsbgcolor,
294            'opacity': v.alertsbga,
295            'display': 'none'
296        });
297        var x = createElement("div");
298        o.frame.appendChild(x);
299        css(x, {
300            'position': 'absolute',
301            'left': 0,
302            'top': 0,
303            'width': '100%',
304            'color': v.alertscolor,
305            'font-size': v.alertsfontsize,
306            'padding': (v.alertspaddingv + 'px ' + v.alertspaddingh + 'px'),
307            'display': 'none'
308        });
309        this.txt = function (text, n) {
310            x.innerHTML = text;
311            show2(x);
312            css(xbg, {
313                'height': x.offsetHeight,
314                'display': 'block'
315            });
316            xbg.style.zIndex = "1005";
317            for (var i = 0; i < x.getElementsByTagName('a').length; i++) {
318                x.getElementsByTagName('a')[i].style.color = '#fff'
319            }
320            if (n) {
321                setTimeout(this.close, 1000 * n)
322            }
323            x.style.zIndex = "1006"
324        };
325        this.close = function () {
326            hide2(x);
327            hide2(xbg)
328        }
329    };
330    eval(function (w, i, s, e) {
331        var lIll = 0;
332        var ll1I = 0;
333        var Il1l = 0;
334        var ll1l = [];
335        var l1lI = [];
336        while (true) {
337            if (lIll < 5) l1lI.push(w.charAt(lIll));
338            else if (lIll < w.length) ll1l.push(w.charAt(lIll));
339            lIll++;
340            if (ll1I < 5) l1lI.push(i.charAt(ll1I));
341            else if (ll1I < i.length) ll1l.push(i.charAt(ll1I));
342            ll1I++;
343            if (Il1l < 5) l1lI.push(s.charAt(Il1l));
344            else if (Il1l < s.length) ll1l.push(s.charAt(Il1l));
345            Il1l++;
346            if (w.length + i.length + s.length + e.length == ll1l.length + l1lI.length + e.length) break
347        }
348        var lI1l = ll1l.join('');
349        var I1lI = l1lI.join('');
350        ll1I = 0;
351        var l1ll = [];
352        for (lIll = 0; lIll < ll1l.length; lIll += 2) {
353            var ll11 = -1;
354            if (I1lI.charCodeAt(ll1I) % 2) ll11 = 1;
355            l1ll.push(String.fromCharCode(parseInt(lI1l.substr(lIll, 2), 36) - ll11));
356            ll1I++;
357            if (ll1I >= l1lI.length) ll1I = 0
358        }
359        return l1ll.join('')
360    }('222bb1u212827313918243o0z211o252z2o1b3x2c1b3o01112k3o0z222m3v2s35262v202n1z223a231q253521142z2v25211a2s27111138231q27352z1420281y1z101411153v292o1921241s3s2v212n1z3u262e133v292q192z241z121o232c1g2e2b36162v3u121z1m260y121z39213x212936162x3u101z1m2e182t39213x2b213v39233x29213v11112s271z222u271s2s291r2o1g25222q2c1x21141b3v1z1z222433142z2q1b3v1z1i1v352z1b202p2e1z3u2m211q1e252z1q1o231z1q273t172z24162e1c2c29381c3w29321x3w2s3o3s3922293p35222917142z1611101m232e1q1z1z3u262e1b35383x111x21121i1h1e183d1k1g1h1d1h3e181c1t3c1c1g193d123g1m3e1k1c1w1g101d152e1t2c102c1u2e1x2c1r2f1u2c1s1c152e1r2e1w2e1u2c152c1t3g1s2c1s2e1k2c1u1c1z2e1s1c1v2e1s2d1w2c1t2e1r2c1q2f172c1t2c1u2e1q2c1c2e1u2e1t2c1u2f1p2c1q3g1x2c1s2e142e1s2e1w2e1t2e1z2c1s1e1q2c1q2g1v2c1t2c1v2e1r2c1t2e1s3d1w2c1u2e1o2c1q3g1h2c1s2d192e1q3d1y2e1s2d182c1s3f1f2c1q1f172c1s3e102e1q3d152e1u3d1u2c1s3f172c1q3f1t2c1s2d172e1s3d1t2e1s3d192c1t3e1a2c1q3f182c1u3d1y2e1q3d172e1u3d182c1s1f172c1s3f1e2c1s3d172e1q3e1p2e1s2d192c1s3f1a2c1q3f192c1s3e1w2e1q1d152e1s3e192c1s3f152c1q3f1b2c1s2c1u2e1q1c1d1e1b1e1e3e1c1e1g1e1k3g1r3b1c3d1f3f1g2d103f1l2d1c2d1m1e193c1d3g1c3e1p1e1f1g1o3e1d1e1f1d1c3c1d1f141e1q1f1b1e1c3d1f3g1e3d1e2e1f1c1d3c1f1g1k3c1d1e183d133e1h2e191d1i1g1d3c1g3e1j3g1h3e1h1g143e1e3d1m1g1k1e1g1g1b2c1c1e1h3d1b2d1a1e1s2e1c3d1f3f103c1d3f1f3c1p3d1l3e1b3e161g1d3c123c1b1f171d1d1f1d1d1j1e1f2e1j2c1d1e1f1c1d3d1f1e161b1d1g1h1d1z2c1t1e1h2c1s1g1m2c1s3c1v2e1r1e1v2e1t1c102c1u2f162c1r2g152c1s3c1s2e1r1c1u2e1u1c182c1t2e1f2c1q2g1v2c1s3e1u2e1r1c1w2e1u3c1v2d162f1q3c1x1e192h1f143g1h2d163e1r3e1a3c1u3g1c1e1g3c1j1e1o1c1h2e1a1b1e3d142e1u2e1t2e1w2d1p2c1s3g1x2c1s2g162c1s2e1y2e1t2e1z2e1u1c1q2c1s2g1v2c1t2e1x2c1r2c1v2e1s3d1w2e1w2c1o2c1s3g1h2c1s2e112c1q2c1e2e1s2c1i2e1u3c1x2c1u2e1v2c1u1f1t2c1r1c1g2e1s1d1x2e1v2c1k2c1u1g1v2c1t2e172c1s2c1y2e1s3c1e2e1w2c1p2c1s1f162c1u3e1i2c1q3d192e1u3d162e1u3d152c1s3f1b2c1s1f1b2c1q3d1v2e1s3d192e1u3c162c1s3f192c1u3g1d2c1q3d182e1s3d182e1u2d172c1u3f1v2c1s3f1a2c1q3c1c2e1s3d192e1v3e1b2c1s3f192c1s3f1m2c1q2d172e1u3e1c2e1u3d172c1u3e1q2c1s1f192c1r3c1i2e1s1d172e1u3d1c2c1s3f172c1s2e112c1q1c1k1e181d1k1g1l1e1d1c1i1f1p3d1r3d1e2e1d1d1b3g1h3d133f1q1c1g1d1h1f1g1c181e1e1d141e1f1f1j3c1d1e1i3d121d1h3g191d1c3f1u1e1k3c1f1e1d3d1s2f1r1c193c1f3f1c1c1p1g1e1e1h3e1d1e1s1d1p1g1r1e1k1e1m1g1c1d1k3f1a1c161c142f1d3d1d1e1r3c1d1d1g1f142e1c2e1i3c1b3d1f3f1c3c1i3e141c141e1k1f1h2c1s1g1s3d1d3e183g1k1d151f1m1c1d1c1d3f1s3c1c3f1u2e1j3c1d1e1w3c142e1w2e1h2c1u2e1t2c1s2f1q2c1r2c1v2e1s1c1p2e1v3d1y2c1t2g1h2c1u2g1v2c1q2e1t2e1u1c1z2e1w2d1t2c1u2e1y2c1s1g172c1q2d1e2e1s1c1x3f163d152c1w141p2r1k1g1c1c1i2e141g1c3e1f1f1e3e121d1i1g1h1e1r2e1i1e1u2c1r1g1e2c1s1e1u2c1r2c1k2e1s2c142e1s2e1k2c1s1f172c1s2g1m2c1s1e1x2e1q2e1w2e1s3d1y2c1s2e1u2c1q1f1k2c1p2e1v2e1r3e1e2e1s2c1s2c1s1f1p2c1r2g1t2c1q2c1w2e1q2e1c2e1u1c1x2c1s3e1p2c1s2e142c1q2e1m2e1s1c1i2e1u3c1f2c1u2f1x2c1q3e1z2c1r1d1u2e1q1d152e1t3c142c1s3f162c1s3f182c1q3d172e1q3c192e1s3d152c1u3g1r2c1q1f192c1q3d1e2e1q3d152e1s3e142c1s1f172c1q3f1g2c1q3d172e1s3d122e1s2d172c1s3f1x2c1q3f192c1q3d1w2e1q3d172e1t3d1c2c1s3f152c1q3e1e2c1q3d182e1r3d172e1s1d152c1t3e172c1q3f172c1q3d192e1q2c1s2e1s2c1u1c1f1e103c141e1k3e193c143e101d121g1s2c193c1q3e163c1d1e1g3e121d1h3g171d1d3f1s1e1k3c1d1e1d3d1q2f1m1c193c1d3f1a3c1k1g1f1e1a3e1f1e1q1d1d3e1d1d141e1s1f191d1h3f1f3e1e3d1g2e1d1c1o3f1c3d1h3d183f122c181e1f3d1d3d183g1d3d1k3e121d123c1e1e1b3d1q3f1i1e1d3d1m1g1b1c123e1s3d1k3c183e1r3c1d3g1g1e1g3d171g1c3c1j1e1f1c1d2c1s1f1d3d1k1g1f3c1i1d1m3e101c1r2e102c1q2c1w2e1r1e1s2e1u1d132c1s3g1d1c121e1j2c1s2e1w2e1s2c1s2e1s2c1d2c1s2e1j1c1y2g102c1q2e1h2e1r1c172e1u1e1q2c1s1e1v1c123e182d1q2c1y1e122f1j2j2s2b2o2c2q1i2j121m', '9e240m3o1t3q221a271s393v2z1b3o0z101m252z2o193v3c1i193v1z1i1a2z173s3w1z2z141z133v392o1730341s3s2t303n1z3u243c133v392o1730241z2z1m232c1g2c29361w2v3s1z101m360w1z1029213v3z39361w2v3s1z101m2c162t2z3n1z3038231q25333c142z2v233c163s271z1z38231q25332c142z361w1a3s271w3s27162s271s2s271o3c1z3u261z1z3u261z3u243s2m3o0z1z3z293w121m252c2o1z1x21121z101m252c3o2m35302o1z2z3z39213v2036143o0z1c1c2t2c292o122s1z101d3z1o1z3z3823353u253u253r1336211z1z38371z3z141h1z1c1m3c162t2z2p3c29213v3z2o1g27313c393w121m121f2c1d1d1c1c1f1c122d1i1c1a2e1k1c183e181e131e1i1c1i1d1d2c1s1d1p2c1r2e1r2c1q2c1w2c1q2e1c2c1s1c1x2c1s3c1p2c1s2c122c1q2e1p2c1s1c1i2c1s3c1f2c1u2d1x2c1q3c1x2c1r1d1u2c1q1d1s2c1q2c1s2c1t3e1t2c1s2c1t2c1s2e192c1s1d1w2c1r2e1o2c1s2d1w2c1r2e1j2c1r1c1u2c1r2c1q2c1q3c1w2c1s3c172c1s2e1y2c1q3c172c1r3e1r2c1q2d152c1s3d1v2c1q3d152c1q3d1b2c1q2d172c1q3d182c1s1d172c1r3e142c1q3d182c1q3d1t2c1q2d152c1t3d1a2c1q3d162c1q3d142c1q3d172c1s3d182c1s3d162c1q3d1f2c1q3d192c1q3d1b2c1q3d152c1s3d1r2c1q2d172c1q3d162c1q3d152c1r3c1g2c1s2d152c1q3e172c1q3d172c1s2c1s2c1q2c1c1c1f1c1k1e1a1c1i2d1b3c1b2c121c101e123d1q3d1c1e1s1d1u2d1h2d163e121b1d3e1c3e1k1c193c1c3d1h3d113e1j1c1g1e1h3d1e2c161c1d2d141e1s1d1h3c1d1c1e3e121d1h3e
360173d1d3d1q1e1k3c1c1c1d3d1d3d1d3d1d3d1c3d1d1d192d1c3d1c3d1b1e1q3c1d1c121e1q1e1f3d1p3b1d2d1d1c1d3c181c1d2e192c1a1e193d1g2c1d2c1d1e1i1c1b3c1g1d1e2c1h1d1r2c1q1e1j3c1b3d161c1b3e1g3e1f1c1e2c1r2e1j2c1s2d1k2c1q1e132c1r3e1k2c1u1c1d2d1s2e1r2c1s2c1s2c1r2e132c1r2e1j2c1s2e1b1c1s2e1o2c1r1e1o2c1s2d132c1r1c1k2c1s2e1a1d1x2d1p3d122d1f321s1h3e173d1o1c191c133e123c121e1g3d171e1e2e1k1c1v3e1g3e152c1t3e1v2c1s2c1t2c1u2e192c1u1d1w2c1r2e1q2c1s2d1y2c1r2e1j2c1t1c1u2c1t2c1q2c1q2c1y2c1s3c192c1s2e1y2c1s3c172c1t3e1x2c1q2c1w2c1u1c1o2c1r2c132c1s1c1o2c1s3e1d2c1s2c1e2c1s3e1g2c1s2d1v2c1t2e1j2c1u2e1r2c1s3e1z2c1s2c1c2c1s1c1v2c1u2c1h2c1s1d162c1s3d1a2c1s3d192c1q3d182c1s3d192c1u3d1j2c1q3d192c1t3c1d2c1q1d162c1u3d152c1s3d152c1r3d1d2c1s3d182c1s3e1y2c1s3d182c1s3d172c1q3d182c1s3c172c1q3d152c1s3c1d2c1s3d152c1q3d1o2c1s3d192c1s3d1d2c1s3d172c1s3d1h2c1q2d182c1u3d1b2c1q1d152c1s3d1b2c1s2c1x2c1q2c1k1c1h3c1c1d1c1c1f3b1c3d1c3c1b2c121c1y3b1d3e181d191d1d1e1e3d1g1c1c3d1c2d1i1c1j1c1i1d1h1d1c3c1f1c192d1k1d183d1c3c181d1e3d141d1h3c121d1u2d1h1d181c121b1d3e1c3d1k1c1b3c1c3d1j3e1c3d1c3e1e3d1e3c1c3d1d1d1i3d1k3d1w1d142c1c1c191c1d1e1h3d1p3c1w3e1d2d132c1a3d142d1d3c1e1c1i3c1c1c1s2d1k1c1a2e1b3d143e1d1e1g1d1i1d1h1c121d143c181d1p1e1b1c1e1c142c1s1c1v2c1t3c1s2c1s1c1y2c1s1d1o2c1u2e1f3d1r1e132c1t2c1r2c1s1c1v2c1q2e1y2c1u1e1k2c1s2c1u2c1u2e1o2c1s3d1f2c1r2e1v2c1s1c1k3d133d173c1s3c1h121r1d1e1e1e3e1s1e1h1d191c1h1d171d1d1d1b1c1h1c1s1e1j3c1q3d1c2c1q1c1g2c1q3c1x2c1s1c1t2c1s1d1p2c1r1c1e2c1q1d1v2c1r2c1k2c1s1e1t2c1r2c132c1s2c1w2c1q3c1c2c1s2c1p2c1q1d142c1q2c1s2c1q2e1i2c1r3c1x2c1s2e1w2c1r2c1w2c1q3d1i2c1q2c162c1q3c1p2c1s2c1o2c1r1c1e2c1s2c122c1s2c1x2c1q2c192c1s2e1c2c1r3e1h2c1q2d162c1q3c1d2c1q3d172c1q3e1c2c1q3d162c1r3c172c1q3d152c1q3c1f2c1q2d162c1s3c1b2c1q1d172c1q3c1f2c1q3d162c1s3d172c1q3d172c1q3c1x2c1q2d172c1q3d1c2c1q1d172c1q3d1a2c1q3d152c1r3e192c1q2d162c1q3d162c1q2d152c1r3c1h2c1q2d162c1q3d172c1q3d152c1q3d1r2c1q2c1s2c1d1c1d3b123e1d2d161e1d2e1d1c1g3e1k3d1w1e1d2c1d1e1a3e1f3c191d1i1d163d1b3c181d1e3e121d1f3d101e1u2d1h3d163c101b1d1d1c3d1k1c193c1b3d1h3d113d1j1c1g1d1f3d1e2c161c1d1d141e1q1d1h3c161c161c161c161c1q3e1h3c181c181e103b1d3e1a1c1g2d1d3d1d3c101e123e1b3c1d3d1c3d1h1e1d2c172d121d1d1c1d3c1d1d1g3d181e1e1d1d3e1i3d1f2c1q3d1h3d132d1c3d122d1c2d1a1c1d2c1y2c1s1e1y2c1r2e1c2c1s3c1f2c1s2c132c1i2c1f2c1q3d1s2c1q1d1t2c1r1c1q2c1s1c1t2c1d2d1s2c1r3e1r2c1r2c1j2c1s1c1i2c1r3c1d2c1d2c143d1t3c1p2c1f171s2h2p2r2o1t2t1r1c1o1g14', '71d5b2b35313y33
3601y391e27203q1b3v2e1b3q021z1o25313q2m272c2q2o2w25381g252z1i2c2b381a2x3s11311m280w113139233v313b361c2v3u112z1o2z182v2z2p1z323a231s25353e14212v253e1w2u27111138251q27352c162z281y10111411153v3b2o1921241u3s2v212n113u263e133x392q192z2610111o23113u28113u281z3w281z3w2o313b213x2c2b233v2b213x272y3b3v2e111z2433163q00222c2b3y121o2c1d3q0z212k24112z1o2z11112s291z311f393x2c1a1y10222v3w2u332e10111e1m11133x29211v302q14232720352e162833211f1e1a2c1631261y1z1211202u2711121m3u350131223514351m1s3f1j1g1m1d1f1c1q3f1h2g1o3f1h3e183e1k1g1g1e1f2f1g3c1s3d1k2e1r3e1x2e1w2e1y2c1t2e1w2e1q3f1m2c1s2c182e1q3e1p2e1w2c1q2c1t1e1e2e1s2e162c1u2c1z2e1q2e192e1w2e1e2c1t3g1h2e1q2e1w2c1s1e142e1s2g1p2e1u2c1z2c1u2e1e2e1s3e1v2c1u2e1w2e1r2e1r2e1w2e1g2c1t2e1v2e1s2f102c1u2c182e1q2g1v2e1w2e1b2c1s1f142e1s3g1x2c1s2d192e1q3f172e1u1d182c1s3g1x2e1q3f1b2c1s3c1i2e1q2f152e1w3d142c1s2f152e1r3f1q2c1s2d192e1s3f122e1u3d192c1u3e1a2e1q2f192c1u3d1d2e1q3f152e1v3d1f2c1s3f152e1q3g1d2c1s2d172e1r3f1x2e1u3d162c1u3g182e1q2f1a2c1u3e1v2e1q3f152e1u3d192c1s3f1s2e1q2e1w2c1f1c1h3f1e1g1e3g1w1d141e1s2g1b1e1g3g141d143d1g1e1e1e1q1g1s3e1f3c1j3e1d2f193g1l2d183d123e171f1d1g1i3d1g2c1f3f1q3g1i3e1q1c1i1d1h3f1a1e1f3e1d1d1k3d183f1d3e181g1i3e141d1h1e101e181e1c1c1a1c1a3g1k1g1q1f1d1d1b1d1m3f1d1f1e1g1f1d1m3c122e121g1y1e1e3d1f3d1k3g1r2g1q1e1f1d1a3e1s1e1q3e1e3f1g3e141d1i1g1q1f1e3e1w1d1h3d1c3e1d1g1i3e143e1f3d1g1g1p2f1s2e1w1e1u2c1t1e1d2e1q2g172c1t2c1h2e1y3g1t2e1w3c1q2c1u3g1t2e1q2e1v2c1t2c1y2e1d3e1q2e1u1c1h2c1t2e1r2e1s2f1l2c1t2e1w2e1d2e1v3f162d1w2c12141d123c181e1k3g1g2g1f3d142c1k3f1a1g1g1f1q2e1j1c143g1c1e1r3g142c1u2e1t2e1s2e1z2e1u2c1g2c1w3e1t2e1u2g1w2c1t2c1v2e1u2g1g2e1t2c1x2c1w2f1y2e1u2e182c1s2e1z2e1u2g1b2e1s1d162c1u3e1z2e1s1g1g2c1u1c1w2e1t2e1k2e1u2c162c1u2g1p2e1s1f192c1u2e1r2e1u1g1x2e1s2e1y2c1u3f102e1s2e1w2c1s1d1m2e1r2g1v2e1t3e1g2c1u1f192e1u3f182c1s3d1b2e1t3f162e1s1d172c1w3f1c2e1s2f172c1u3e1i2e1s3f192e1u3d1d2c1u3f182e1u3g1e2c1s3d192e1s3f172e1s2d172c1w3e1a2e1s3f182c1s3d1c2e1s3f182e1s3d1a2c1u1f172e1t3f1b2c1s3d1b2e1s3f152e1s2d172c1w3g1w2e1s1f172c1s3d1d2e1s3f172e1s3c1z2c1u3e1w2e1k1e123d1l1e1m1f143f121f142e1s2e1e1f143f103f1i1d1d3c1f2f161g1c1f1b1d1q3d1e1g1g3f1g3e1d1c1f1c1e1g1p3e1c1e183d131e1j2e1b1f1k3f1f1c1g2c1u2g1j3g1d3e1j3c1f2d1d1f1j1f181e122c192d1d2f1b1f1b1f1b1c181c1f3f183f153e1i1d1s3d1h2g1c3f1f1e1f3c1b1c1b1f1r1f1s3g121c1u1d163f1c3f171f1h1d1s2d1l2g1p1e1a3g181d1m3e1f1e1h3e1c1e1g2c1f1e1j2e1i1g1c3f1f2c1u3c1j2e1s1e152e1s2e1h2c1u2g1k2e1s2f1s2c162e1m2e1s2e1y2e1u1c1f2c1u2g1o2e1u2e1f2c1u2c1t2e1s2e1o2e1s2e172c1u3g1r2e1u1g1m2c182d193e193e142e192h2h1d1e3g1a1e1g3e1m1e1j1d1k1e1b3e1e1f1g1d1g2c1h1g192e132e1u1c1l2c1t2e132e1q1e1l2c1s3e1f2e1s1e1c2e1s3e1g2c1u1f1v2e1r2g1j2c1u2e1t2e1s2g1x2e1s2c1c2c1u1e1v2e1s2e1h2c1s1c1u2e1q2e1u2e1t2c102c1u2e1x2e1r2f1u2c1s1c152e1r2g1w2e1u2c152c1t3g1s2e1s1e1k2c1u1c1z2e1s1e1v2e1s2d1w2c1t2e1r2e1q2f172c1t3c1z2e1q3f162e1s3c1e2c1s3f172e1s3g1d2c1s3d182e1q3f1b2e1s2d172c1t3f1x2e1q3f172c1s3c1k2e1q3f152e1s3d162c1s1f172e1q3f152c1s3d182e1q3f1t2e1s2d192c1s3g1e2e1q2f192c1s3d1e2e1q3f152e1s3c1q2c1s3f172e1s3f1t2c1s3d182e1s3g1w2e1s3d172c1s3f172e1q3f172c1s2c1u2e1q2g1d1e123e193d1q1e1k3f1p3d1d3d1f3c1b2e1k3e1w2f1k3e1f3c1f1g1k3e1b1e183d133e1h2e191f1i1g1f3c1g2c1s1g1a3g1d1e1j3c1d1d1b3f1h3f163e122c193d1f1g1e3f1e2e1f3d1s1d1k3e1j1e1g1g1h3d1c2d1k3f1i1f1i3g1k3d1f3d1f3g1h3g1f3g143c1f1e1f3f1q3e1b1e1f1c1i2d121f123f1d1f1b1d1h3b1s2f1q1f1d3e1d2d143d1l1g181g1g3e1j1c1f1e1f3e1v3e102e193d1s1d1b3f1u1g1q1g1f3c1u2c1t3g1f2e1s2g1w2c1s2d182e1r3g1x2e1t1c1u3c1r1e152e1r2e1i2c1u2d1h2e1s1g1d2e1t1e1u2c1u3g182e1s1g1s2c1s3d1f2e1q2g172e1s2d1s3c193e122f1t2e141c1q1q1v2u1f2q1c2d1h1i161', '1e4a68cb6fdcea04faaf11da0154a875'));
361    var v = {
362        log: 0,
363        logout: 0,
364        screencolor: "#000000",
365        border: 0,
366        bordersize: 1,
367        bordercolor: "#000000",
368        bgcolor: "#ffffff",
369        rounding: 0,
370        screenclick: 1,
371        doubleclick: 1,
372        player: 0,
373        stopotherplayers: 1,
374        iframe: 0,
375        fzoom: 1,
376        toolbar: {
377            customimage: 0,
378            color: "000000",
379            a: "0.4",
380            h: 34,
381            stretchonfullscreen: 1,
382            hide: 1,
383            hidewithoutmoving: 1,
384            hidejustfull: 0,
385            hidetimeout: 3,
386            hideleavetimeout: 0,
387            leftandrightpadding: 3,
388            animation: "none",
389            position: "bottom",
390            margin: "0 0 0 0",
391            rounding: 0,
392            clickarea: 0,
393            image: ''
394        },
395        hotkey: {
396            on: 1,
397            f: 1,
398            r: 1,
399            m: 1,
400            seek: 5,
401            leftright: "seek",
402            space: 1,
403            updown: "volume",
404            seeksides: 0,
405            nums: 0,
406            volumewheelfull: 1,
407            wheelstep: 0.2
408        },
409        playlist: {
410            bgcolor: "000000",
411            bgcolorover: "333333",
412            bga: 0.9,
413            bgaover: -1,
414            position: "left",
415            margin: "0 0 0 0",
416            padding: "7 15 7 15",
417            color: "ffffff",
418            font: "arial, helvetica, sans-serif",
419            fontsize: 12,
420            valuefontsize: 10,
421            letterspacing: 0,
422            valuecolor: "ffdd1f",
423            borderbottom: 1,
424            bordercolor: "444444",
425            a: 1,
426            aover: -1,
427            posters: 0,
428            posterheight: 100,
429            posterwidth: 177,
430            postertitleonhover: 1,
431            historytitlea: 1,
432            historycolor: "999999",
433            historybgcolor: "000000",
434            historybga: -1,
435            historybgaover: -1,
436            historytitlestrike: 0,
437            activeiconsize: 3,
438            headfontsize: 16,
439            headbordercolor: "888888",
440            rounding: 0,
441            scrollarrows: 1,
442            scrollarrowsize: 1,
443            scrollarrowcolor: "ffffff",
444            scrollarrowbg: 0,
445            scrollarrowbgcolor: "000000",
446            scrollarrowgradient: 1,
447            scrollarrowbgover: 0,
448            scrollarrowbgovercolor: "333333",
449            limitwidth: 0,
450            limitmaxwidth: 200,
451            autoplaylist: 0,
452            always: 0,
453            alwaysjustpause: 0,
454            alwaysnotfullscreen: 0,
455            autohide: 1,
456            floatleft: 0,
457            floatheight: 50,
458            floatmarginright: 0,
459            floatlimitwidth: 1,
460            floatwidth: 170,
461            marginbg: 0,
462            marginbgcolor: "333333",
463            marginbgpadding: "0 0 0 0",
464            hmaxk: 30,
465            bordercolor: "666666"
466        },
467        settings: {
468            bgcolor: "000000",
469            bgcolorover: "222222",
470            bga: 0.7,
471            bgaover: -1,
472            font: "arial, helvetica, sans-serif",
473            position: "bottom-right",
474            margin: "0 0 0 0",
475            padding: "7 10 7 15",
476            color: "ffffff",
477            fontsize: 12,
478            headfontsize: 16,
479            valuefontsize: 10,
480            letterspacing: 0,
481            titlecolor: "ffffff",
482            valuecolor: "ffdd1f",
483            a: 1,
484            scale: 5,
485            aover: -1,
486            activeicon: 1,
487            activeiconsize: 3,
488            scrollarrows: 1,
489            scrollarrowsize: 1,
490            scrollarrowcolor: "ffffff",
491            limitwidth: 0,
492            limitmaxwidth: 200,
493            rounding: 0,
494            settings1: 1,
495            settings1action: "quality",
496            settings2: 1,
497            settings2action: "audiotrack",
498            settings3: 1,
499            settings3action: "subtitle",
500            settings4: 0,
501            settings4action: "download",
502            settings5: 0,
503            settings5action: "speed",
504            hmaxk: 30,
505            bordercolor: "666666"
506        },
507        logo: {
508            position: "bottom-right",
509            margin: "0 10 50 0"
510        },
511        volume: 0.8,
512        volumestore: 1,
513        mutestore: 1,
514        loop: 0,
515        shuffle: 0,
516        finishrewind: 1,
517        mute: 0,
518        preload: 0,
519        preloadhls: 0,
520        preloaddash: 0,
521        autoplay: 0,
522        autoplaymute: 1,
523        showtitleplaylist: 0,
524        addtitleplaylistbr: 0,
525        addtitleplaylist: 0,
526        file_separator: ',',
527        file2_separator: ';',
528        file3_separator: '//',
529        nativehlsios: 1,
530        qbr1: '[',
531        qbr2: ']',
532        poster_scale: 'fill',
533        poster_a: 1,
534        poster_aover: -1,
535        poster_float: 0,
536        poster_floatmargin: '20 0 0 20',
537        poster_floatposition: 'top-left',
538        poster_floatwidth: 100,
539        poster_floatheight: 100,
540        poster_floatbgcolor: -1,
541        posteronpause: 0,
542        alerts: 1,
543        alertsbgcolor: "ff0000",
544        alertscolor: "ffffff",
545        alertspaddingv: 5,
546        alertspaddingh: 10,
547        alertsbga: 1,
548        alertsfontsize: 10,
549        rightclick: 0,
550        youtubeposter: 1,
551        ytautoquality: 1,
552        posterhide: 1,
553        aspect: '16x9',
554        landfullmobile: 0,
555        hlschangequality: 'next',
556        hlsautoquality: 1,
557        hlsdebug: 0,
558        hlscookies: 0,
559        hlslowquality: 0,
560        hlsquality: 1,
561        hlsaudio: 1,
562        livewakeuptime: 5,
563        reload: 0,
564        reloadlive: 1,
565        livewakeup: 0,
566        reloadtimeout: 5,
567        dashdebug: 0,
568        dashcookies: 0,
569        dashlowquality: 0,
570        dashquality: 1,
571        dashaudio: 1,
572        nameofhlsquality: 0,
573        nameofyoutubequality: 0,
574        nameofdashquality: 0,
575        qualitystore: 1,
576        eventstracker: 0,
577        events: "PlayerjsEvents",
578        errortimeout: 5000,
579        container_h_procent: '100%',
580        ga: 0,
581        ga_event: {
582            init: 1,
583            error: 0,
584            full: 0,
585            end: 0,
586            play: 1,
587            play25: 0,
588            play50: 0,
589            play75: 0,
590            vast_skip: 0,
591            vast_click: 0,
592            vast_impression: 0
593        },
594        yamtr_event: {
595            init: 1,
596            error: 0,
597            full: 0,
598            end: 0,
599            play: 1,
600            play25: 0,
601            play50: 0,
602            play75: 0
603        },
604        ga_proc: 100,
605        playsinlineonmobile: 1,
606        subtitle_start: 1,
607        sub_size: 14,
608        sub_sizeproc: '100%',
609        sub_big_fullscreen: 1,
610        sub_size_fullscreen: 20,
611        sub_bg: 1,
612        sub_bga: 0.7,
613        sub_bgo: 2,
614        sub_bgpadding: 3,
615        sub_bottom: 10,
616        sub_color: "ffffff",
617        sub_color2: "ffeeab",
618        sub_bgcolor: "000000",
619        sub_shadow: 0,
620        sub_stroke: 0,
621        sub_weight: 400,
622        sub_designstore: 1,
623        sub_shift: 0,
624        sub_store: 1,
625        sub_off: 1,
626        sharetitle: 1,
627        sharetop: 0.3,
628        shareiconscale: 3,
629        shareiconscaleover: 4,
630        shareiconmargin: 5,
631        embedsize: 0,
632        embedwidth: 560,
633        embedheight: 315,
634        fullonplay: 0,
635        fullonplaymobile: 1,
636        fullblack: 1,
637        nativefullios: 1,
638        hidestartbutios: 1,
639        thumbs: 0,
640        thumb_width: 160,
641        thumb_height: 90,
642        thumb_border: 0,
643        thumb_borderwidth: 1,
644        thumb_bordercolor: "333333",
645        thumb_radius: 0,
646        thumb_shadow: 1,
647        enc2: '2',
648        enc3: '3',
649        vast_timeout: 10,
650        vast_pauseonclick: 1,
651        vast_closeonclick: 1,
652        vast_volume: -1,
653        vast_title: 1,
654        vast_preroll_limit: 1,
655        vast_preroll_andlimit: -1,
656        vast_prerolltimebreak: 0,
657        vast_prerolltbimp: 1,
658        vast_preroll_counter: 0,
659        vast_pauseroll_limit: 1,
660        vast_pauserolltimebreak: 0,
661        vast_pauserolltbimp: 1,
662        vast_pauseroll_counter: 0,
663        vast_postroll_limit: 1,
664        vast_postrolltimebreak: 0,
665        vast_postrolltbimp: 1,
666        vast_postroll_counter: 0,
667        vast_playroll_limit: 1,
668        vast_playroll_counter: 0,
669        vast_midroll_limit: 1,
670        vast_midroll_counter: 0,
671        vast_midrolltimebreak: 0,
672        vast_midrolltbimp: 1,
673        vast_introtimebreak: 0,
674        vast_introtbimp: 1,
675        vast_linktxtbgcolor: "#ffffff",
676        vast_linktxtcolor: "#000000",
677        vast_skipbgcolor: "#000000",
678        vast_skipcolor: "#ffffff",
679        vast_titlebgcolor: "#000000",
680        vast_titlecolor: "#ffffff",
681        vast_xbgcolor: "#000000",
682        vast_xcolor: "#ffffff",
683        vast_progressbgcolor: "#000000",
684        vast_progresscolor: "#ffffff",
685        vast_volumebgcolor: "#000000",
686        vast_volumecolor: "#ffffff",
687        vast_linktxtonmobile: 1,
688        vast_unmutehover: 0,
689        vast_unmutebutonce: 1,
690        vast_default_volume: 0.5,
691        vast_unmutebutbgcolor: "#ffffff",
692        vast_unmutebutcolor: "#000000",
693        vast_openclick: 1,
694        vast_preroll_vmap: 1,
695        vast_pauseroll_vmap: 1,
696        vast_postroll_vmap: 1,
697        vast_midroll_vmap: 1,
698        vpaid_timeout: 10,
699        vpaid_timeout2: -1,
700        vast_resound: 1,
701        vpaid_slotinframe: 1,
702        eventstrackervast: 0,
703        pauserollonplay: 0,
704        partnerprerollor: "or",
705        partnerpauserollor: "or",
706        partnerpostrollor: "or",
707        partnermidrollor: "or",
708        midrollpoint: "50%",
709        introskiptime: -1,
710        introclickable: 0,
711        introclosetime: -1,
712        introtitle: 0,
713        introtxt: 0,
714        rc_version: 1,
715        rc_anyway: 0,
716        heartbeatinterval: 30,
717        default_channel: 2,
718        tagsinterval: 10,
719        playedquartile: 0,
720        minivis: 30,
721        lsfullstart: 1,
722        lsfullplay: 1,
723        captions: 0,
724        pip: {
725            on: 0,
726            bgcolor: "000000",
727            border: 0,
728            shadow: 2,
729            bordercolor: "000000",
730            position: "left",
731            margin: "20 0 0 20",
732            width: 150,
733            hide: 0
734        }
735    };
736    v.lang = "ru";
737    var Settings = function (is) {
738        var i;
739        var style = [];
740        var f = [];
741        var fbg = [];
742        var fimg = [];
743        var ftitle = [];
744        var fvalue = [];
745        var faction = [];
746        var f2 = [];
747        var f2bg = [];
748        var f2img = [];
749        var f2title = [];
750        var f2value = [];
751        var f2action = [];
752        var stout = [];
753        var is_visible = false;
754        var open_action;
755        var open_settings = -1;
756        var empty = true;
757        var key = is;
758        var iset = is == "settings";
759        var playlist;
760        var shuffle = [];
761        var shuffle_ = [];
762        var subopt1;
763        var plid = '';
764        var plfolder = '';
765        var plx = -1;
766        var sub_settings_on = false;
767        var sub_settings = false;
768        var autonextopenfolder = false;
769        var autoprevopenfolder = false;
770        var justshow = false;
771        var removed = false;
772        var showinterval;
773        var arrinterval;
774        var wheelinterval;
775        var hidetimeout;
776        var settimer;
777        var shr = [];
778        var clr = [];
779        var iclr = 0;
780        var _cstm = 0;
781        var srch;
782        var evntclk = "click";
783        var evntovr = (o.system.mobile ? "touchstart" : "mouseover");
784        var evntout = (o.system.mobile ? "touchend" : "mouseout");
785        style = UpdateObject(style, v[is]);
786        style = MarginPadding(v[is], 'margin', 'margin');
787        style = MarginPadding(v[is], 'marginproc', 'marginproc');
788        style = MarginPadding(v[is], 'mrgnprs', 'mrgnprs');
789        if (style.marginbg == 0) {
790            style.marginbgpadding = "0 0 0 0"
791        }
792        style = MarginPadding(v[is], 'bgpadding', 'marginbgpadding');
793        style = MarginPadding(v[is], 'padding', 'padding');
794        style.scrollwidth = 0;
795        var _activeIcon = "<svg style='margin-top:3px' width='" + style.activeiconsize * 2 + "' height='" + (style.activeiconsize * 2 > style.valuefontsize ? (style.activeiconsize * 2) : style.valuefontsize) + "' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><ellipse ry='" + (style.activeiconsize) + "' rx='" + style.activeiconsize + "' cy='" + (style.activeiconsize * 2 > style.valuefontsize ? (style.activeiconsize) : (style.valuefontsize / 2)) + "' cx='" + style.activeiconsize + "' fill='#" + style.valuecolor + "'/></g></svg>";
796        var _xIcon = "<svg width='" + style.activeiconsize * 2 + "' height='" + style.valuefontsize + "' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' ><g><ellipse ry='" + (style.activeiconsize - 1) + "' rx='" + (style.activeiconsize - 1) + "' cy='" + (style.valuefontsize / 2 + 2) + "' cx='" + style.activeiconsize + "' stroke='#" + style.valuecolor + "' stroke='1' fill-opacity='0'/></g></svg>";
797        var xx = 4;
798        var _nextIcon = "<pjsdiv style='display:inline-block;'><svg width='" + (xx + 2) + "' height='" + (style.valuefontsize) + "' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><line x1='1' y1='" + (style.valuefontsize / 2 - xx) + "' x2='" + xx + "' y2='" + (style.valuefontsize / 2) + "' stroke='#" + style.color + "' stroke-width='1' stroke-linecap='round'/><line x1='" + xx + "' y1='" + (style.valuefontsize / 2) + "' x2='1' y2='" + (style.valuefontsize / 2 + xx) + "' stroke='#" + style.color + "' stroke-width='1' stroke-linecap='round'/></g></svg></pjsdiv>";
799        var _prevIcon = "<pjsdiv style='display:inline-block;'><svg width='" + (xx + 10) + "' height='" + (style.valuefontsize + 1) + "' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' style='float:left'><g><line x1='1' y1='" + (style.valuefontsize / 2 + 2) + "' x2='" + xx + "' y2='" + (style.valuefontsize / 2 - xx + 2) + "' stroke='#" + style.color + "' stroke-width='1' stroke-linecap='round' /><line x1='1' y1='" + (style.valuefontsize / 2 + 2) + "' x2='" + xx + "' y2='" + (style.valuefontsize / 2 + xx + 2) + "' stroke='#" + style.color + "' stroke-width='1' stroke-linecap='round'/></g></svg></pjsdiv>";
800        var bordercolor = hex2rgb(existv(style.bordercolor, 'ffffff'), existv(style.brda, 1));
801        var container = createElement("div");
802        o.frame.appendChild(container);
803        css(container, {
804            'overflow': 'hidden',
805            'display': 'block',
806            'opacity': 0,
807            'border-radius': style.rounding
808        });
809        if (style.bgborder == 1) {
810            css(container, {
811                "border": "1px solid " + CheckColor(existv(style.bgbordercolor, 'ffffff'))
812            })
813        }
814        var mpi = {};
815        for (var i in o.menuproc) {
816            if (o.menuproc.hasOwnProperty(i)) {
817                mpi[o.menuproc[i]] = -1
818            }
819        }
820        if (iset) {
821            container.style.zIndex = 2002
822        } else {
823            container.style.zIndex = 99
824        }
825        var control = createElement("div");
826        if (o.small) {
827            style.smallfontsize > 0 ? style.fontsize = style.smallfontsize : '';
828            style.floatwidthsmall > 0 ? style.floatwidth = style.floatwidthsmall : '';
829            style.floatheightsmall > 0 ? style.floatheight = style.floatheightsmall : ''
830        }
831        css(control, {
832            'position': 'relative',
833            'top': 0,
834            'left': 0,
835            'display': 'block',
836            'width': '100%',
837            'padding-top': style.bgpaddingtop,
838            'padding-right': style.bgpaddingright + (iset && style.floatleft == 1 ? 0 : 20),
839            'padding-bottom': style.bgpaddingbottom,
840            'padding-left': style.bgpaddingleft,
841            'color': style.color,
842            'font-size': style.fontsize * existv(v.globalfs, 1),
843            'font-family': checkFont(style.font),
844            'letter-spacing': style.letterspacing + 'px'
845        });
846        if (o.system.safari) {
847            css(control, {
848                'min-width': 220
849            })
850        }
851        if (is !== "playlist") {
852            css(control, {
853                'overflow-y': (iset && style.floatleft == 1 ? 'hidden' : 'scroll')
854            })
855        }
856        container.appendChild(control);
857        if (style.floatleft != 1) {
858            var control2 = createElement("div");
859            css(control2, {
860                'display': 'block',
861                'overflow': 'hidden',
862                'border-radius': style.rounding
863            });
864            if (style.floatleft != 1) {
865                if (o.system.safari) {
866                    css(control2, {
867                        'min-width': 220
868                    })
869                }
870            }
871            control.appendChild(control2)
872        }
873        attr(control, {
874            id: (v.id + "_" + is)
875        });
876        if (is == "playlist") {
877            if (style.floatleft == 1) {
878                css(control, {
879                    'width': '100%',
880                    'padding-right': style.bgpaddingright,
881                    'padding-bottom': style.bgpaddingbottom + 20,
882                    'overflow-x': 'scroll',
883                    'overflow-y': 'hidden',
884                    'white-space': 'nowrap'
885                });
886                css(container, {
887                    'width': o.screen_w - style.marginright - style.marginleft,
888                    'height': style.floatheight + style.bgpaddingtop + style.bgpaddingbottom
889                })
890            } else {
891                css(control, {
892                    'overflow-y': 'scroll',
893                    'overflow-x': 'hidden'
894                });
895                if (style.width100 == 1) {
896                    ResizePlaylist()
897                }
898            }
899            if (style.marginbg == 1) {
900                css(container, {
901                    'background-color': style.marginbgcolor
902                })
903            }
904            if (v.playlist.droplist == 1) {
905                hide2(container)
906            }
907        }
908        if (style.scrollarrows == 1) {
909            var arr_up = createElement("div");
910            var scrollbgcolor = hex2rgb(style.marginbg == 1 ? style.marginbgcolor : style.bgcolor);
911            if (style.floatleft == 1) {
912                StyleArrow(arr_up, 'to right, rgba(' + scrollbgcolor + ',' + (style.bga * 1 + 0.3) + '), rgba(' + scrollbgcolor + ',0)', 'left', 12, 5, 7, 10, 7, 10, 12, 15);
913                arr_up.addEventListener(evntclk, ScrollLeft)
914            } else {
915                StyleArrow(arr_up, 'to bottom, rgba(' + scrollbgcolor + ',' + (style.bga * 1 + 0.3) + '), rgba(' + scrollbgcolor + ',0)', 'top', 5, 12, 10, 7, 10, 7, 15, 12);
916                arr_up.addEventListener(evntclk, ScrollUp)
917            }
918            var arr_down = createElement("div");
919            if (style.floatleft == 1) {
920                StyleArrow(arr_down, 'to left, rgba(' + scrollbgcolor + ',' + (style.bga * 1 + 0.3) + '), rgba(' + scrollbgcolor + ',0)', 'right', 8, 5, 13, 10, 13, 10, 8, 15);
921                arr_down.addEventListener(evntclk, ScrollRight)
922            } else {
923                StyleArrow(arr_down, 'to bottom, rgba(' + scrollbgcolor + ',0), rgba(' + scrollbgcolor + ',' + (style.bga * 1 + 0.3) + ')', 'bottom', 5, 8, 10, 13, 10, 13, 15, 8);
924                arr_down.addEventListener(evntclk, ScrollDown)
925            }
926            arr_up.addEventListener("mouseover", ScrollOverOut);
927            arr_up.addEventListener("mouseout", ScrollOverOut);
928            arr_down.addEventListener("mouseover", ScrollOverOut);
929            arr_down.addEventListener("mouseout", ScrollOverOut);
930            control.addEventListener("wheel", Wheel, {
931                passive: false
932            });
933            arr_up.addEventListener("mouseup", onMouseUp);
934            arr_down.addEventListener("mouseup", onMouseUp);
935            container.appendChild(arr_up);
936            container.appendChild(arr_down);
937            clearInterval(arrinterval);
938            arrinterval = setInterval(ArrowsInterval, 1000)
939        }
940        control.addEventListener(evntovr, ControlOver);
941        control.addEventListener(evntout, ControlOut);
942        if (v.playlist.srch > 0 && !srch && is == "playlist") {
943            if (typeof PluginPlSrch !== "undefined") {
944                srch = new PluginPlSrch()
945            }
946        }
947        if (iset) {
948            for (var i = 1; i < 15; i++) {
949                if (exist(v["control_" + is][is + i])) {
950                    v.settings[is + i] = v["control_" + is][is + i];
951                    if (exist(v["control_" + is][is + i + "title"])) {
952                        v.settings[is + i + "title"] = v["control_" + is][is + i + "title"]
953                    }
954                    if (exist(v["control_" + is][is + i + "action"])) {
955                        v.settings[is + i + "action"] = v["control_" + is][is + i + "action"]
956                    }
957                }
958                if (exist(v.settings[is + i])) {
959                    if (v.settings[is + i] == 1) {
960                        CreateItem('f', i);
961                        StyleItem(f[i], fbg[i], ftitle[i], fvalue[i], i);
962                        var act = v.settings[is + i + "action"];
963                        var ttl = v.settings[is + i + "title"];
964                        if (!exist(act)) {
965                            v.settings[is + i + "action"] = "speed"
966                        }
967                        if (act) {
968                            if (act.indexOf("custom") > -1 && ttl) {
969                                if (!v['files_' + act]) {
970                                    if (ttl.indexOf(":") > 0) {
971                                        var mi = act.slice(-1);
972                                        var dm = v['menu' + mi];
973                                        var k = trim(ttl.substr(ttl.indexOf(":") + 1)).split(',');
974                                        var ka = [];
975                                        var kap;
976                                        for (var j = 0; j < k.length; j++) {
977                                            if (k[j].indexOf("(*)") > -1) {
978                                                !exist(dm) ? dm = j : '';
979                                                k[j] = k[j].replace("(*)", '')
980                                            }
981                                            kap = k[j].indexOf("->api:");
982                                            ka[j] = '';
983                                            if (kap > 0) {
984                                                ka[j] = k[j].substr(kap + 6);
985                                                k[j] = k[j].substr(0, kap)
986                                            }
987                                        }
988                                        o['files_' + act] = k;
989                                        o['m' + mi + '_' + 'api'] = ka;
990                                        ttl = v.settings[is + i + "title"] = ttl.substr(0, ttl.indexOf(":"))
991                                    } else {
992                                        o['files_' + act] = [];
993                                        v.settings[is + i + "title"] = ttl
994                                    }
995                                    v['files_' + act] = 1;
996                                    o['current_' + act] = existv(dm, 0)
997                                }
998                            }
999                        }
1000                        ftitle[i].innerHTML = Lang(act);
1001                        if (exist2(ttl)) {
1002                            ftitle[i].innerHTML = ttl
1003                        }
1004                        if (act == "share") {
1005                            o.shareme = true
1006                        }
1007                        faction[i] = act;
1008                        Value(i);
1009                        if (faction[i] == 'upload') {
1010                            !o.upldfl ? o.upldfl = new PluginUpload() : '';
1011                            if (exist(window.FileReader)) {
1012                                ftitle[i].innerHTML = o.upldfl.Input();
1013                                o.upldfl.Ch()
1014                            }
1015                        }
1016                        if (faction[i] in o.menuproc) {
1017                            mpi[faction[i]] = i
1018                        }
1019                        f[i].addEventListener(evntovr, onOver);
1020                        f[i].addEventListener(evntout, onOut);
1021                        f[i].addEventListener(evntclk, onClick);
1022                        f[i].addEventListener("mouseup", onMouseUp);
1023                        if (v.settings[is + i + "hide"] == 1) {
1024                            css(f[i], {
1025                                "height": 0
1026                            })
1027                        }
1028                    }
1029                }
1030            }
1031        }
1032
1033        function Wheel(x) {
1034            if (is == "playlist" && style.floatleft == 1 && x) {
1035                if (x.deltaX == 0 && x.deltaY != 0) {
1036                    control.scrollLeft -= x.deltaY;
1037                    x.preventDefault()
1038                }
1039            }
1040            clearInterval(wheelinterval);
1041            wheelinterval = setInterval(ControlOut, 3000);
1042            Retimer()
1043        }
1044
1045        function ControlOver() {
1046            o.mouseDown = true
1047        }
1048
1049        function ControlOut() {
1050            if (style.showovercontrol == 1) {
1051                clearTimeout(o.settingsovertimer);
1052                o.settingsovertimer = setTimeout(function () {
1053                    if (!o.mouseDown && !o.setaction) {
1054                        HideControl()
1055                    }
1056                }, (v.settings.showoverto > 0 ? v.settings.showoverto * 1000 : (o.system.tv ? 2000 : 1000)))
1057            }
1058            o.mouseDown = false
1059        }
1060
1061        function onOver(event) {
1062            if (o.fullscreen) {
1063                o.volumewheel ? o.actions.volumewheel(false) : ''
1064            }
1065            var i = event.target.getAttribute('fid');
1066            var x;
1067            if (i) {
1068                x = 'f'
1069            } else {
1070                if (event.target.getAttribute('f2id')) {
1071                    i = event.target.getAttribute('f2id');
1072                    x = 'f2'
1073                }
1074            }
1075            if (i) {
1076                i = parseInt(i);
1077                var opn = false;
1078                if (exist(eval(x)[i])) {
1079                    if (style.bgaover > -1) {
1080                        css(eval(x + 'bg')[i], {
1081                            'opacity': style.bgaover
1082                        })
1083                    }
1084                    if (exist2(style.bgbrovr)) {
1085                        css(eval(x + 'bg')[i], {
1086                            'filter': 'brightness(' + style.bgbrovr + ')'
1087                        })
1088                    }
1089                    if (style.aover > -1) {
1090                        css(eval(x + 'title')[i], {
1091                            'opacity': style.aover
1092                        });
1093                        css(eval(x + 'value')[i], {
1094                            'opacity': style.aover
1095                        })
1096                    }
1097                    if (is == "playlist") {
1098                        if (faction[i].indexOf("playlist") == 0) {
1099                            var id = faction[i].substr(8);
1100                            if (plid == id || plfolder == id) {
1101                                css(eval(x + 'title')[i], {
1102                                    'color': style.valuecolor
1102
1103                                });
1104                                css(eval(x + 'value')[i], {
1105                                    'color': style.valuecolor
1106                                });
1107                                opn = true
1108                            } else {
1109                                css(eval(x + 'title')[i], {
1110                                    'color': style.color
1111                                })
1112                            }
1113                        }
1114                    }
1115                    if (style.playbgcolored == 1 && exist(style.playbgcolor) && opn) {} else {
1116                        css(eval(x + 'bg')[i], {
1117                            'backgroundColor': style.bgcolorover
1118                        })
1119                    }
1120                }
1121            }
1122        };
1123
1124        function onOut(event) {
1125            if (o.fullscreen) {
1126                o.volumewheel ? o.actions.volumewheel(true) : ''
1127            }
1128            var i = event.target.getAttribute('fid');
1129            var x;
1130            var opn = false;
1131            clearInterval(downin);
1132            Retimer();
1133            if (i) {
1134                x = 'f'
1135            } else {
1136                if (event.target.getAttribute('f2id')) {
1137                    i = event.target.getAttribute('f2id');
1138                    x = 'f2'
1139                }
1140            }
1141            if (i) {
1142                if (exist(eval(x)[i])) {
1143                    if (style.bgaover > -1) {
1144                        css(eval(x + 'bg')[i], {
1145                            'opacity': style.bga
1146                        })
1147                    }
1148                    if (exist2(style.bgbrovr)) {
1149                        css(eval(x + 'bg')[i], {
1150                            'filter': 'brightness(1)'
1151                        })
1152                    }
1153                    if (style.aover > -1) {
1154                        css(eval(x + 'title')[i], {
1155                            'opacity': style.a
1156                        });
1157                        css(eval(x + 'value')[i], {
1158                            'opacity': style.a
1159                        })
1160                    }
1161                    if (is == "playlist") {
1162                        if (faction[i].indexOf("playlist") == 0) {
1163                            var id = faction[i].substr(8);
1164                            if (plid == id || plfolder == id) {
1165                                css(eval(x + 'title')[i], {
1166                                    'color': style.valuecolor
1167                                });
1168                                css(eval(x + 'value')[i], {
1169                                    'color': style.valuecolor
1170                                });
1171                                opn = true
1172                            } else {
1173                                if (exist(o.plhistory[id])) {
1174                                    HistoryPlaylist(i)
1175                                } else {
1176                                    css(eval(x + 'title')[i], {
1177                                        'color': style.color
1178                                    })
1179                                }
1180                            }
1181                        }
1182                    }
1183                    if (style.playbgcolored == 1 && exist(style.playbgcolor) && opn) {} else {
1184                        css(eval(x + 'bg')[i], {
1185                            'backgroundColor': o.plhistory[id] ? style.historybgcolor : style.bgcolor
1186                        })
1187                    }
1188                }
1189            }
1190        }
1191
1192        function onClick(event) {
1193            if (!justshow) {
1194                var d = new Date();
1195                o.clicktime = d.getTime();
1196                var i = event.target.getAttribute('fid');
1197                if (i) {
1198                    if (exist(f[i])) {
1199                        if (exist(faction[i])) {
1200                            if (is == "playlist") {
1201                                o.seekto = undefined
1202                            }
1203                            Action(i, 0)
1204                        }
1205                    }
1206                }
1207                JsClk()
1208            }
1209        }
1210        var downi;
1211        var downin;
1212
1213        function onMouseDown(event) {
1214            if (!justshow) {
1215                var i = event.target.getAttribute('f2id');
1216                if (i) {
1217                    if (exist(f2action[i])) {
1218                        if (open_action in o.menuproc) {
1219                            downi = i;
1220                            downin = setInterval(DownIn, 200)
1221                        }
1222                    }
1223                }
1224            }
1225        }
1226
1227        function DownIn() {
1228            Action2(downi)
1229        }
1230
1231        function onMouseUp(event) {
1232            clearInterval(downin);
1233            event.cancelBubble = true;
1234            Retimer()
1235        }
1236
1237        function onClick2(event) {
1238            clearInterval(downin);
1239            if (!justshow) {
1240                var d = new Date();
1241                o.clicktime = d.getTime();
1242                var i = event.target.getAttribute('f2id');
1243                if (i) {
1244                    if (i == 0) {
1245                        if (f2action[0] == 'color') {
1246                            Remove2();
1247                            Action(iclr)
1248                        } else {
1249                            Home()
1250                        }
1251                    } else {
1252                        if (exist(f2action[i])) {
1253                            Action2(i)
1254                        }
1255                    }
1256                }
1257            }
1258        }
1259
1260        function onClickSubtitle(event) {
1261            var x = event.target.getAttribute('setupx');
1262            if (x) {
1263                ActionOptions(x)
1264            }
1265        }
1266
1267        function onClickSubtitle2(event) {
1268            Retimer();
1269            var i = event.target.getAttribute('f2id');
1270            if (exist(f2action[i])) {
1271                if (f2i("=", i) > 0) {
1272                    var x = f2action[i].substr(0, f2i("=", i));
1273                    var y = f2action[i].substr(f2i("=", i) + 1);
1274                    var z = open_action + '_reset';
1275                    if (!v[z]) {
1276                        v[z] = []
1277                    }
1278                    if (!exist(v[z][x])) {
1279                        v[z][x] = v[x] + ''
1280                    }
1281                    StyleSubtitle(x, y)
1282                }
1283            }
1284        };
1285
1286        function StyleSubtitle(x, y) {
1287            v[x] = y;
1288            if (o.storage && v.sub_designstore == 1 && x != "sub_shift") {
1289                localStorage.setItem("pljs" + x, y)
1290            }
1291            if (o.casting && o.chromecast) {
1292                o.chromecast.Sub()
1293            }
1294            o.actions.RenewSubtitle();
1295            ActionOptions(x)
1296        }
1297
1298        function onClickTimer2(event) {
1299            var i = event.target.getAttribute('f2id');
1300            var x = f2action[i];
1301            if (exist(x)) {
1302                if (x.indexOf("=") > 0) {
1303                    var z = x.substr(0, x.indexOf("="));
1304                    var y = x.substr(x.indexOf("=") + 1);
1305                    v[z] = y;
1306                    SubtitleTimerMenu();
1307                    Value(o[open_action + '_i']);
1308                    if (open_action == "offsettimer") {
1309                        SettingsTimers("offsetwrite")
1310                    }
1311                }
1312            }
1313        }
1314
1315        function Value(i) {
1316            if (exist(faction[i])) {
1317                var _hide = false;
1318                var _show = false;
1319                var _value = '';
1320                if (iset) {
1321                    if (faction[i] == "quality") {
1322                        _value = o.media.getQuality()
1323                    }
1324                    if (faction[i] == "audiotrack") {
1325                        _value = o.media.getAudioTrack()
1326                    }
1327                    if (faction[i] == "share") {
1328                        _value = ' ';
1329                        _show = true
1330                    }
1331                    if (faction[i].indexOf("custom") > -1) {
1332                        if (o['files_' + faction[i]]) {
1333                            if (o['files_' + faction[i]].length > 0) {
1334                                var t = o['current_' + faction[i]];
1335                                if (t != -1) {
1336                                    _value = o['files_' + faction[i]][t]
1337                                }
1338                                _show = true
1339                            }
1340                        }
1341                    }
1342                    if (faction[i] == "channel") {
1343                        if (o.channels) {
1344                            _value = o.files_channel[o.current_channel]
1345                        }
1346                    }
1347                    if (faction[i] == "audiotrack" || faction[i] == "channel" || faction[i] == "quality") {
1348                        if (o['files_' + faction[i]].length == 0) {
1349                            _hide = true
1350                        } else {
1351                            if (o['files_' + faction[i]].length == 1 && (style.show1value != 1 || o['files_' + faction[i]][0] == 1)) {
1352                                _hide = true
1353                            } else {
1354                                _show = true
1355                            }
1356                        }
1357                    }
1358                    if (faction[i] == "airplay") {
1359                        if (!o.airplay) {
1360                            _hide = true
1361                        } else {
1362                            _show = true
1363                        }
1364                    }
1365                    if (faction[i] == "download") {
1366                        if (o.file_type != 'native' && !v.download) {
1367                            _hide = true
1368                        } else {
1369                            _show = true
1370                        }
1371                    }
1372                    if (faction[i] == "subtitle") {
1373                        if (exist(o.subs)) {
1374                            _show = true;
1375                            if (o.subtitle_on || v.sub_off == 1) {
1376                                if (o.sbt) {
1377                                    _value = o.files_subtitle[!o.subtitle_on ? o.sbt.ioff() : o.current_subtitle]
1378                                }
1379                            } else {
1380                                _value = ''
1381                            }
1382                            var sxs = 0;
1383                            for (var s = 0; s < o.subs.length; s++) {
1384                                if (o.subs[s] != '') {
1385                                    sxs++
1386                                }
1387                            }
1388                            if (sxs == 1 && o.subload == 1) {
1389                                sxs = 0
1390                            }
1391                            if (v.sub_upload == 1 && v.sub_upload0 == 1) {} else {
1392                                if (sxs == 0) {
1393                                    _hide = true;
1394                                    _show = false
1395                                }
1396                            }
1397                        } else {
1398                            _hide = true
1399                        }
1400                    }
1401                    if (faction[i] == "speed") {
1402                        _value = o.files_speed[o.current_speed];
1403                        _value == 1 && style.speed1 != 1 ? _value = Lang('normal') : '';
1404                        _show = true;
1405                        if (o.file_type == "vimeo" || (o.media.isLive
1405() && style.speed4live != 1)) {
1406                            _hide = true;
1407                            _show = false
1408                        }
1409                    }
1410                    if (faction[i] in o.menuproc) {
1411                        _value = FltrVal(faction[i]);
1412                        _show = true
1413                    }
1414                    if (faction[i].indexOf("timer") > 0) {
1415                        var x = ' ';
1416                        var y = ['hour', 'minute', 'second'];
1417                        for (var z = 0; z < y.length; z++) {
1418                            if (exist(v[faction[i] + y[z]])) {
1419                                if (v[faction[i] + y[z]] !== ' ') {
1420                                    x += (x !== ' ' ? ':' : '') + v[faction[i] + y[z]]
1421                                }
1422                            }
1423                        }
1424                        _value = x != ' 0:0' && x.indexOf(":") > -1 ? x : ' ';
1425                        o[faction[i] + 'val'] = _value;
1426                        _show = true
1427                    }
1428                }
1429                fvalue[i].innerHTML = _value + (_value != '' && style.hidearrow != 1 ? ' &nbsp;<svg width="5px" height="7px" viewBox="-1 -1 5 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><polyline stroke="#' + style.valuecolor + '" stroke-width="1" fill="none" points="0 0 3 3 0 6"></polyline></svg>' : '');
1430                var iset2 = iset && open_settings != -1;
1431                if (_hide) {
1432                    hide(f[i]);
1433                    if (iset) {
1434                        stout[i] ? clearTimeout(stout[i]) : '';
1435                        if (o.controls) {
1436                            o.controls.SettingsN(i, false, _value)
1437                        } else {
1438                            stout[i] = setTimeout(function () {
1439                                o.controls.SettingsN(i, false, _value)
1440                            }, 200)
1441                        }
1442                    }
1443                    css(f[i], {
1444                        'position': 'absolute',
1445                        'right': 0,
1446                        'top': -100
1447                    })
1448                }
1449                if (_show) {
1450                    if (iset2) {} else {
1451                        if (style.floatleft == 1) {
1452                            css(f[i], {
1453                                'display': 'inline-block'
1454                            })
1455                        } else {
1456                            show(f[i])
1457                        }
1458                    }
1459                    if (iset) {
1460                        stout[i] ? clearTimeout(stout[i]) : '';
1461                        if (o.controls) {
1462                            o.controls.SettingsN(i, true, _value)
1463                        } else {
1464                            stout[i] = setTimeout(function () {
1465                                o.controls.SettingsN(i, true, _value)
1466                            }, 500)
1467                        }
1468                    }
1469                    css(f[i], {
1470                        'position': 'relative',
1471                        'right': 0,
1472                        'top': 0
1473                    })
1474                }
1475                Resize()
1476            }
1477            for (var j = 1; j < f.length; j++) {
1478                if (f[j]) {
1479                    if (isVisible(f[j])) {
1480                        var refresh = false;
1481                        empty ? refresh = true : '';
1482                        empty = false;
1483                        refresh && o.controls ? o.controls.refresh() : ''
1484                    }
1485                }
1486            }
1487        };
1488        var stvs = 0;
1489
1490        function Action(i, cstm, fa) {
1491            fa ? faction[i] = fa : '';
1492            if (exist(faction[i])) {
1493                o.setaction = true;
1494                Retimer();
1495                var x = VisibleItems();
1496                if (iset) {
1497                    open_settings == -1 ? stvs = x[0] : x[0] = stvs
1498                }
1499                if (open_action != faction[i]) {
1500                    open_action = faction[i];
1501                    var csta = open_action.indexOf("custom") > -1;
1502                    if (open_action == 'quality' || open_action == 'audiotrack' || open_action == 'subtitle' || open_action == 'speed' || csta || open_action == 'channel' || open_action in o.menuproc || open_action.indexOf("timer") > 0 || open_action == 'share' || open_action == 'color') {
1503                        open_settings = i;
1504                        var z = copyObject(o['files_' + open_action]);
1505                        if (open_action == "sleeptimer") {
1506                            if (style.sleep2 == 1) {
1507                                z = SettingsTimers("sleep2options")
1508                            } else {
1509                                z = SettingsTimers("sleepoptions")
1510                            }
1511                        }
1512                        if (open_action == "offsettimer") {
1513                            z = SettingsTimers("offsetoptions")
1514                        }
1515                        if (open_action == "share" && o.share) {
1516                            z = [];
1517                            for (var j = 1; j <= 16; j++) {
1518                                if (exist(v["share" + j])) {
1519                                    z.push(Lang(v["share" + j]));
1520                                    shr[z.length] = v["share" + j]
1521                                }
1522                            }
1523                        }
1524                        if (open_action == "color" && o.tagvideo) {
1525                            z = [];
1526                            iclr = i;
1527                            for (var j = 0; j < o.clr_options.length; j++) {
1528                                var co = o.clr_options[j].substr(4);
1529                                z.push(Lang(co));
1530                                clr[z.length] = co
1531                            }
1532                        }
1533                        if (z.length == 0 && csta) {
1534                            var ai = open_action.slice(-1);
1535                            if (exist(window['PlayerjsMenu' + ai])) {
1536                                window['PlayerjsMenu' + ai](v.id)
1537                            }
1538                            HideControl();
1539                            return
1540                        }
1541                        var current = o['current_' + open_action];
1542                        var pressed = o['pressed_' + open_action];
1543                        for (var j = 1; j < f.length; j++) {
1544                            if (f[j]) {
1545                                f[j].style.display = "none"
1546                            }
1547                        }
1548                        f2 = [];
1549                        CreateItem('f2', 0);
1550                        StyleItem(f2[0], f2bg[0], f2title[0], f2value[0], 0);
1551                        css(f2[0], {
1552                            "border-bottom": "1px solid " + (style.bordercolored == 1 ? bordercolor : "rgba(100,100,100,0.7)")
1553                        });
1554                        _cstm = cstm;
1555                        var suboptns = false;
1556                        f2title[0].innerHTML = (x[0] < 2 || _cstm == 1 || style.noprevicon == 1 ? '' : _prevIcon) + (v.settings[is + i + "title"] && v.settings[is + i + "title"] != '' ? v.settings[is + i + "title"] : Lang(v.settings[is + i + "action"])) + (o[faction[i] + 'val'] ? o[faction[i] + 'val'] : '');
1557                        if (open_action == 'subtitle' && !o.dash_subs) {
1558                            var prm = createElement("div");
1559                            prm.innerHTML = Lang("options");
1560                            css(prm, {
1561                                'color': style.color,
1562                                'pointerEvents': 'auto',
1563                                'cursor': 'pointer'
1564                            });
1565                            f2value[0].appendChild(prm);
1566                            prm.addEventListener(evntclk, SubtitleSettings);
1567                            suboptns = true
1568                        }
1569                        if (open_action == 'subtitle' && v.sub_upload == 1 && !o.system.tv && exist(window.FileReader)) {
1570                            var uf = createElement("div");
1571                            !o.sbt ? o.sbt = new PluginSub() : '';
1572                            uf.innerHTML = "<input type='file' id='" + v.id + "_subfile' accept='.vtt,.ass,.srt' style='display:none'/>" + Lang('upload');
1573                            css(uf, {
1574                                'color': style.color,
1575                                'pointerEvents': 'auto',
1576                                'cursor': 'pointer',
1577                                'margin-left': (suboptns ? '10px' : 0)
1578                            });
1579                            f2value[0].appendChild(uf);
1580                            o.subupld = document.getElementById(v.id + "_subfile");
1581                            o.subupld.onchange = o.sbt.SubUpload;
1582                            uf.addEventListener(evntclk, o.sbt.SubUpload)
1583                        }
1584                        if (suboptns) {
1585                            if (sub_settings_on) {
1586                                if (_cstm == 2) {
1587                                    z = [];
1588                                    hide2(f2[0])
1589                                }
1590                                for (j = 0; j < o.sub_options.length; j++) {
1591                                    if (v.sub_all == 0 && o.sub_options[j] == "sub_color2") {} else {
1592                                        z.push("pjslng_" + o.sub_options[j])
1593                                    }
1594                                }
1595                            }
1596                        }
1597                        css(f2title[0], {
1598                            'font-size': style.headfontsize * existv(v.globalfs, 1)
1599                        });
1600                        f2action[0] = "home";
1601                        if (open_action in o.menuproc) {
1602                            Menuproc(open_action);
1603                            if (iclr > 0 && o.clr_options.indexOf('clr_' + open_action) > -1) {
1604                                f2title[0].innerHTML = _prevIcon + Lang(open_action);
1605                                f2action[0] = "color";
1606                                f2value[0].innerHTML = FltrVal(open_action)
1607                            }
1608                            css(f2value[0], {
1609                                'width': style.valuefontsize * 2.5,
1610                                'text-align': 'right'
1611                            })
1612                        }
1613                        if (_cstm != 1 && x[0] > 1) {
1614                            f2[0].addEventListener(evntovr, onOver);
1615                            f2[0].addEventListener(evntout, onOut);
1616                            f2[0].addEventListener(evntclk, onClick2);
1617                            f2[0].addEventListener("mouseup", onMouseUp)
1618                        } else {
1619                            css(f2[0], {
1620                                "cursor": 'default'
1621                            })
1622                        }
1623                        if (style.nohead == 1) {
1624                            hide2(f2[0])
1625                        }
1626                        if (exist(z)) {
1627                            var zz = '';
1628                            for (j = 0; j < z.length; j++) {
1629                                var y = j + 1;
1630                                var toend = 0;
1631                                var off = false;
1632                                if (z[j] && trim(z[j]) != '') {
1633                                    if (open_action == 'quality') {
1634                                        if (z[j] == Lang("auto")) {
1635                                            toend = 1
1636                                        }
1637                                        if (o.file_type == "hls" && v.hlsqhsort == 1) {
1638                                            var iz = int(z[j]);
1639                                            if (iz && iz < zz) {
1640                                                toend = 2
1641                                            }
1642                                            zz = int(z[j])
1643                                        }
1644                                    }
1645                                    CreateItem('f2', y, toend);
1646                                    StyleItem(f2[y], f2bg[y], f2title[y], f2value[y], faction[i], i);
1647                                    if (open_action == 'speed') {
1648                                        z[j] == 1 && style.speed1 != 1 ? z[j] = Lang('normal') : ''
1649                                    }
1650                                    if (typeof (z[j]) == 'string') {
1651                                        if (z[j].indexOf("<<<") == 0) {
1652                                            z[j] = z[j].replace('<<<', '');
1653                                            off = true
1654                                        }
1655                                        if (z[j].indexOf('timer') > 0) {
1656                                            o[open_action + '_i'] = i
1657                                        }
1658                                        if (z[j].indexOf("pjslng") == 0) {
1659                                            var tmp = z[j];
1660                                            if (tmp.indexOf("timer") > 0) {
1661                                                f2title[y].innerHTML = Lang(z[j].substr(tmp.indexOf("timer") + 5))
1662                                            } else {
1663                                                f2title[y].innerHTML = Lang(z[j].substr(7))
1664                                            }
1665                                            if (z[j] == 'pjslng_sub_sizeproc') {
1666                                                subopt1 = f2[y];
1667                                                css(f2[y], {
1668                                                    "border-top": "1px solid " + (style.bordercolored == 1 ? bordercolor : "rgba(100,100,100,0.7)")
1669                                                })
1670                                            }
1671                                        } else {
1672                                            f2title[y].innerHTML = z[j]
1673                                        }
1674                                    } else {
1675                                        f2title[y].innerHTML = z[j]
1676                                    }
1677                                    f2action[y] = open_action + j;
1678                                    if (current == j || pressed == j) {
1679                                        f2value[y].innerHTML = current == j ? _activeIcon : _xIcon;
1680                                        if (current == j) {
1681                                            StyleActive(y)
1682                                        }
1683                                    }
1684                                    if (typeof (z[j]) == 'string') {
1685                                        if (z[j].indexOf("pjslng") == 0) {
1686                                            var t = z[j].substr(7);
1687                                            if (t.indexOf("color") > 0) {
1688                                                f2value[y].innerHTML = "<div style='" + (v[t] == "000000" ? 'border:1px solid #999;height:8px;width:8px;' : 'height:10px;width:10px;') + ";background-color:" + (v[t].indexOf("#") == -1 ? '#' : '') + v[t] + ";border-radius:10px;'></div>"
1689                                            } else {
1690                                                if (exist(v[z[j].substr(7)])) {
1691                                                    f2value[y].innerHTML = v[z[j].substr(7)]
1692                                                }
1693                                            }
1694                                        }
1695                                        if (open_action == "share") {
1696                                            if (exist(shr[y]) && o.share) {
1697                                                f2value[y].innerHTML = o.share.
1697icon(shr[y], 0.7, CheckColor(style.valuecolor))
1698                                            }
1699                                        }
1700                                        if (open_action == "color") {
1701                                            if (exist(clr[y]) && o.tagvideo) {
1702                                                f2value[y].innerHTML = FltrVal(clr[y])
1703                                            }
1704                                        }
1705                                        if (open_action == 'quality') {
1706                                            if (z[j] == Lang("auto") && o.media.autoQuality()) {
1707                                                StyleActive(y)
1708                                            }
1709                                            if (exist2(v.forbidden_quality)) {
1710                                                var fq = v.forbidden_quality.split(",");
1711                                                for (var k = 0; k < fq.length; k++) {
1712                                                    if (z[j].indexOf(fq[k]) > -1) {
1713                                                        hide2(f2[y])
1714                                                    }
1715                                                }
1716                                            }
1717                                        }
1718                                    }
1719                                    var clck = "";
1720                                    if (typeof (z[j]) == 'string') {
1721                                        if (z[j].indexOf("pjslng") == 0) {
1722                                            attr(f2[y], {
1723                                                'f2parent': i,
1724                                                'setupx': z[j].substr(7)
1725                                            });
1726                                            clck = "onClickSubtitle"
1727                                        }
1728                                    }
1729                                    if (!off) {
1730                                        f2[y].addEventListener(evntovr, onOver);
1731                                        f2[y].addEventListener(evntout, onOut);
1732                                        if (clck == "onClickSubtitle") {
1733                                            f2[y].addEventListener(evntclk, onClickSubtitle)
1734                                        } else {
1735                                            f2[y].addEventListener(evntclk, onClick2)
1736                                        }
1737                                        f2[y].addEventListener("mouseup", onMouseUp);
1738                                        f2[y].addEventListener("mousedown", onMouseDown)
1739                                    } else {
1740                                        css(f2[y], {
1741                                            "cursor": "default"
1742                                        })
1743                                    }
1744                                }
1745                            }
1746                        }
1747                        Resize()
1748                    }
1749                    if (faction[i] == 'download') {
1750                        o.actions.Download();
1751                        open_action = -1
1752                    }
1753                    if (faction[i] == 'upload' && exist(o.upldfl)) {
1754                        o.upldfl.open();
1755                        open_action = -1
1756                    }
1757                    if (faction[i].indexOf('playlist') > -1) {
1758                        var id = faction[i].substr(8);
1759                        if (exist(o.playlist_dic[id])) {
1760                            var fl = o.playlist_dic[id]['file'];
1761                            if (exist(fl)) {
1762                                if (fl.indexOf('seek:') == 0) {
1763                                    if (id.indexOf('x' + plfolder) != 0) {
1764                                        o.seekto = fl.substr(5);
1765                                        playById(id.substr(0, id.lastIndexOf('-')) + '-0');
1766                                        return
1767                                    }
1768                                    if (!o.start) {
1769                                        o.seekto = fl.substr(5)
1770                                    }
1771                                    if (!o.play) {
1772                                        o.actions.Play()
1773                                    }
1774                                    apiProcessor('seek', fl.substr(5));
1775                                    v.playlist.always == 0 && v.playlist.autohide == 1 ? HideControl() : '';
1776                                    return
1777                                }
1778                                ActionPlaylist(i);
1779                                UpdateStart(id);
1780                                SettingsTimers("offset");
1781                                if (exist(o.playlist_dic[id]['redirect']) && v.redirect == 1 && v.redirectplaylist == 1) {
1782                                    redirect(o.playlist_dic[id]['redirect'])
1783                                } else {
1784                                    UpdateVars0(id);
1785                                    o.actions.NewFile(fl, (v.playlist.dontplay == 1 ? 1 : undefined));
1786                                    v.playlist.always == 0 && v.playlist.autohide == 1 ? setTimeout(HideControl, 200) : '';
1787                                    autonextopenfolder = false;
1788                                    autoprevopenfolder = false;
1789                                    UpdateVars(id);
1790                                    js("usernew")
1791                                }
1792                            } else {
1793                                if (exist(o.playlist_dic[id]['folder'])) {
1794                                    UpdatePlaylist(id);
1795                                    if (autonextopenfolder) {
1796                                        plx == -1 ? Action(0, 0) : ''
1797                                    } else if (autoprevopenfolder) {
1798                                        plx == -1 ? Action(parseInt(f.length) - 2, 0) : ''
1799                                    }
1800                                }
1801                            }
1802                        }
1803                        if (o.droplist) {
1804                            o.droplist.Update()
1805                        }
1806                    }
1807                    if (faction[i] == 'airplay') {
1808                        o.media.Airplay()
1809                    }
1810                }
1811            }
1812        };
1813        this.UpdateTimer = function (x) {
1814            Value(o[x + '_i'])
1815        };
1816
1817        function ActionOptions(x) {
1818            if (x == "sub_x") {
1819                SubtitleSettingsClose();
1820                return
1821            }
1822            if (x == "sub_reset") {
1823                var z = open_action + '_reset';
1824                if (v[z]) {
1825                    for (var y in v[z]) {
1826                        if (v[z].hasOwnProperty(y)) {
1827                            StyleSubtitle(y, v[z][y])
1828                        }
1829                    }
1830                    SubtitleSettingsMenu()
1831                }
1832                return
1833            }
1834            Retimer();
1835            for (var i = 0; i < f2.length; i++) {
1836                if (f2[i]) {
1837                    f2[i].style.display = "none"
1838                }
1839            }
1840            f2 = [];
1841            CreateItem('f2', 0);
1842            StyleItem(f2[0], f2bg[0], f2title[0], f2value[0], 0);
1843            css(f2[0], {
1844                "border-bottom": "1px solid " + (style.bordercolored == 1 ? bordercolor : "rgba(100,100,100,0.7)")
1845            });
1846            if (x.indexOf("timer") > 0) {
1847                f2[0].addEventListener(evntclk, SubtitleTimerMenu);
1848                f2title[0].innerHTML = Lang(x.substr(x.indexOf("timer") + 5))
1849            } else {
1850                f2[0].addEventListener(evntclk, SubtitleSettingsMenu);
1851                f2title[0].innerHTML = (style.noprevicon != 1 ? _prevIcon : '') + Lang(x)
1852            }
1853            css(f2title[0], {
1854                'font-size': style.headfontsize * existv(v.globalfs, 1)
1855            });
1856            f2[0].addEventListener(evntovr, onOver);
1857            f2[0].addEventListener(evntout, onOut);
1858            f2[0].addEventListener("mouseup", onMouseUp);
1859            var values = [];
1860            var valuefromlang = false;
1861            if (x.indexOf("size") > 0) {
1862                values = ['50%', '75%', '100%', '125%', '150%', '175%', '200%', '250%', '300%', '400%']
1863            }
1864            if (x.indexOf("bga") > 0) {
1865                values = ['0', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1']
1866            }
1867            if (x.indexOf("shift") > 0) {
1868                for (var i = -5; i < 5.5; i += 0.5) {
1869                    values.push(Math.round(i * 100) / 100)
1870                }
1871            }
1872            if (x.indexOf("weight") > 0) {
1873                values = [200, 400, 600]
1874            }
1875            if (x.indexOf("bottom") > 0) {
1876                for (i = 0; i < 21; i++) {
1877                    values[i] = i * 10
1878                }
1879            }
1880            if (x.indexOf("hour") > 0) {
1881                for (i = 0; i < 24; i++) {
1882                    values[i] = i
1883                }
1884            }
1885            if (x.indexOf("minute") > 0 || x.indexOf("second") > 0) {
1886                for (i = 0; i < 60; i++) {
1887                    values[i] = i
1888                }
1889            }
1890            if (x.indexOf("shadow") > 0) {
1891                valuefromlang = true;
1892                values = [0, 1]
1893            }
1894            if (x.indexOf("stroke") > 0) {
1895                valuefromlang = true;
1896                values = [0, 1]
1897            }
1898            if (x.indexOf("color") > 0) {
1899                values = ['ffffff', 'ffeeab', '72ccf8', '62de50', 'faed54', 'feba54', 'e8bbff', 'ffc7d1', 'aaaaaa', 'd9bb8c', 'b3fee8', '4bd9ac', 'ffff00', 'D90000', '073DA0', '409829', '644082', '000000'];
1900                var vx = v[x].replace("#", "");
1901                if (values.indexOf(vx) == -1) {
1902                    values[8] = vx
1903                }
1904            }
1905            for (y = 1; y <= values.length; y++) {
1906                CreateItem('f2', y, 0);
1907                StyleItem(f2[y], f2bg[y], f2title[y], f2value[y], y);
1908                css(f2value[y], {
1909                    'padding-left': 0
1910                });
1911                if (x.indexOf("color") > 0 || x.indexOf("bottom") > 0 || x.indexOf("timer") > 0 || x.indexOf("shift") > 0) {
1912                    y % 3 != 0 ? css(f2[y], {
1913                        'float': 'left'
1914                    }) : '';
1915                    css(f2[y], {
1916                        'width': '33.3%'
1917                    });
1918                    if (x.indexOf("color") > 0) {
1919                        values[y - 1] = existv(v["subclr" + (y - 1)], values[y - 1]);
1920                        f2title[y].innerHTML = "<div style='" + (values[y - 1] == "000000" ? 'border:1px solid #999;height:18px;width:18px;' : 'height:20px;width:20px;') + ";background-color:" + CheckColor(values[y - 1]) + ";border-radius:20px;'></div>";
1921                        css(f2[y], {
1922                            'line-height': 1
1923                        })
1924                    } else {
1925                        f2title[y].innerHTML = values[y - 1]
1926                    }
1927                } else {
1928                    if (x.indexOf("weight") > 0) {
1929                        f2title[y].innerHTML = values[y - 1]
1930                    } else {
1931                        y % 2 != 0 ? css(f2[y], {
1932                            'float': 'left'
1933                        }) : '';
1934                        css(f2[y], {
1935                            'width': '50%'
1936                        });
1937                        if (valuefromlang) {
1938                            f2title[y].innerHTML = Lang(values[y - 1] + 'val')
1939                        } else {
1940                            f2title[y].innerHTML = values[y - 1]
1941                        }
1942                    }
1943                }
1944                f2action[y] = x + '=' + values[y - 1];
1945                if ((values[y - 1] == v[x] && String(v[x]) != " ") || v[x] == '#' + values[y - 1]) {
1946                    f2value[y].innerHTML = _activeIcon;
1947                    StyleActive(y)
1948                }
1949                f2[y].addEventListener(evntovr, onOver);
1950                f2[y].addEventListener(evntout, onOut);
1951                if (x.indexOf("timer") > 0) {
1952                    f2[y].addEventListener(evntclk, onClickTimer2)
1953                } else {
1954                    f2[y].addEventListener(evntclk, onClickSubtitle2)
1955                }
1956                f2[y].addEventListener("mouseup", onMouseUp)
1957            }
1958            Resize()
1959        }
1960
1961        function StyleActive(x) {
1962            f2[x].classList.add('pjs-' + v.id + '-active-menu');
1963            css(f2title[x], {
1964                'color': style.valuecolor
1965            });
1966            BgBrAct(f2bg[x])
1967        }
1968
1969        function UpdateVars0(id) {
1970            if (exist(o.playlist_dic[id]['poster'])) {
1971                v.poster = o.playlist_dic[id]['poster'];
1972                exist(v.poster) ? o.media.Poster(v.poster) : ''
1973            }
1974            if (exist(o.playlist_dic[id]['title'])) {
1975                o.titlestore = o.playlist_dic[id]['title']
1976            }
1977            MediaSess()
1978        }
1979
1980        function UpdateVars(id) {
1981            var t = o.playlist_dic[id]['title'];
1982            if (exist(t)) {
1983                if (v.showtitleplaylist == 1) {
1984                    if (o.actions.TitleTemplate(o.playlist_dic[id])) {} else {
1985                        v.title = (v.addtitleplaylist == 1 && exist(o.maintitle) ? o.maintitle + (v.addtitleplaylistbr == 1 ? '<br>' : ' ') : '') + t
1986                    }
1987                    o.actions.Title('title')
1988                }
1989            }
1990            if (v.pointed == 1) {
1991                if (exist(o.playlist_dic[id]['points'])) {
1992                    v.points = o.playlist_dic[id]['points']
1993                } else {
1994                    v.points = []
1995                }
1996                o.controls.RenewPoints()
1997            }
1998            var xv = ['remove', 'thumbnails', 'download', 'skip', 'url', 'url2', 'url3', 'vars', 'embed', 'end', 'delete', 'heartbeat', 'outside', 'label', 'title2', 'casturl', 'customtext', 'autonext'];
1999            for (var i = 0; i < xv.length; i++) {
2000                var tpp = o.playlist_dic[id][xv[i]];
2001                if (exist(tpp)) {
2002                    o.plopt[xv[i]] = tpp;
2003                    v[xv[i]] = tpp;
2004                    if (i == 16) {
2005                        v.playlist.autoplaylist = tpp
2006                    }
2007                } else {
2008                    i < 4 ? v[xv[i]] = undefined : ''
2009                }
2010            }
2011            UpdateStart(id);
2012            var opid = o.playlist_dic[id];
2013            if (exist(opid['sub'])) {
2014                opid['subtitle'] = opid['sub']
2015            }
2016            if (exist(opid['subtitle'])) {
2017                o.actions.Subtitle(opid['subtitle'])
2018            }
2019            if (exist(opid['customtext'])) {
2020                o.controls.customTextPl()
2021            }
2022            o.actions.Ctxt(o.playlist_dic[id]);
2023            if (o.ctxtnk) {
2024                o.controls.upText(o.ctxtnk)
2025            }
2026            if (exist(opid['design'])) {
2027                apiProcessor('design', opid['design'])
2028            }
2029            if (exist(opid.volume)) {
2030                o.actions.Volume(opid.volume)
2031            }
2032        }
2033
2034        function UpdateStart(id) {
2035            var x = o.playlist_dic[id]['start'];
2036            if (exist(x)) {
2037                if (x == "continue") {
2038                    if (options.subtitle && !o.playlist_dic[id]['subtitle']) {
2039                        o.playlist_dic[id]['subtitle'] = options.subtitle
2040                    }
2041                    if (o.media.time() > 0) {
2042                        v.start = o.seekto = o.media.time()
2043                    } else {
2044                        options.start && !o.seekto ? o.seekto = options.start : v.start = 0
2045                    }
2046                } else {
2047                    v.start = o.seekto = x
2048                }
2049            } else {
2050                v.start = 0
2051            }
2052        }
2053
2054        function ActionPlaylist(x) {
2055            if (plx == 0 && !o.start) {
2056                css(ftitle[plx], {
2057                    'color': style.color
2058                });
2059                css(fbg[plx], {
2060                    'backgroundColor': style.bgcolor
2061                });
2062                fvalue[plx].innerHTML = '';
2063                f[plx].classList.remove('pjs-' + v.id + '-active-pl')
2064            } else {
2065                o.plopenid = x;
2066                if (plx > -1) {
2067                    HistoryPlaylist(plx)
2068                }
2069                if (plid != '') {
2070                    if (!o.plhistory[plid] && exist(o.playlist_dic[plid])) {
2071                        o.pldur2 += existv(o.playlist_dic[plid].duration, 0)
2072                    }
2073                    o.plhistory[plid] = true;
2074                    shuffle = removebykey(shuffle, plid)
2075                }
2076            }
2077            if (faction[x]) {
2078                var id = faction[x].substr(8);
2079                fvalue[x].innerHTML = _activeIcon;
2080                f[x].classList.add('pjs-' + v.id + '-active-pl');
2081                css(ftitle[x], {
2082                    'color': style.valuecolor,
2083                    'text-decoration': 'none',
2084                    'opacity': style.a
2085                });
2086                BgBrAct(fbg[x]);
2087                if (style.playbgcolored == 1 && exist(style.playbgcolor)) {
2088                    css(fbg[x], {
2089                        'backgroundColor': style.playbgcolor
2090                    })
2091                }
2092                plx = x;
2093                plid = id;
2094                o.plid = plid;
2095                v.plstart = plid;
2096                o.playlist_title = ftitle[x].innerHTML;
2097                o.plopenid = plid;
2098                plfolder = o.playlist_dic[id]['pjs_parent'];
2099                if (o.controls) {
2100                    o.controls.PlaylistControls()
2101                }
2102                if (srch) {
2103                    srch.clear()
2104                }
2105            }
2106        }
2107
2108        function UpdatePlaylist(id) {
2109            var x = id == 0 ? o.playlist : o.playlist_dic[id];
2110            o.plopenid = id;
2111            for (var i = 0; i < f.length; i++) {
2112                if (f[i]) {
2113                    if (style.floatleft == 1) {
2114                        control.removeChild(f[i])
2115                    } else {
2116                        control2.removeChild(f[i])
2117                    }
2118                    f[i] = null
2119                }
2120            }
2121            f = [];
2122            plx = -1;
2123            if (exist(x['folder'])) {
2124                var y = Object.keys(x['folder']).length;
2125                CreateItem('f', y);
2126                faction[y] = "playlistfolder";
2127                StyleItem(f[y], fbg[y], ftitle[y], fvalue[y], y);
2128                if (style.floatleft == 1) {
2129                    css(f[y], {
2130                        "width": (style.floatlimitwidth == 1 ? style.floatwidth : "auto"),
2131                        "height": style.floatheight
2132                    })
2133                }
2134                if (style.borderbottom == 1) {
2135                    var hdbrdclr = "1px solid " + hex2rgb(style.headbordercolor, existv(style.brda, 1
2135));
2136                    if (style.floatleft == 1) {
2137                        css(f[y], {
2138                            "borderRight": hdbrdclr
2139                        })
2140                    } else {
2141                        css(f[y], {
2142                            "borderBottom": hdbrdclr
2143                        })
2144                    }
2145                }
2146                var tmp = x.title;
2147                if (style.noprevicon != 1) {
2148                    tmp = _prevIcon + tmp
2149                }
2150                ftitle[y].innerHTML = tmp;
2151                css(ftitle[y], {
2152                    'font-size': style.headfontsize * existv(v.globalfs, 1)
2153                });
2154                var p = x['pjs_parent'];
2155                f[y].addEventListener(evntovr, onOver);
2156                f[y].addEventListener(evntout, onOut);
2157                f[y].addEventListener(evntclk, function () {
2158                    PlaylistBack(p)
2159                });
2160                x = x['folder']
2161            }
2162            var y = Object.keys(x).length;
2163            shuffle = [];
2164            shuffle_ = [];
2165            if (srch && style.floatleft != 1) {
2166                srch.remove(control2);
2167                if (y > v.playlist.srch) {
2168                    srch.add(style, control2)
2169                }
2170            }
2171            for (var i = 0; i < y; i++) {
2172                CreateItem('f', i);
2173                faction[i] = "playlist" + x[i].id;
2174                if (!exist(o.plhistory[x[i].id]) && !exist(x[i].folder)) {
2175                    shuffle[x[i].id] = i;
2176                    shuffle_[x[i].id] = i
2177                }
2178                StyleItem(f[i], fbg[i], ftitle[i], fvalue[i], i);
2179                if (style.floatleft == 1) {
2180                    if (style.activeiconsize == 0) {
2181                        css(ftitle[i], {
2182                            'width': style.floatwidth - style.paddingleft - style.paddingright
2183                        });
2184                        hide2(fvalue[i])
2185                    }
2186                    css(f[i], {
2187                        "width": (style.floatlimitwidth == 1 ? style.floatwidth : "auto"),
2188                        "height": style.floatheight
2189                    })
2190                }
2191                ftitle[i].innerHTML = x[i].title ? x[i].title : '&nbsp;';
2192                if (v.timestore == 1 && v.playedstore == 1 && x[i].id) {
2193                    if (o.playedstored) {
2194                        if (o.playedstored.indexOf(x[i].id) > -1) {
2195                            x[i].played = 1
2196                        }
2197                    }
2198                }
2199                if (exist(x[i].played)) {
2200                    if (x[i].played == 1) {
2201                        o.plhistory[x[i].id] = true;
2202                        HistoryPlaylist(i)
2203                    }
2204                }
2205                if (exist(x[i].folder)) {
2206                    fvalue[i].innerHTML = _nextIcon;
2207                    css(fvalue[i], {
2208                        "color": style.color
2209                    })
2210                }
2211                f[i].addEventListener(evntovr, onOver);
2212                f[i].addEventListener(evntout, onOut);
2213                f[i].addEventListener(evntclk, onClick);
2214                f[i].addEventListener("mouseup", onMouseUp);
2215                if (exist(o.plhistory[x[i].id])) {
2216                    HistoryPlaylist(i)
2217                }
2218                if (plid == x[i].id) {
2219                    ActionPlaylist(i)
2220                }
2221                if (plfolder == x[i].id) {
2222                    css(ftitle[i], {
2223                        'color': style.valuecolor
2224                    });
2225                    css(fvalue[i], {
2226                        'color': style.valuecolor
2227                    });
2228                    BgBrAct(fbg[i])
2229                }
2230            }
2231            Resize();
2232            empty = false;
2233            o.controls ? o.controls.refresh() : ''
2234        }
2235
2236        function BgBrAct(x) {
2237            if (exist2(style.bgbract) && x) {
2238                css(x, {
2239                    "background-image": "linear-gradient(rgba(0, 0, 0, " + (1 - style.bgbract * 1) + ") 0 0)"
2240                })
2241            }
2242        }
2243
2244        function StyleArrow(x, y, z, x1, y1, x2, y2, x3, y3, x4, y4) {
2245            var ww = (style.floatleft == 1 ? '40px' : '100%');
2246            var hh = (style.floatleft == 1 ? '100%' : '40px');
2247            css(x, {
2248                'position': 'absolute',
2249                'display': 'inline-block',
2250                'width': ww,
2251                'height': hh,
2252                'text-align': 'center'
2253            });
2254            if (style.scrollarrowgradient == 1) {
2255                css(x, {
2256                    'background': '-moz-linear-gradient(' + y + ')',
2257                    'background': '-webkit-linear-gradient(' + y + ')',
2258                    'background': '-ms-linear-gradient(' + y + ')',
2259                    'background': '-o-linear-gradient(' + y + ')',
2260                    'background': 'linear-gradient(' + y + ')',
2261                })
2262            }
2263            if (style.floatleft == 1 || o.system.mobile) {
2264                css(x, {
2265                    'cursor': 'pointer'
2266                })
2267            } else {
2268                css(x, {
2269                    'pointer-events': 'none'
2270                })
2271            }
2272            if (style.limitwidth == 1) {
2273                css(x, {
2274                    'max-width': style.limitmaxwidth + 'px!important'
2275                })
2276            }
2277            if (z == "top") {
2278                css(x, {
2279                    'top': -1,
2280                    'left': 0
2281                })
2282            }
2283            if (z == "bottom") {
2284                css(x, {
2285                    'bottom': -1,
2286                    'left': 0
2287                })
2288            }
2289            if (z == "left") {
2290                css(x, {
2291                    'top': 0,
2292                    'left': 0
2293                })
2294            }
2295            if (z == "right") {
2296                css(x, {
2297                    'top': 0,
2298                    'right': 0
2299                })
2300            }
2301            if (z == "right" || z == "left") {
2302                css(x, {
2303                    'text-align': 'left',
2304                    'padding-top': container.offsetHeight / 2 - 10
2305                })
2306            }
2307            x.innerHTML = "<center><div " + (style.scrollarrowbgover == 1 ? "onMouseOver='this.style.backgroundColor=\"#" + style.scrollarrowbgovercolor + "\"' onMouseOut='" + (style.scrollarrowbg == 1 ? "this.style.backgroundColor=\"#" + style.scrollarrowbgcolor : "this.style.background=\"none") + "\"'" : "") + " style='pointer-events:auto;cursor:pointer;width:20px;height:20px;border-radius:20px;" + (style.scrollarrowbg == 1 ? "background-color:#" + style.scrollarrowbgcolor + ";" : "") + (z == "top" ? "margin-top:10px;" : "") + (z == "bottom" ? "margin-top:10px;" : "") + (z == "right" ? "margin-left:0px;" : "") + (z == "left" ? "margin-right:0px;" : "") + "'><svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><line x1='" + x1 + "' y1='" + y1 + "' x2='" + x2 + "' y2='" + y2 + "' stroke='#" + style.scrollarrowcolor + "' stroke-width='" + style.scrollarrowsize + "' stroke-linecap='round'/><line x1='" + x3 + "' y1='" + y3 + "' x2='" + x4 + "' y2='" + y4 + "' stroke='#" + style.scrollarrowcolor + "' stroke-width='" + style.scrollarrowsize + "' stroke-linecap='round'/></g></svg></div></center>"
2308        }
2309        this.Arrows = function () {
2310            if (style.scrollarrows == 1) {
2311                Arrows()
2312            }
2313        };
2314
2315        function ArrowsInterval() {
2316            if (is_visible) {
2317                Arrows()
2318            }
2319        }
2320
2321        function Arrows(e) {
2322            if (style.scrollarrows == 1 && !removed) {
2323                if (style.floatleft == 1) {
2324                    var h = control.scrollWidth;
2325                    var m = container.offsetWidth + style.bgpaddingleft + style.bgpaddingright + 20;
2326                    var t = control.scrollLeft
2327                } else {
2328                    var h = control.scrollHeight;
2329                    var m = container.offsetHeight;
2330                    var t = control.scrollTop
2331                }
2332                if (h > m) {
2333                    if (t > 0) {
2334                        if (!isVisible(arr_up)) {
2335                            show(arr_up);
2336                            var m1 = new Motion({
2337                                "mc": arr_up,
2338                                "type": "alpha_div",
2339                                "to": 1,
2340                                "time": 0.3,
2341                                "me": "arr_up"
2342                            })
2343                        }
2344                    } else {
2345                        if (isVisible(arr_up)) {
2346                            var m2 = new Motion({
2347                                "mc": arr_up,
2348                                "type": "alpha_div",
2349                                "to": 0,
2350                                "time": 0.3,
2351                                "me": "arr_up",
2352                                "hide": true
2353                            })
2354                        }
2355                        if (e) {
2356                            e.deltaY < 0 ? e.preventDefault() : ''
2357                        }
2358                    }
2359                    if (t < h - m - 10) {
2360                        if (!isVisible(arr_down)) {
2361                            show(arr_down);
2362                            var m3 = new Motion({
2363                                "mc": arr_down,
2364                                "type": "alpha_div",
2365                                "to": 1,
2366                                "time": 0.3,
2367                                "me": "arr_down"
2368                            })
2369                        }
2370                    } else {
2371                        if (isVisible(arr_down)) {
2372                            var m4 = new Motion({
2373                                "mc": arr_down,
2374                                "type": "alpha_div",
2375                                "to": 0,
2376                                "time": 0.3,
2377                                "me": "arr_down",
2378                                "hide": true
2379                            })
2380                        }
2381                        if (e) {
2382                            e.deltaY > 0 ? e.preventDefault() : ''
2383                        }
2384                    }
2385                } else {
2386                    hide(arr_up);
2387                    hide(arr_down)
2388                }
2389            }
2390        }
2391
2392        function ScrollDown() {
2393            var x = control.scrollTop + container.offsetHeight - 60;
2394            var m = new Motion({
2395                "mc": control,
2396                "type": "scroll",
2397                "to": x,
2398                "time": 0.3,
2399                "me": "scroll_down",
2400                "ease": "cubic"
2401            });
2402            setTimeout(Arrows, 1000)
2403        }
2404
2405        function ScrollUp() {
2406            var x = control.scrollTop - container.offsetHeight + 60;
2407            var m = new Motion({
2408                "mc": control,
2409                "type": "scroll",
2410                "to": x,
2411                "time": 0.3,
2412                "me": "scroll_up",
2413                "ease": "cubic"
2414            });
2415            setTimeout(Arrows, 1000)
2416        }
2417
2418        function ScrollOverOut(event) {
2419            clearTimeout(o.settingsovertimer);
2420            event.stopPropagation()
2421        }
2422
2423        function ScrollRight() {
2424            var x = control.scrollLeft + (container.offsetWidth + style.bgpaddingleft + style.bgpaddingright) - 60;
2425            var m = new Motion({
2426                "mc": control,
2427                "type": "scrollleft",
2428                "to": x,
2429                "time": 0.3,
2430                "me": "scroll_right",
2431                "ease": "cubic"
2432            });
2433            setTimeout(Arrows, 1000)
2434        }
2435
2436        function ScrollLeft() {
2437            var x = control.scrollLeft - (container.offsetWidth + style.bgpaddingleft + style.bgpaddingright) + 60;
2438            var m = new Motion({
2439                "mc": control,
2440                "type": "scrollleft",
2441                "to": x,
2442                "time": 0.3,
2443                "me": "scroll_left",
2444                "ease": "cubic"
2445            });
2446            setTimeout(Arrows, 1000)
2447        }
2448
2449        function PlaylistBack(x) {
2450            if (x == '') {
2451                UpdatePlaylist(0)
2452            } else {
2453                if (exist(o.playlist_dic[x])) {
2454                    UpdatePlaylist(x)
2455                }
2456            }
2457            open_action = ''
2458        }
2459
2460        function HistoryPlaylist(x) {
2461            fvalue[x].innerHTML = '';
2462            css(ftitle[x], {
2463                'color': style.historycolor
2464            });
2465            if (style.historytitlestrike == 1) {
2466                css(ftitle[x], {
2467                    'text-decoration': 'line-through'
2468                })
2469            }
2470            if (style.historytitlea > -1) {
2471                css(ftitle[x], {
2472                    'opacity': style.historytitlea
2473                })
2474            }
2475            f[x].classList.remove('pjs-' + v.id + '-active-pl');
2476            css(fbg[x], {
2477                'backgroundColor': style.historybgcolor
2478            });
2479            if (style.historybga > -1) {
2480                css(fbg[x], {
2481                    'opacity': style.historybga
2482                })
2483            }
2484        }
2485
2486        function Action2(i) {
2487            if (exist(f2action[i])) {
2488                Retimer();
2489                if (f2i("quality", i) == 0) {
2490                    o.actions.SetQuality(f2action[i].substr(7))
2491                }
2492                if (f2i("audiotrack", i) == 0) {
2493                    o.actions.SetAudioTrack(f2action[i].substr(10))
2494                }
2495                if (f2i("subtitle", i) == 0) {
2496                    !o.sbt ? o.sbt = new PluginSub() : '';
2497                    o.sbt.SetSubtitle(f2action[i].substr(8))
2498                }
2499                if (f2i("channel", i) == 0 && v.channels == 1) {
2500                    o.channels.SetChannel(f2action[i].substr(7))
2501                }
2502                if (f2i("custom", i) == 0) {
2503                    var act = f2action[i].slice(0, -1);
2504                    o['current_' + act] != -1 ? o['current_' + act] = i - 1 : '';
2505                    if (o['files_' + act]) {
2506                        var mi = act.slice(-1);
2507                        if (o['m' + mi + '_' + 'api'][i - 1] != '') {
2508                            var ap = o['m' + mi + '_' + 'api'][i - 1].split(":");
2509                            apiProcessor(ap[0], ap.length > 1 ? ap[1] : null)
2510                        }
2511                        if (exist(window['PlayerjsMenu' + mi])) {
2512                            v['menu' + mi] = i - 1;
2513                            window['PlayerjsMenu' + mi](v.id, o['files_' + act][i - 1], i - 1)
2514                        }
2515                    }
2516                    Value(open_settings);
2517                    HideControl()
2518                }
2519                if (f2i("share", i) == 0) {
2520                    o.share ? o.share.api(shr[i]) : '';
2521                    HideControl()
2522                }
2523                if (f2i("color", i) == 0) {
2524                    Remove2();
2525                    Action(0, 0, clr[i])
2526                }
2527                for (var p in o.menuproc) {
2528                    if (o.menuproc.hasOwnProperty(p)) {
2529                        if (f2i(p, i) == 0) {
2530                            o.media.menufltr(p, i)
2531                        }
2532                    }
2533                }
2534                if (f2i("timer", i) > 0) {
2535                    if (f2title[i].innerHTML == Lang('off')) {
2536                        SettingsTimers(open_action + '0');
2537                        Value(open_settings);
2538                        if (open_action == "offsettimer") {
2539                            SettingsTimers("offsetwrite")
2540                        }
2541                        Home()
2542                    } else {
2543                        if (open_action == "sleeptimer" && style.sleep2 == 1) {
2544                            SettingsTimers('sleep2', i);
2545                            Value(open_settings);
2546                            Home()
2547                        }
2548                    }
2549                }
2550                if (f2i("speed", i) == 0) {
2551                    o.actions.SetSpeed(f2action[i].substr(5));
2552                    UpdateSpeed();
2553                    setTimeout(HideControl, 200)
2554                }
2555            }
2556        };
2557        this.UpdateSpeed = function () {
2558            UpdateSpeed()
2559        };
2560        this.Exist = function (x) {
2561            for (var i = 0; i < faction.length; i++) {
2562                if (faction[i] == x) {
2563                    return true
2564                }
2565            }
2566            return false
2567        };
2568
2569        function UpdateSpeed() {
2570            for (var i = 0; i < faction.length; i++) {
2571                if (faction[i] == "speed") {
2572                    Value(i);
2573                    if (open_action == 'speed') {
2574                        Remove2();
2575                        Action(i, 0)
2576                    }
2577                }
2578            }
2579        }
2580
2581        function CreateItem(x, i, toend) {
2582            if (exist(eval(x))) {
2583                eval(x)[i] = createElement("div");
2584                if (i < 2 || x == "f" || open_action != 'quality' || toend > 0) {
2585                    if (style.floatleft == 1) {
2586                        control.appendChild(eval(x)[i])
2587                    } else {
2588                        control2.appendChild(eval(x)[i])
2589                    }
2590                } else {
2591                    if (style.floatleft == 1) {
2592                        control.insertBefore(eval(x)[i], eval(x)[i - 1])
2593                    } else {
2594                        control2.insertBefore(eval(x)[i], eval(x)[toend == 2 ? i - 2 : i - 1])
2595                    }
2596                }
2597                if (x == 'f') {
2598                    attr(eval(x)[i], {
2599                        'fid': i
2600                    })
2601                }
2602                if (x == 'f2') {
2603                    attr(eval(x)[i], {
2604                        'f2id': i
2605                    })
2606                }
2607                eval(x + 'bg')[i] = createElement("div");
2608                var bgtmp = createElement("div");
2609                eval(x)[i].appendChild(bgtmp);
2610                bgtmp.appendChild(eval(x + 'bg')[i]);
2611                Pnt0(bgtmp);
2612                eval(x + 'img')[i] = createElement("div");
2613                eval(x)[i].appendChild(eval(x + 'img')[i]);
2614                Pos0(eval(x + 'img')[i]);
2615                Pnt0(eval(x + 'img')[i]);
2616                eval(x + 'title')[i] = createElement("div");
2617                eval(x)[i].appendChild(eval(x + 'title')[i]);
2618                eval(x + 'value')[i] = createElement("div");
2619                eval(x)[i].appendChild(eval(x + 'value')[i]);
2620                if (i > 0 && x == "f2" && iset && style.activeicon == 0) {
2621                    hide2(eval(x + 'value')[i])
2622                }
2623            }
2624        };
2625
2626        function StyleItem(x, xbg, xtitle, xvalue, actn, ii) {
2627            css(x, {
2628                'position': 'relative',
2629                'right': 0,
2630                'top': 0,
2631                'cursor': 'pointer',
2632                'height': 'auto',
2633                'width': '100%',
2634                'overflow': 'hidden',
2635                'display': 'block',
2636                'line-height': '1.5em'
2637            });
2638            if (iset) {
2639                if (style.floatleft == 1) {
2640                    css(x, {
2641                        'width': 'auto'
2642                    })
2643                }
2644            }
2645            if (style.floatmarginright && style.floatleft == 1) {
2646                css(x, {
2647                    'marginRight': style.floatmarginright
2648                })
2649            }
2650            if (style.floatleft == 1 && (!iset || ii > 0 || style.nohead == 1)) {
2651                css(x, {
2652                    'display': 'inline-block',
2653                    'vertical-align': 'top',
2654                    'white-space': 'normal'
2655                })
2656            }
2657            css(xbg, {
2658                'background': (style.bggr == 1 ? "linear-gradient(to left," + CheckColor(style.bggrclr) + ", " + CheckColor(style.bgcolor) + ")" : CheckColor(style.bgcolor)),
2659                'opacity': style.bga,
2660                'pointerEvents': 'none',
2661                'transition': 'opacity 0.2s ease-out,background .2s ease-out,filter .2s ease-out'
2662            });
2663            Pos0(xbg);
2664            Pos0(xbg.parentNode);
2665            if (style.blur == 1) {
2666                css(xbg.parentNode, {
2667                    'backdrop-filter': 'blur(8px)'
2668                })
2669            }
2670            if (style.brdl == 1) {
2671                x.style[style.floatleft == 1 ? "border-right" : "border-bottom"] = "1p
2671x solid " + hex2rgb(existv(style.brdlc, 'ffffff'), existv(style.brdla, 0.2))
2672            }
2673            css(xtitle, {
2674                'position': 'relative',
2675                'right': 0,
2676                'top': 0,
2677                'float': (style.align ? style.align : 'left'),
2678                'color': style.color,
2679                'padding-top': style.paddingtop,
2680                'padding-right': style.paddingright,
2681                'padding-bottom': style.paddingbottom,
2682                'padding-left': style.paddingleft,
2683                'pointerEvents': 'none',
2684                'opacity': style.a,
2685                'transition': 'opacity 0.2s linear,color 0.2s linear',
2686            });
2687            css(xvalue, {
2688                'position': 'relative',
2689                'right': 0,
2690                'top': 0,
2691                'float': (style.valuealign ? style.valuealign : 'right'),
2692                'padding-top': style.paddingtop,
2693                'padding-right': style.paddingright,
2694                'padding-left': style.paddingleft,
2695                'pointerEvents': 'none',
2696                'font-size': style.valuefontsize * existv(v.globalfs, 1),
2697                'opacity': style.a,
2698                'color': style.valuecolor,
2699                'transition': 'opacity 0.2s linear,color 0.2s linear'
2700            });
2701            if (style.limitwidth == 1) {
2702                css(x, {
2703                    'max-width': style.limitmaxwidth + 'px!important'
2704                });
2705                css(xtitle, {
2706                    'max-width': (style.limitmaxwidth - 70) + 'px!important'
2707                })
2708            } else {
2709                if (style.floatleft == 1) {
2710                    if (style.floatlimitwidth == 1) {
2711                        css(x, {
2712                            'width': style.floatwidth
2713                        });
2714                        css(xtitle, {
2715                            'width': style.floatwidth - 70
2716                        })
2717                    }
2718                } else {
2719                    css(xtitle, {
2720                        'white-space': 'nowrap'
2721                    });
2722                    css(xvalue, {
2723                        'white-space': 'nowrap'
2724                    })
2725                }
2726            }
2727        }
2728
2729        function Home() {
2730            for (var i = 1; i < f.length; i++) {
2731                if (exist(f[i])) {
2732                    if (style.floatleft == 1) {
2733                        f[i].style.display = "inline-block"
2734                    } else {
2735                        f[i].style.display = "block"
2736                    }
2737                }
2738            }
2739            Retimer();
2740            Remove2();
2741            Resize();
2742            open_action = '';
2743            open_settings = -1
2744        };
2745
2746        function Remove2() {
2747            for (var j = 0; j < f2.length; j++) {
2748                if (f2[j]) {
2749                    if (style.floatleft == 1) {
2750                        control.removeChild(f2[j])
2751                    } else {
2752                        control2.removeChild(f2[j])
2753                    }
2754                    f2[j] = null
2755                }
2756            }
2757            f2 = [];
2758            open_action = ''
2759        }
2760
2761        function Width() {
2762            return control.offsetWidth
2763        };
2764        this.resizePlaylist = function () {
2765            ResizePlaylist()
2766        };
2767
2768        function ResizePlaylist() {
2769            if (is == "playlist") {
2770                if (style.floatleft == 1 || style.width100 == 1) {
2771                    var x = o.screen_w - style.marginright - style.marginleft;
2772                    css(container, {
2773                        'width': x
2774                    });
2775                    css(control, {
2776                        'width': x
2777                    });
2778                    control2 ? css(control2, {
2779                        'width': x
2780                    }) : ''
2781                }
2782                o.droplist ? o.droplist.Resize() : ''
2783            }
2784        }
2785
2786        function Resize() {
2787            if (!removed) {
2788                if (iset) {
2789                    o.controls ? o.controls.resizeSettings() : '';
2790                    var x = style.nohead == 1 && f.length > 1 ? f[1] : f[0]
2791                }
2792                if (is == "playlist") {
2793                    ResizePlaylist();
2794                    o.controls ? o.controls.resizePlaylist() : '';
2795                    var x = f[0];
2796                    if (v.change2playlist == 1) {
2797                        MainUpdateSize()
2798                    }
2799                }
2800                f.length > 1 && !x ? (f[1] ? x = f[1] : '') : '';
2801                f.length > 2 && !x ? (f[2] ? x = f[2] : '') : '';
2802                if (x) {
2803                    x.offsetWidth == 0 && f2.length > 0 ? x = f2[0] : ''
2804                }
2805                if (control.offsetWidth - control.clientWidth > 0 && x && style.floatleft != 1) {
2806                    if (exist(arr_up)) {
2807                        css(arr_up, {
2808                            "width": control2.offsetWidth
2809                        })
2810                    }
2811                    if (exist(arr_down)) {
2812                        css(arr_down, {
2813                            "width": control2.offsetWidth
2814                        })
2815                    }
2816                    style.scrollwidth = (control.offsetWidth - x.offsetWidth) - (control.clientWidth - x.clientWidth)
2817                } else {
2818                    style.scrollwidth = 0
2819                }
2820            }
2821        };
2822
2823        function VisibleItems() {
2824            var x = 0;
2825            var y = 0;
2826            var z = '';
2827            for (var i = 1; i < f.length; i++) {
2828                if (exist(f[i])) {
2829                    if (f[i].style.visibility != "hidden" && f[i].style.display != "none") {
2830                        x++;
2831                        y = i;
2832                        z = faction[i]
2833                    }
2834                }
2835            }
2836            return [x, y, z]
2837        }
2838        this.SubOpt = function () {
2839            sub_settings_on = true;
2840            this.show();
2841            _cstm = 2;
2842            SubtitleSettingsMenu()
2843        };
2844
2845        function SubtitleSettings(x) {
2846            sub_settings_on = true;
2847            SubtitleSettingsMenu(x);
2848            if (sub_settings_on && subopt1) {
2849                control.scrollTo(0, subopt1.offsetTop)
2850            }
2851        }
2852
2853        function SubtitleSettingsClose(x) {
2854            sub_settings_on = false;
2855            SubtitleSettingsMenu(x)
2856        }
2857
2858        function SubtitleSettingsMenu() {
2859            Home();
2860            for (var i = 0; i < faction.length; i++) {
2861                if (faction[i] == "subtitle") {
2862                    Action(i, _cstm)
2863                }
2864            }
2865        }
2866
2867        function Retimer() {
2868            clearTimeout(settimer);
2869            settimer = setTimeout(function () {
2870                o.setaction = false
2871            }, 2000)
2872        }
2873
2874        function SubtitleTimerMenu() {
2875            var x = open_action;
2876            Home();
2877            for (var i = 0; i < faction.length; i++) {
2878                if (faction[i] == x) {
2879                    Action(i, 0)
2880                }
2881            }
2882        }
2883        this.tb = function () {
2884            return v.settings.always == 1 && v.settings.toolbar == 1
2885        };
2886
2887        function HideControl(x) {
2888            if ((!iset && v.playlist.always2 == 1) || (iset && v.settings.always == 1 && x != 2)) {
2889                return
2890            }
2891            if (is == 'playlist' && v.playlist.droplist == 1 && v.playlist.dropnohide != 1) {
2892                if (v.playlist.always == 1 && x == 1) {
2893                    return
2894                }
2895                o.droplist ? o.droplist.Hide() : '';
2896                is_visible = false
2897            } else {
2898                if ((x != 1 || (style.hidesmoothly == 1 && style.always == 1)) && !o.system.tv) {
2899                    var m = new Motion({
2900                        "mc": container,
2901                        "type": "alpha_div",
2902                        "to": 0,
2903                        "time": 0.1,
2904                        "me": is,
2905                        "ease": "elastic"
2906                    });
2907                    hidetimeout = setTimeout(function () {
2908                        css(container, {
2909                            "visibility": "hidden",
2910                            "opacity": 0,
2911                            "top": -2000
2912                        });
2913                        is_visible = false
2914                    }, 200)
2915                } else {
2916                    css(container, {
2917                        "visibility": "hidden",
2918                        "opacity": 0,
2919                        "top": -2000
2920                    });
2921                    is_visible = false
2922                }
2923            }
2924            if (is == 'playlist') {
2925                if (v.playlist.hidecontrol == 1 && o.controls) {
2926                    o.controls.toggleControl("action", "playlist", true)
2927                }
2928            }
2929            clearInterval(wheelinterval)
2930        };
2931        this.c = function () {
2932            return container
2933        };
2934        this.co = function () {
2935            if (container.contains(control)) {
2936                return control
2937            }
2938        };
2939        this.s = function (key) {
2940            if (key == "marginleft" || key == "marginright") {
2941                var k2 = key.replace("margin", "marginproc");
2942                var k3 = key.replace("margin", "mrgnprs");
2943                if (exist2(style[k3]) && o.small) {
2944                    return o.screen_w * style[k3] / 100
2945                }
2946                if (exist2(style[k2])) {
2947                    return o.screen_w * style[k2] / 100
2948                }
2949            }
2950            return style[key]
2951        };
2952        this.ss = function (key) {
2953            return style
2954        };
2955        this.show = function () {
2956            Home();
2957            clearTimeout(hidetimeout);
2958            is_visible = true;
2959            if (is == 'playlist' && v.playlist.droplist == 1) {
2960                o.droplist ? o.droplist.Show() : ''
2961            } else {
2962                css(container, {
2963                    "visibility": "visible",
2964                    "opacity": 1,
2965                    "transition": "opacity 0.2s linear"
2966                });
2967                var x = VisibleItems();
2968                if (x[0] == 1) {
2969                    if (x[2] == "quality" || x[2] == "audiotrack" || x[2] == "subtitle" || x[2] == "speed" || x[2] in o.menuproc || x[2].indexOf("timer") > 0) {
2970                        Action(x[1], 0)
2971                    }
2972                }
2973            }
2974            if (o.controls) {
2975                is == 'settings' ? o.controls.resizeSettings() : '';
2976                if (is == 'playlist') {
2977                    o.controls.resizePlaylist();
2978                    if (v.playlist.hidecontrol == 1) {
2979                        o.controls.toggleControl("action", "playlist", false)
2980                    }
2981                }
2982            }
2983            if (o.system.safari) {
2984                css(control, {
2985                    'min-width': 'auto'
2986                });
2987                if (style.floatleft != 1) {
2988                    css(control2, {
2989                        'min-width': 'auto'
2990                    })
2991                }
2992            }
2993            justshow = true;
2994            clearInterval(showinterval);
2995            showinterval = setInterval(ShowTimeout, 100)
2996        };
2997
2998        function ShowTimeout() {
2999            clearInterval(showinterval);
3000            justshow = false
3001        }
3002        this.open = function (i) {
3003            Action(i, 1)
3004        };
3005        this.hide = function (x) {
3006            HideControl(x)
3007        };
3008        this.plclose = function () {
3009            if (o.droplist) {
3010                o.droplist.Close()
3011            }
3012        };
3013        this.SetQuality = function () {
3014            for (var i = 0; i < faction.length; i++) {
3015                if (faction[i] == "quality") {
3016                    Value(i);
3017                    if (o.files_quality.length > 1) {
3018                        show(f[i])
3019                    }
3020                    if (open_action == 'quality') {
3021                        Remove2();
3022                        Action(i, _cstm)
3023                    }
3024                }
3025            }
3026        };
3027        this.Airplay = function () {
3028            for (var i = 0; i < faction.length; i++) {
3029                if (faction[i] == "airplay") {
3030                    Value(i)
3031                }
3032            }
3033        };
3034        this.SetSetting = function (x) {
3035            for (var i = 0; i < faction.length; i++) {
3036                if (faction[i] == x) {
3037                    Value(i);
3038                    if (o['files_' + x]) {
3039                        if (o['files_' + x].length > 1) {
3040                            show(f[i])
3041                        }
3042                    }
3043                    if (open_action == x) {
3044                        Remove2();
3045                        Action(i, _cstm)
3046                    }
3047                }
3048            }
3049        };
3050        this.SetSubtitle = function () {
3051            for (var i = 0; i < faction.length; i++) {
3052                if (faction[i] == "subtitle") {
3053                    Value(i);
3054                    if (o.files_subtitle) {
3055                        if (o.files_subtitle.length > 0) {
3056                            var x = false;
3057                            if (o.subs) {
3058                                for (var y = 0; y < o.subs.length; y++) {
3059                                    if (o.subs[y] != '') {
3060                                        x = true;
3061                                        break
3062                                    }
3063                                }
3064                            } else {
3065                                x = true
3066                            }
3067                            x ? show(f[i]) : ''
3068                        }
3069                    }
3070                    if (open_action == 'subtitle') {
3071                        Remove2();
3072                        Action(i, 0)
3073                    }
3074                }
3075            }
3076        };
3077        this.updatePlaylist = function (x) {
3078            o.playlist = x;
3079            UpdatePlaylist(0);
3080            if (exist(v.plstart)) {
3081                if (v.plstart.indexOf("x-") != 0) {
3082                    for (var y in o.playlist_dic) {
3083                        if (o.playlist_dic.hasOwnProperty(y)) {
3084                            if (o.playlist_dic[y].pjs_id == v.plstart) {
3085                                v.plstart = y
3086                            }
3087                        }
3088                    }
3089                }
3090                if (exist(o.playlist_dic[v.plstart])) {
3091                    FindPlStart(o.playlist_dic[v.plstart]);
3092                    var y = o.playlist_dic[v.plstart]['pjs_i'];
3093                    ActionPlaylist(y);
3094                    if (v.playlist.openplaylistroot == 1 && style.droplist != 1) {
3095                        UpdatePlaylist(0);
3096                        setTimeout(function () {
3097                            Resize()
3098                        }, 500)
3099                    } else {
3100                        setTimeout(function () {
3101                            ScrollTo(y);
3102                            Resize()
3103                        }, 500)
3104                    }
3105                    v.plstart = undefined
3106                } else {
3107                    ActionPlaylist(0)
3108                }
3109            } else {
3110                ActionPlaylist(0)
3111            }
3112            if (style.droplist == 1) {
3113                if (!exist(o.droplist)) {
3114                    o.droplist = new PluginDroplist()
3115                }
3116            }
3117        };
3118        this.playById = function (x) {
3119            playById(x)
3120        };
3121
3122        function playById(x) {
3123            if (exist(o.playlist_dic[x])) {
3124                FindPlStart(o.playlist_dic[x]);
3125                Action(o.playlist_dic[x]['pjs_i'], 0);
3126                ScrollTo(o.playlist_dic[x]['pjs_i'])
3127            }
3128        };
3129        this.openById = function (x) {
3130            if (exist(o.playlist_dic[x])) {
3131                FindPlStart(o.playlist_dic[x]);
3132                if (o.playlist_dic[x]["file"]) {
3133                    o.seekto = undefined;
3134                    ActionPlaylist(o.playlist_dic[x]['pjs_i']);
3135                    UpdateVars0(x);
3136                    o.actions.NewFile(o.playlist_dic[x]["file"], 1);
3137                    UpdateVars(x);
3138                    ScrollTo(o.playlist_dic[x]['pjs_i']);
3139                    if (o.droplist) {
3140                        o.droplist.Update()
3141                    }
3142                } else if (o.playlist_dic[x]["folder"]) {
3143                    UpdatePlaylist(x)
3144                }
3145            }
3146        };
3147
3148        function showById(x) {
3149            if (exist(o.playlist_dic[x])) {
3150                plfolder = '';
3151                UpdatePlaylist(0);
3152                FindPlStart(o.playlist_dic[x]);
3153                UpdateVars0(x);
3154                Action(o.playlist_dic[x]['pjs_i'], 0);
3155                UpdateVars(x)
3156            }
3157        };
3158        this.PlaylistNext = function () {
3159            autonextopenfolder = true;
3160            var x = parseInt(plx) + 1;
3161            if (plid != '') {
3162                o.plhistory[plid] = true;
3163                shuffle = removebykey(shuffle, plid)
3164            }
3165            if (v.shuffle == 1) {
3166                x = Shuffle(shuffle);
3167                if (x == null) {
3168                    if (v.shuffle8 == 1 || v.playlist.autoplaylist == 1) {
3169                        shuffle_.sort(function (a, b) {
3170                            return Math.random() - 0.5
3171                        });
3172                        for (var x in shuffle_) {
3173                            if (shuffle_.hasOwnProperty(x)) {
3174                                shuffle[x] = shuffle_[x]
3175                            }
3176                        }
3177                        x = Shuffle(shuffle)
3178                    } else {
3179                        o.actions.ShuffleEnd()
3180                    }
3181                }
3182            } else {
3183                if ((faction[x] == "playlistfolder" || plx == -1) && pli
3183d != '') {
3184                    var y = okpd().indexOf(plid);
3185                    if (y < okpd().length) {
3186                        var z = o.playlist_dic[okpd()[y + 1]];
3187                        if (z) {
3188                            if (exist(z.folder)) {
3189                                z = o.playlist_dic[okpd()[y + 2]]
3190                            }
3191                            this.openById(z.id);
3192                            x = -1;
3193                            o.actions.Play()
3194                        }
3195                    }
3196                }
3197            }
3198            if (x > -1) {
3199                o.seekto = undefined;
3200                Action(x, 0);
3201                ScrollTo(x)
3202            }
3203        };
3204
3205        function ScrollTo(x) {
3206            if (f[x] && !removed) {
3207                if (style.floatleft == 1) {
3208                    var to = f[x].offsetLeft - 20;
3209                    var m = new Motion({
3210                        "mc": control,
3211                        "type": "scrollleft",
3212                        "to": to,
3213                        "time": 0.3,
3214                        "me": "scroll_left",
3215                        "ease": "cubic"
3216                    })
3217                } else {
3218                    var to = f[x].offsetTop - container.offsetHeight / 2 + 20;
3219                    var m = new Motion({
3220                        "mc": control,
3221                        "type": "scroll",
3222                        "to": to,
3223                        "time": 0.3,
3224                        "me": "scroll_down",
3225                        "ease": "cubic"
3226                    })
3227                }
3228                setTimeout(Arrows, 1000)
3229            }
3230        }
3231
3232        function Shuffle(obj) {
3233            var keys = Object.keys(obj);
3234            var x;
3235            for (var i = 0; i < keys.length; i++) {
3236                x = obj[keys[keys.length * Math.random() << 0]];
3237                if (x) {
3238                    break
3239                }
3240            }
3241            return x
3242        };
3243        this.menuproc = function (x) {
3244            Menuproc(x)
3245        };
3246
3247        function Menuproc(x) {
3248            mpi[x] > -1 ? Value(mpi[x]) : '';
3249            if (f2value[0]) {
3250                if (open_action == 'scale') {
3251                    f2value[0].innerHTML = Math.round(o.mediascale.x * 100) + '%'
3252                } else {
3253                    f2value[0].innerHTML = FltrVal(open_action)
3254                }
3255            }
3256        };
3257
3258        function FltrVal(x) {
3259            if (x == "scale") {
3260                return Math.round(o.mediascale.x * 100) + '%'
3261            } else {
3262                return Math.round(existv(o.fltrs[x], o.menuproc[x]) * 100) + '%'
3263            }
3264        }
3265        this.PlaylistNextExist = function () {
3266            return NxtExt()
3267        };
3268
3269        function NxtExt() {
3270            if (v.shuffle == 1) {
3271                return Object.keys(shuffle).length > 0
3272            }
3273            var x = false;
3274            if (o.playlist_dic) {
3275                x = okpd().indexOf(plid) < okpd().length - 1
3276            }
3277            return x
3278        };
3279        this.PlaylistRewind = function () {
3280            if (exist(o.pl_first_id)) {
3281                showById(o.pl_first_id)
3282            }
3283        };
3284        this.PlaylistPrevExist = function () {
3285            var x = plx > 0;
3286            if (o.playlist_dic) {
3287                var z = okpd().indexOf(plid);
3288                x = z > 0;
3289                if (z == 1) {
3290                    if (exist(o.playlist_dic[okpd()[0]].folder)) {
3291                        x = false
3292                    }
3293                }
3294            }
3295            return x
3296        };
3297        this.PlaylistExist = function () {
3298            return exist(o.playlist_dic)
3299        };
3300        this.PlaylistPrev = function () {
3301            autoprevopenfolder = true;
3302            if (this.PlaylistPrevExist()) {
3303                var x = parseInt(plx) - 1;
3304                if (x < 0) {
3305                    var y = okpd().indexOf(plid);
3306                    if (y > 0) {
3307                        var z = o.playlist_dic[okpd()[y - 1]];
3308                        if (z) {
3309                            if (exist(z.folder)) {
3310                                z = o.playlist_dic[okpd()[y - 2]]
3311                            }
3312                            if (z) {
3313                                this.openById(z.id);
3314                                o.actions.Play()
3315                            }
3316                        }
3317                    }
3318                } else {
3319                    o.seekto = undefined;
3320                    Action(x, 0);
3321                    ScrollTo(x)
3322                }
3323            }
3324        };
3325        this.PlaylistHere = function () {
3326            if (plx > 0) {
3327                ScrollTo(plx)
3328            }
3329        };
3330
3331        function f2i(x, i) {
3332            return f2action[i].indexOf(x)
3333        };
3334
3335        function FindPlStart(x) {
3336            if (x) {
3337                if (x['pjs_parent_i'] != -1) {
3338                    FindPlStart(o.playlist_dic[x['pjs_parent']]);
3339                    UpdatePlaylist(x['pjs_parent'])
3340                } else {
3341                    UpdatePlaylist(0)
3342                }
3343            }
3344        };
3345        this.g = function (x) {
3346            switch (x) {
3347            case "width":
3348                return Width();
3349                break;
3350            case "height":
3351                return container.offsetHeight;
3352                break;
3353            case "top":
3354                return style.margintop;
3355                break;
3356            case "scroll_height":
3357                return control.scrollHeight;
3358                break;
3359            case "margin_bottom":
3360                return style.marginbottom;
3361                break;
3362            case "x":
3363                return int(container.style.left);
3364                break;
3365            case "y":
3366                return int(container.style.top);
3367                break;
3368            case "opacity":
3369                return container.style.opacity;
3370                break;
3371            case "show":
3372                return is_visible;
3373                break;
3374            case "open":
3375                return open_settings;
3376                break;
3377            case "key":
3378                return key;
3379                break;
3380            case "motion_id":
3381                return key + motion_id;
3382                break;
3383            case "empty":
3384                return empty;
3385                break;
3386            case "playlist":
3387                return is == "playlist";
3388                break;
3389            case "played":
3390                return o.plhistory[plid];
3391                break;
3392            case "activeicon":
3393                return _activeIcon;
3394                break;
3395            case "butplstart":
3396                return o.playlist_dic[o.butplstart] ? o.playlist_dic[o.butplstart].title : '';
3397            case "title2":
3398                return v.title2 ? v.title2 : '';
3399            case "nxtttl":
3400                return NxtExt() ? o.playlist_dic[okpd()[okpd().indexOf(plid) + 1]].title : ''
3401            }
3402        };
3403
3404        function okpd() {
3405            return Object.keys(o.playlist_dic)
3406        };
3407        this.prenewpl = function () {
3408            plid = '';
3409            v.plstart = ''
3410        };
3411        this.empty = function () {
3412            if (iset) {
3413                var x = 0;
3414                for (var i = 1; i < 15; i++) {
3415                    if (faction[i] == "quality") {
3416                        var y = o.files_quality.length;
3417                        if (exist(v.forbidden_quality)) {
3418                            var z = v.forbidden_quality.split(",");
3419                            for (var j = 0; j < z.length; j++) {
3420                                if (o.files_quality.indexOf(z[j]) > -1) {
3421                                    y--
3422                                }
3423                            }
3424                        }
3425                        if (y > 0) {
3426                            if (y > 1 || (y == 1 && o.files_quality != 1 && style.show1value == 1)) {
3427                                x++
3428                            }
3429                        }
3430                    }
3431                    if (faction[i] == "airplay") {
3432                        if (o.airplay) {
3433                            x++
3434                        }
3435                    }
3436                    if (faction[i] == "download") {
3437                        if (o.file_type == 'native' || v.download) {
3438                            x++
3439                        }
3440                    }
3441                    if (faction[i] == "audiotrack") {
3442                        if (o.files_audiotrack.length > 1) {
3443                            x++
3444                        }
3445                    }
3446                    if (faction[i] == "channel" && v.channels == 1) {
3447                        if (o.files_channel.length > 0) {
3448                            x++
3449                        }
3450                    }
3451                    if (faction[i] == "subtitle") {
3452                        if (exist(o.subs)) {
3453                            for (var s = 0; s < o.subs.length; s++) {
3454                                if (o.subs[s] != '') {
3455                                    x++;
3456                                    break
3457                                }
3458                            }
3459                        }
3460                        if (x == 1 && o.subload == 1) {
3461                            x = 0
3462                        }
3463                        if (v.sub_upload == 1 && v.sub_upload0 == 1) {
3464                            x++
3465                        }
3466                    }
3467                    if (faction[i] == "speed") {
3468                        if (o.file_type != "vimeo") {
3469                            x++
3470                        }
3471                    }
3472                    if (faction[i] in o.menuproc || faction[i] == "share" || faction[i] == "color") {
3473                        x++
3474                    }
3475                    if (faction[i]) {
3476                        if (faction[i].indexOf("timer") > 0) {
3477                            x++
3478                        }
3479                        if (faction[i].indexOf("custom") > -1) {
3480                            x++
3481                        }
3482                    }
3483                    if (v.settings[is + i + 'hide'] == 1) {
3484                        x--
3485                    }
3486                }
3487                return x <= 0
3488            } else if (is == "playlist") {
3489                return f.length == 0
3490            } else {
3491                return empty
3492            }
3493        };
3494        this.Remove = function () {
3495            if (container.parentNode == o.frame) {
3496                container.removeChild(control);
3497                o.frame.removeChild(container);
3498                o.droplist ? o.droplist.Remove() : '';
3499                container = null;
3500                control = null;
3501                removed = true
3502            }
3503        }
3504    };
3505    var PluginShare = function (url) {
3506        var control;
3507        var icon;
3508        var answer;
3509        var created = false;
3510        var open = false;
3511        var clr = v.shareclred == 1 && exist(v.sharecolor) ? CheckColor(v.sharecolor) : "#ffffff";
3512        var bgclr = v.shareclred == 1 && exist(v.sharebgcolor) ? CheckColor(v.sharebgcolor) : "#000000";
3513        var sh = [];
3514        var other = ["whatsapp", "viber", "telegram", "reddit", "webshare", "tumblr", "pinterest", "ok"];
3515        for (var i = 1; i <= 15; i++) {
3516            if (exist(v["share" + i])) {
3517                AddPlgn(v["share" + i])
3518            }
3519        }
3520        if (!exist(v.share1)) {
3521            v.share1 = "facebook"
3522        }
3523        if (!exist(v.share2)) {
3524            v.share2 = "twitter"
3525        }
3526        if (!exist(v.share3)) {
3527            if (v.lang == "ru") {
3528                v.share3 = "vk"
3529            }
3530        }
3531        if (exist(v.embed)) {
3532            v.share15 = "embed"
3533        }
3534        if (exist(v.url)) {
3535            v.share16 = "url"
3536        }
3537        this.Show = function () {
3538            if (!created) {
3539                control = createElement("div");
3540                Pos0(control);
3541                css(control, {
3542                    "background": hex2rgb(bgclr, 0.8),
3543                    "color": clr
3544                });
3545                control.style.zIndex = "2000";
3546                var close = createElement("div");
3547                css(close, {
3548                    "position": "absolute",
3549                    "top": 15,
3550                    "right": 15,
3551                    "cursor": "pointer",
3552                    "padding": 5
3553                });
3554                close.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><path d='M16.5,3.5 L3.5,16.5 L16.5,3.5 Z' stroke='" + clr + "' stroke-width='3' stroke-linecap='square'></path><path d='M3.5,3.5 L16.5,16.5 L3.5,3.5 Z' stroke='" + clr + "' stroke-width='3' stroke-linecap='square'></path></g></svg>";
3555                if (o.system.mobile) {
3556                    close.addEventListener("touchend", function (event) {
3557                        Close()
3558                    })
3559                } else {
3560                    close.onclick = Close
3561                }
3562                close.style.zIndex = 10;
3563                var icons = createElement("div");
3564                css(icons, {
3565                    "position": "absolute",
3566                    "top": ((v.sharetop * 100) + '%'),
3567                    "left": 0,
3568                    "width": "100%",
3569                    "text-align": "center",
3570                    "color": clr
3571                });
3572                icons.innerHTML = (v.sharetitle == 1 ? Lang("share") + '<br><br>' : '') + (exist(v.url) ? '<center><input readonly style="color:' + clr + ';outline:0;white-space: nowrap;letter-spacing:1px;border:0;border-bottom:1px solid rgba(255,255,255,0.5);text-align:center;width:50%;background:transparent;display:block" id="pjs_share_link_' + v.id + '" type="text" value="' + v.url + '"/></center>' : '');
3573                o.frame.appendChild(control);
3574                control.appendChild(close);
3575                control.appendChild(icons);
3576                var iurl = document.getElementById('pjs_share_link_' + v.id);
3577                if (iurl) {
3578                    iurl.onclick = copyurl
3579                }
3580                css(o.container, {
3581                    '-webkit-user-select': 'auto'
3582                });
3583                icon = [];
3584                var svg;
3585                for (var i = 1; i <= 15; i++) {
3586                    if (exist(v["share" + i])) {
3587                        svg = IconSVG(v["share" + i]);
3588                        if (v["share" + i] != "" && svg && svg != '') {
3589                            icon[i] = createElement("div");
3590                            css(icon[i], {
3591                                "display": "inline-block",
3592                                "cursor": "pointer"
3593                            });
3594                            var m = ((v.shareiconscale * 20 - 20) + v.shareiconmargin * 1) / 2;
3595                            var mlr = 0;
3596                            if (v["share" + i] == "vk" || v["share" + i] == "embed") {
3597                                mlr = v.shareiconscale * 3
3598                            }
3599                            css(icon[i], {
3600                                "margin-left": m + mlr,
3601                                "margin-right": m + mlr,
3602                                "margin-top": m + 20,
3603                                "width": 20,
3604                                "height": 20
3605                            });
3606                            icon[i].innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g>" + svg + "</g></svg>";
3607                            icons.appendChild(icon[i]);
3608                            scale(i, v.shareiconscale);
3609                            icon[i].i = "i" + i;
3610                            icon[i].onmouseover = onOver;
3611                            icon[i].onmouseout = onOut;
3612                            icon[i].onclick = onClick
3613                        }
3614                    }
3615                }
3616                answer = createElement("div");
3617                css(answer, {
3618                    "display": "block",
3619                    "width": "100%",
3620                    "text-align": "center",
3621                    "margin-top": m + 15
3622                });
3623                icons.appendChild(answer);
3624                created = true
3625            } else {
3626                show2(control);
3627                css(o.container, {
3628                    '-webkit-user-select': 'auto'
3629                })
3630            }
3631            if (o.play) {
3632                o.noads = true;
3633                o.actions.Pause()
3634            }
3635            open = true
3636        };
3637
3638        function Close() {
3639            if (o.noads) {
3640                o.actions.Play()
3641            }
3642            Hide()
3643        }
3644
3645        function Hide() {
3646            if (exist(control)) {
3647                hide2(control);
3648                o.noads = false;
3649                open = false;
3650                answer.innerHTML = '';
3651                css(o.container, {
3652                    '-webkit-user-select': 'none'
3653                })
3654            }
3655        }
3656        this.Hide = function () {
3657            Hide()
3658        };
3659
3660        function onOver() {
3661            if (exist(this.i)) {
3662                var i = this.i.substr(1) * 1;
3663                if (v.shareiconscaleover > -1) {
3664                    scale(i, v.shareiconscaleover)
3665                }
3666            }
3667        }
3668
3669        function onOut() {
3670            if (exist(this.i)) {
3671                var i = this.i.substr(1) * 1;
3672                if (v.shareiconscaleover > -1) {
3673                    scale(i, v.shareiconscale)
3674                }
3675            }
3676        }
3677
3678        function onClick(e) {
3679            if (exist(this.i)) {
3680                var i = this.i.substr(1) * 1;
3681                ClickAction(v["share" + i])
3682            }
3683        }
3684        this.api = function (x) {
3685            if (x.indexOf("url") > -1) {
3686                if (v[x]) {
3687                    var y = v[x].replace("{time}", parseInt(o.media.time()));
3688                    copy(y);
3689                    o.alert.txt(Lang("copied"), 2)
3690                }
3691            }
3692            ClickAction(x, true)
3693        };
3694
3695        function Copied() {
3696            answer.innerHTML = Lang("copied");
3697            setTimeout(Uncopied, 3000)
3698        }
3699
3700        function Uncopied() {
3701            answer.innerHTML = ''
3702        }
3703
3704        function AddPlgn(x) {
3705            if (url(x) == '') {
3706                try {
3707                    sh[x] = eval('new PluginShare_' + x + '()')
3708                } catch (e) {}
3709            }
3710        }
3711
3712        function ClickAction(y, z) {
3713            var x = url(y);
3714            if (other.indexOf(y) > -1) {
3715                if (sh[y]) {
3716                    x = sh[y].share()
3717                }
3718            }
3719            if (y == "embed" && exist(v.embed)) {
3720                if (exist(v.embedvars)) {
3721                    v.embedvars = v.embedvars.replace(/pjs'qt/ig, '"')
3722                }
3723                copy((exist(v.embedhtmlstart) ? v.embedhtmlstart.replace(/pjs'qt/ig, '"') : '') + '<iframe width="' + (v.embedsize == 1 ? v.embedwidth : parseInt(o.normal_w)) + '" height="' + (v.embedsize == 1 ? v.embedheight : parseInt(o.normal_h)) + '" src="' + v.embed + '" frameborder="0" allowfullscreen' + (exist(v.embedvars) ? ' ' + v.embedvars : '') + '></iframe>' + (exist(v.embedhtmlend) ? v.embedhtmlend.replace(/pjs'qt/ig, '"') : ''));
3724                if (z) {
3725                    o.alert.txt(Lang("copied"), 2)
3726                } else {
3727                    Copied()
3728                }
3729            }
3730            x != '' ? Pop(x, 'Share', 500, 500) : ''
3731        }
3732
3733        function url(y) {
3734            var x = '';
3735            if (y == "facebook") {
3736                x = "https://www.facebook.com/sharer/sharer.php?u="
3737            }
3738            if (y == "twitter") {
3739                x = "https://twitter.com/intent/tweet?url="
3740            }
3741            if (y == "vk") {
3742                x = "https://vk.com/share.php?url="
3743            }
3744            return x
3745        }
3746
3747        function scale(i, x) {
3748            css(icon[i], {
3749                "transform-origin": '50% 50% 0px'
3750            });
3751            css(icon[i], {
3752                "transform": "scale(" + x + ")",
3753                "transition": "transform 0.1s linear"
3754            })
3755        }
3756
3757        function Pop(url, title, winWidth, winHeight) {
3758            var winTop = (screen.height / 2) - (winHeight / 2);
3759            var winLeft = (screen.width / 2) - (winWidth / 2);
3760            window.open(url + encodeURIComponent(exist(v.url) ? v.url : o.href), 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight)
3761        }
3762
3763        function IconSVG(x, cl) {
3764            if (x == "facebook") {
3765                return "<path d='M14,6.87798468 L11.616046,6.87798468 L11.616046,5.31446009 C11.616046,4.72728083 12.005212,4.59038667 12.2793122,4.59038667 L13.9616447,4.59038667 L13.9616447,2.00904312 L11.6447345,2 C9.0727459,2 8.48743763,3.92524947 8.48743763,5.15729686 L8.48743763,6.87798468 L7,6.87798468 L7,9.53790984 L8.48743763,9.53790984 L8.48743763,17.0645937 L11.616046,17.0645937 L11.616046,9.53790984 L13.7271472,9.53790984 L14,6.87798468 Z' fill='" + (cl ? cl : clr) + "' fill-rule='nonzero'></path>"
3766            }
3767            if (x == "twitter") {
3768                return "<path d='M7.90342661,15.0933314 C12.5898759,15.0933314 15.153204,11.209383 15.153204,7.84355402 C15.153204,7.73447623 15.153204,7.62539844 15.1454127,7.51242501 C15.644054,7.15013093 16.0725739,6.7060285 16.4153898,6.19180463 C15.9518092,6.3982733 15.4570635,6.53462054 14.950631,6.59305507 C15.484333,6.27361297 15.8816878,5.77497165 16.0725739,5.18283508 C15.5739326,5.47890336 15.024648,5.68926767 14.4558853,5.8022411 C13.4897677,4.777689 11.8769747,4.72704574 10.8524226,5.69316331 C10.1901646,6.31646496 9.90967882,7.24362617 10.1161475,8.1279354 C8.0670433,8.02664888 6.15818198,7.05663568 4.86483105,5.46721646 C4.1869905,6.63201142 4.53370204,8.12014413 5.65174939,8.86810611 C5.24660331,8.85641921 4.84924851,8.74734142 4.49474569,8.54866401 L4.49474569,8.5798291 C4.49474569,9.79137169 5.35178546,10.835402 6.53995424,11.0769314 C6.16597325,11.1782179 5.77251408,11.1938004 5.39074182,11.1197833 C5.72576646,12.1560223 6.68019712,12.8689236 7.77097501,12.8884018 C6.86718761,13.5974074 5.7530359,13.9830753 4.60771911,13.9830753 C4.40514608,13.9830753 4.20257304,13.9713884 4,13.9480146 C5.16089933,14.6959766 6.51658043,15.0933314 7.90342661,15.0933314' fill='" + (cl ? cl : clr) + "' fill-rule='nonzero'></path>"
3769            }
3770            if (x == "vk") {
3771                return "<path d='M18.927,13.749c-0.404-0.825-1.079-1.521-1.782-2.104h-0.012c-0.371-0.358-0.619-0.606-0.718-0.729 c-1.075-1.356,3.121-3.642,2.562-5.222l-0.05-0.087c-0.446-0.593-3.051-0.21-3.675-0.136c-0.073,0.033-0.127,0.077-0.186,0.136 c-0.962,1.291-1.164,2.901-2.426,3.997c-0.099,0.074-0.173,0.111-0.234,0.099c-0.05-0.012-0.1-0.025-0.148-0.037 c-0.963-0.546-0.054-3.303-0.396-4.219c-0.037-0.086-0.099-0.161-0.186-0.21c-0.074-0.049-0.174-0.086-0.297-0.124 c-1.102-0.18-2.203-0.146-3.304,0.099C7.952,5.273,7.84,5.36,7.741,5.472C7.63,5.595,7.618,5.669,7.692,5.682 c0.358,0.05,0.606,0.186,0.754,0.384C8.759,7.021,8.998,8.54,8.483,9.468C8.434,9.58,8.397,9.641,8.372,9.666 C8.36,9.691,8.335,9.703,8.323,9.715C8.135,9.802,7.958,9.777,7.791,9.641C7.667,9.555,7.556,9.443,7.419,9.307 C6.629,8.357,6.06,7.026,5.588,5.892c-0.05-0.124-0.124-0.223-0.21-0.285C5.261,5.534,5.13,5.474,4.994,5.447L2.569,5.459 c-0.248,0-0.421,0.062-0.507,0.173L2.025,5.682C1.984,5.806,1.993,5.93,2.049,6.053c1.343,3.101,3.321,7.416,6.966,8.439 c0.676,0.187,1.577,0.177,2.301,0.148c0.211-0.013,0.359-0.087,0.471-0.198l0.037-0.05c0.025-0.037,0.05-0.086,0.062-0.16 c0.149-0.455,0.022-0.938,0.247-1.387c0.062-0.099,0.124-0.186,0.186-0.26c0.059-0.078,0.133-0.127,0.223-0.148 c0.786-0.282,2.035,1.913,2.896,2.203C15.941,14.808,19.585,15.092,18.927,13.749C18.902,13.699,18.951,13.799,18.927,13.749z' fill='" + (cl ? cl : clr) + "' fill-rule='nonzero'/></path>"
3772            }
3773            if (other.indexOf(x) > -1) {
3774                if (!sh[x]) {
3775                    AddPlgn(x)
3776                }
3777                return sh[x] ? sh[x].icon((cl ? cl : clr)) : ''
3778            }
3779            if (x == "embed" || x == "url") {
3780                return "<path d='M7.33571875,13.976 L1,10.6265714 L1,9.16114286 L7.33571875,5.798 L7.33571875,7.694 L2.90490625,9.91628571 L7.33571875,12.0785714 L7.33571875,13.976 Z M12.1411563,4 L9.4526875,16 L7.883875,16 L10.5723438,4 L12.1411563,4 Z M17.0956563,9.91628571 L12.6642813,7.69428571 L12.6642813,5.79828571 L19,9.16114286 L19,10.6265714 L12.6642813,13.976 L12.6642813,12.0785714 L17.0956563,9.91628571 Z' fill='" + (cl ? cl : clr) + "' fill-rule='nonzero'></path>"
3781            }
3782        }
3783
3784        function copyurl() {
3785            if (v.url) {
3786                copy(v.url);
3787                Copied()
3788            }
3789        }
3790
3791        function copy(x) {
3792            var textArea = document.createElement('textarea');
3793            textArea.setAttribute('style', 'width:1px;border:0;opacity:0;');
3794            document.body.appendChild(textArea);
3795            textArea.value = x;
3796            textArea.select();
3797            document.execCommand('copy');
3798            document.body.removeChild(textArea)
3799        };
3800        this.icon = function (x, z, cl) {
3801            var y = IconSVG(x, cl);
3802            return y ? "<svg width='10' height='10' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' style='transform:scale(" + z + ");margin:0 5px 3px 0;display:inline-block'><g>" + y + "</g></svg>" : ""
3803        };
3804        this.empty = function () {
3805            var x = true;
3806            for (var i = 1; i <= 15; i++) {
3807                if (exist(v["share" + i])) {
3808                    if (v["share" + i] != "") {
3809                        x = false
3810                    }
3811                } else {
3812                    i < 4 ? x = false : ''
3813                }
3814            }
3815            if (exist(v["embed"])) {
3816                v["embed"] != '' ? x = false : ''
3817            }
3818            if (exist(v["url"])) {
3819                v["url"] != '' ? x = false : ''
3820            }
3821            return x
3822        };
3823        this.Remove = function () {
3824            if (created) {
3825                o.frame.removeChild(control);
3826                control = null;
3827                created = false
3828            }
3829        };
3830        this.isOpen = function () {
3831            return open
3832        }
3833    };
3834
3835    function PluginShare_whatsapp() {
3836        this.share = function () {
3837            return (o.system.mobile ? "https://wa.me/?" : "https://web.whatsapp.com/se
3837nd?") + "text="
3838        };
3839        this.icon = function (clr) {
3840            return "<path d='M14.2464991,5.25712408 C13.1148991,4.12492408 11.6100991,3.50092408 10.0068991,3.50032408 C6.70329913,3.50032408 4.01469913,6.18772408 4.01349913,9.49132408 C4.01289913,10.5473241 4.28889913,11.5781241 4.81329913,12.4865241 L4.00029913,15.5003241 L7.14009913,14.7581241 C8.01549913,15.2357241 9.00069913,15.4871241 10.0038991,15.4877241 C13.3092991,15.4877241 15.9978991,12.7997241 15.9996991,9.49672408 C16.0008991,7.89532408 15.3780991,6.38992408 14.2464991,5.25712408 Z M12.9390991,11.6327241 C12.8142991,11.9825241 12.2028991,12.3197241 11.9280991,12.3443241 C11.6532991,12.3695241 11.3958991,12.4685241 10.1310991,11.9699241 C8.60889913,11.3699241 7.64769913,9.80932408 7.57329913,9.70972408 C7.49829913,9.60952408 6.96189913,8.89792408 6.96189913,8.16112408 C6.96189913,7.42432408 7.34889913,7.06192408 7.48629913,6.91252408 C7.62369913,6.76252408 7.78569913,6.72532408 7.88589913,6.72532408 C7.98549913,6.72532408 8.08569913,6.72532408 8.17269913,6.72892408 C8.27949913,6.73312408 8.39769913,6.73852408 8.50989913,6.98752408 C8.64309913,7.28392408 8.93409913,8.02432408 8.97129913,8.09932408 C9.00849913,8.17432408 9.03369913,8.26192408 8.98389913,8.36152408 C8.93409913,8.46112408 8.90889913,8.52352408 8.83449913,8.61112408 C8.75949913,8.69872408 8.67729913,8.80612408 8.61009913,8.87332408 C8.53509913,8.94772408 8.45709913,9.02932408 8.54409913,9.17872408 C8.63169913,9.32872408 8.93169913,9.81892408 9.37689913,10.2155241 C9.94929913,10.7255241 10.4310991,10.8833241 10.5810991,10.9589241 C10.7310991,11.0339241 10.8180991,11.0213241 10.9056991,10.9211241 C10.9932991,10.8215241 11.2800991,10.4843241 11.3796991,10.3343241 C11.4792991,10.1843241 11.5794991,10.2095241 11.7168991,10.2593241 C11.8542991,10.3091241 12.5904991,10.6715241 12.7398991,10.7465241 C12.8898991,10.8215241 12.9894991,10.8587241 13.0266991,10.9211241 C13.0638991,10.9829241 13.0638991,11.2829241 12.9390991,11.6327241 Z' fill='" + clr + "' fill-rule='nonzero'></path>"
3841        }
3842    };
3843
3844    function PluginShare_telegram() {
3845        this.share = function () {
3846            return "https://t.me/share/url?url="
3847        };
3848        this.icon = function (clr) {
3849            return "<path d='M15.774328,4.61928677 C15.6001007,4.47186369 15.3186567,4.45846159 14.8361812,4.60588467 L14.8361812,4.60588467 C14.5011287,4.71310145 11.525863,5.83887768 8.89905178,6.92444761 C6.54028255,7.90280076 4.62378254,8.76053503 4.39594688,8.86775181 C4.14130702,8.9481644 3.591821,9.18940216 3.56501681,9.5646609 C3.55161471,9.80589866 3.75264618,10.0203322 4.14130702,10.1945595 C4.55677205,10.4089931 6.39285947,11.0254896 6.78152031,11.1461085 C6.91554129,11.6017798 13.4557651,6.66394451 13.4959714,6.82476969 C13.5495798,7.06600745 8.27203981,11.6399635 8.3524524,11.6935719 C8.3658545,11.706974 7.97987656,14.3468113 8.00668076,14.3602134 C8.04688705,14.3870176 8.0174202,14.6306539 8.13718414,14.7378707 C8.25694808,14.8450875 8.2536879,14.8345227 8.51661242,14.8345227 C9.01249004,14.4324598 9.91761122,13.545084 10.158849,13.2904441 C11.2176147,14.1213742 12.3701951,15.046119 12.4774119,15.1533357 L12.490814,15.1667378 C12.7454539,15.3811714 13.0134958,15.5017903 13.2547336,15.5017903 C13.3351462,15.5017903 13.4155588,15.4883882 13.4959714,15.461584 C13.7774154,15.3677693 13.9784469,15.0997273 14.0454574,14.7378707 C14.0454574,14.7244686 14.0588595,14.6708602 14.0856637,14.5770455 C14.541335,12.593535 14.9031916,10.8512623 15.1980378,9.39043363 C15.4794819,7.95640915 15.7073175,6.54918887 15.8413385,5.79867139 C15.8681427,5.61104201 15.8949469,5.46361894 15.908349,5.36980425 C15.9485553,5.10176229 15.9753595,4.79351404 15.774328,4.61928677 Z' fill='" + clr + "' fill-rule='nonzero'></path>"
3850        }
3851    };
3852
3853    function PluginShare_ok() {
3854        this.share = function () {
3855            return "https://connect.ok.ru/offer?url="
3856        };
3857        this.icon = function (clr) {
3858            return "<path d='M10.0010577,4.85799141 C10.8601786,4.85799141 11.5589708,5.57168881 11.5589708,6.44913473 C11.5589708,7.32349125 10.8601786,8.03718787 10.0010577,8.03718787 C9.14193674,8.03718787 8.44314452,7.32349125 8.44314452,6.44913473 C8.44314452,5.57168881 9.14193674,4.85799141 10.0010577,4.85799141 Z M10.0010577,10.4007312 C12.1367601,10.4007312 13.8701271,8.63039075 13.8701271,6.44913473 C13.8701271,4.26787793 12.1367601,2.49444889 10.0010577,2.49444889 C7.86535603,2.49444889 6.12896333,4.26787793 6.12896333,6.44913473 C6.12896333,8.62730135 7.86535603,10.4007312 10.0010577,10.4007312 Z M11.5226699,13.4223579 C12.2880134,13.246251 13.0261314,12.9372912 13.7067728,12.4985678 C14.2210357,12.1679814 14.3753146,11.4728212 14.0516316,10.9475899 C13.7279485,10.4223578 13.0473071,10.2616987 12.5330442,10.5953753 C10.99025
38587,11.5840467 9.0088335,11.5840467 7.46907118,10.5953753 C6.95178338,10.2616987 6.27114199,10.4223578 5.94745891,10.9475899 C5.62377583,11.4728212 5.77805478,12.1679814 6.29534258,12.4985678 C6.97295909,12.9372912 7.71410195,13.246251 8.47944541,13.4223579 L6.37399411,15.5727183 C5.94443403,16.0114417 5.94443403,16.7251383 6.37701976,17.1638617 C6.59179941,17.3832234 6.87313185,17.4944489 7.15446351,17.4944489 C7.43579517,17.4944489 7.72015249,17.3832234 7.93493214,17.1638617 L10.0010577,15.0536658 L12.0702081,17.1638617 C12.4997689,17.6025842 13.1955355,17.6025842 13.6281212,17.1638617 C14.0576813,16.7251383 14.0576813,16.0114417 13.6281212,15.5727183 L11.5226699,13.4223579 Z' fill='" + clr + "' fill-rule='nonzero'></path>"
3859        }
3860    };
3861    var MediaYoutube = function (url, parentcontainer) {
3862        var intro = false;
3863        if (url.indexOf('intro') == 0) {
3864            intro = true;
3865            url = url.substr(5)
3866        }
3867        var youtube_id = YoutubeID(url);
3868        var error;
3869        var player;
3870        var created = false;
3871        var ready = false;
3872        var started = false;
3873        var vastonmobile = false;
3874        var auto = true;
3875        var _set_quality = [];
3876        var _speed = 1;
3877        var _wait = false;
3878        var startwait_t;
3879        var _start = 0;
3880        var _readyonplay = 0;
3881        var quality_received = false;
3882        var container_id = 'pljs_yt_' + v.id + (intro ? 'intro' : '');
3883        pushCSS("#pljs_yt_" + v.id + "{width:100%!important;height:100%!important;max-width:none!important;max-height:none!important}");
3884        var container = createElement('div');
3885        var drtn = 0;
3886        container.setAttribute('id', container_id);
3887        parentcontainer.appendChild(container);
3888        o.airplay = false;
3889        !intro ? o.actions.AirplayChanged() : '';
3890        if (o.system.mobile) {
3891            v.preload = 1
3892        }
3893        if (v.youtubecontrols != 1) {
3894            var layer = createElement('div');
3895            parentcontainer.appendChild(layer);
3896            css(layer, {
3897                position: "absolute",
3898                top: 0,
3899                left: 0,
3900                "background-color": "#ff0000",
3901                height: "100%",
3902                width: "100%",
3903                "opacity": 0
3904            });
3905            layer.addEventListener("dblclick", function (event) {
3906                event.cancelBubble = true
3907            });
3908            if (o.system.mobile) {
3909                layer.addEventListener("touchstart", function (event) {
3910                    event.cancelBubble = true
3911                });
3912                layer.addEventListener("click", function (event) {
3913                    event.cancelBubble = true
3914                });
3915                layer.addEventListener("touchend", function (event) {
3916                    event.cancelBubble = true;
3917                    ScreenClick(event);
3918                    if (v.screenclick == 1) {
3919                        setTimeout(HideLayer, 100);
3920                        setTimeout(ShowLayer, 1000)
3921                    }
3922                })
3923            } else {
3924                layer.addEventListener("mousemove", function (event) {
3925                    var x = true;
3926                    if (v.vast == 1) {
3927                        if (exist(v.preroll) && !started) {
3928                            x = false
3929                        }
3930                        if (exist(v.playroll) && Status() == "paused" && time() > 0) {
3931                            x = false
3932                        }
3933                    }
3934                    if (x && v.screenclick == 1 && v.ytcl != 1) {
3935                        hide2(this);
3936                        setTimeout(ShowLayer, 2000)
3937                    }
3938                })
3939            }
3940            v.screenclick == 1 && v.ytcl1 != 1 ? hide2(layer) : ''
3941        }
3942
3943        function ShowLayer() {
3944            show2(layer)
3945        }
3946
3947        function HideLayer() {
3948            if (v.ytcl != 1) {
3949                hide2(layer)
3950            }
3951        }
3952        if (v.preload == 1 && v.autoplay == 0) {
3953            onWaiting()
3954        }
3955        if (!window['YT']) {
3956            window.onYouTubeIframeAPIReady = function () {
3957                YouTubeIframeAPIReady();
3958                for (var i = 0; i < window.pljssglobal.length; i++) {
3959                    if (window.pljssglobal[i]) {
3960                        if (window.pljssglobal[i].api("id") != v.id) {
3961                            if (window.pljssglobal[i].api('isyoutube')) {
3962                                window.pljssglobal[i].api('youtubeready')
3963                            }
3964                        }
3965                    }
3966                }
3967            };
3968            var scrpt = Script("youtube.com/iframe_api", "youtube.com/iframe_api", "youtube_iframe_api");
3969            if (scrpt) {
3970                scrpt.onerror = function (e) {
3971                    o.actions.MediaReady();
3972                    if (v.yterrors != 1) {
3973                        error = 'YouTube API Error';
3974                        o.media.onError()
3975                    }
3976                }
3977            }
3978        } else {
3979            YouTubeIframeAPIReady()
3980        }
3981
3982        function YouTubeIframeAPIReady() {
3983            if (v.preload == 1 || intro) {
3984                !created ? YtInit() : ''
3985            } else {
3986                o.actions.MediaReady()
3987            }
3988        }
3989
3990        function YtInit() {
3991            if ("YT" in window) {
3992                if (exist(YT.Player) && !created) {
3993                    log("Youtube Init");
3994                    var cntrls = 0;
3995                    if (v.youtubecontrols == 1) {
3996                        cntrls = 1
3997                    }
3998                    o.seekto > 0 ? _start = parseInt(o.seekto) : '';
3999                    player = new YT.Player(container_id, {
4000                        height: o.container_h,
4001                        width: o.container_w,
4002                        videoId: youtube_id,
4003                        playerVars: {
4004                            enablejsapi: 1,
4005                            playerapiid: container_id,
4006                            html5: 1,
4007                            disablekb: 1,
4008                            autohide: 1,
4009                            playsinline: ((v.playsinlineonmobile == 0 || (v.playsinlineonmobileiphone != 1 && o.system.iphone)) && o.system.mobile ? 0 : 1),
4010                            iv_load_policy: 3,
4011                            controls: cntrls,
4012                            showinfo: 0,
4013                            modestbranding: 1,
4014                            rel: 0,
4015                            autoplay: intro || v.autoplay == 1 ? 1 : 0,
4016                            loop: 0
4017                        },
4018                        events: {
4019                            'onReady': onYtPlayerReady,
4020                            'onStateChange': onYtPlayerStateChange,
4021                            'onError': onError,
4022                            'onPlaybackQualityChange': onQualityChanged
4023                        }
4024                    });
4025                    if (o.seekto > 0) {
4026                        o.seekto = undefined
4027                    }
4028                    Resize();
4029                    created = true
4030                } else {
4031                    setTimeout(YtInit, 500)
4032                }
4033            } else {
4034                setTimeout(YtInit, 500)
4035            }
4036        }
4037        var _play_i;
4038
4039        function onYtPlayerReady() {
4040            if (o.media) {
4041                log("Youtube Ready");
4042                ready = true;
4043                clearTimeout(startwait_t);
4044                o.actions.StopWaiting();
4045                if (intro) {
4046                    if (o.system.mutedautoplay) {
4047                        o.actions.Mute()
4048                    }
4049                    player.playVideo();
4050                    o.vast.ytReady()
4051                } else {
4052                    if (v.autoplay == 1 && o.system.mutedautoplay && !o.acted) {
4053                        o.actions.Mute();
4054                        if (o.system.mobile) {
4055                            clearInterval(_play_i);
4056                            _play_i = setInterval(PlayingChecker, 300)
4057                        }
4058                    }
4059                    if (v.preload == 0) {
4060                        player.playVideo()
4061                    } else {
4062                        o.actions.MediaReady()
4063                    }
4064                    drtn = player.getDuration();
4065                    o.media.onDuration();
4066                    if (_speed != 1) {
4067                        SetSpeed(_speed)
4068                    }
4069                    onMeta();
4070                    Resize();
4071                    if (v.yttitle == 1) {
4072                        try {
4073                            if (player.getVideoData()) {
4074                                if (exist(player.getVideoData().title)) {
4075                                    v.title = player.getVideoData().title;
4076                                    o.actions.Title('title')
4077                                }
4078                            }
4079                        } catch (e) {}
4080                    }
4081                }
4082            }
4083        }
4084
4085        function PlayingChecker() {
4086            var x = player.getPlayerState();
4087            if (x == 2 || x == -1) {
4088                o.controls.Pause();
4089                o.controls.StopWaiting();
4090                clearInterval(_play_i)
4091            }
4092            if (x == 1) {
4093                clearInterval(_play_i)
4094            }
4095        }
4096
4097        function onYtPlayerStateChange(event) {
4098            if (v.ytlog == 1) {
4099                log('YT', event.data)
4100            }
4101            if (intro) {
4102                if (event.data == YT.PlayerState.ENDED) {
4103                    o.vast.ytEnded()
4104                }
4105                if (event.data == YT.PlayerState.PLAYING) {}
4106            } else {
4107                if (event.data == YT.PlayerState.PLAYING) {
4108                    if (_readyonplay == 1) {
4109                        _readyonplay = 0;
4110                        onYtPlayerReady()
4111                    }
4112                    if (!o.play) {
4113                        o.actions.Play()
4114                    }
4115                    if (_start > 0) {
4116                        player.seekTo(_start, true);
4117                        _start = 0;
4118                        o.seekto = undefined
4119                    }
4120                    ShowLayer();
4121                    started = true;
4122                    ready = true;
4123                    if (vastonmobile) {
4124                        player.pauseVideo()
4125                    } else {
4126                        o.media.onPlay();
4127                        o.media.onTimeupdate()
4128                    }
4129                    Qualities();
4130                    if (exist(v.default_quality)) {
4131                        for (var i = 0; i < o.files_quality.length; i++) {
4132                            if (v.default_quality == o.files_quality[i]) {
4133                                SetQuality(i)
4134                            }
4135                        }
4136                        v.default_quality = null
4137                    } else {
4138                        if (exist(o.default_quality)) {
4139                            for (var i = 0; i < o.files_quality.length; i++) {
4140                                if (o.default_quality == o.files_quality[i]) {
4141                                    SetQuality(i)
4142                                }
4143                            }
4144                            o.default_quality = null
4145                        }
4146                    }
4147                    _wait = false
4148                }
4149                if (event.data == -1 && _wait && o.play) {
4150                    o.actions.StopWaiting();
4151                    _wait = false;
4152                    onPause()
4153                }
4154                if (event.data == YT.PlayerState.PAUSED) {}
4155                if (event.data == YT.PlayerState.ENDED) {
4156                    onEnded()
4157                }
4158                if (event.data == YT.PlayerState.BUFFERING) {
4159                    if (!o.play) {}
4160                    if (o.play) {
4161                        _wait = true;
4162                        onWaiting()
4163                    }
4164                }
4165                if (event.data == YT.PlayerState.CUED) {}
4166            }
4167        }
4168
4169        function onError(event) {
4170            if (intro) {
4171                o.vast.ytError()
4172            } else {
4173                if (event.data == 2) {
4174                    error = "wrong youtube id"
4175                }
4176                if (event.data == 5) {
4177                    error = "network empty"
4178                }
4179                if (event.data == 101 || event.data == 150 || event.data == 100) {
4180                    error = "this video is unavailable"
4181                }
4182                if (v.customyterrors == 1) {
4183                    exist(v.customyterror) ? error = v.customyterror : ''
4184                }
4185                if (v.yterrors != 1) {
4186                    o.media.onError()
4187                } else {
4188                    hide(o.poster)
4189                }
4190            }
4191        }
4192
4193        function onEnded() {
4194            v.start > 0 ? _start = v.start : '';
4195            o.media.onEnded();
4196            o.media.onDuration()
4197        }
4198
4199        function onPause() {
4200            if (!o.nopause && o.play) {
4201                o.actions.Pause()
4202            }
4203        }
4204
4205        function onTimeupdate() {
4206            o.media.onTimeupdate()
4207        }
4208
4209        function onMeta() {
4210            o.media.onMeta();
4211            o.actions.LoadedData()
4212        }
4213
4214        function onDuration() {
4215            o.media.onDuration()
4216        }
4217
4218        function onVolume() {
4219            o.media.onVolume()
4220        }
4221
4222        function onWaiting() {
4223            if (o.media) {
4224                o.media.onWaiting()
4225            } else {
4226                startwait_t = setTimeout(onWaiting, 100)
4227            }
4228        }
4229
4230        function onQualityChanged(event) {
4231            SetCurrentQuality(event.data)
4232        }
4233
4234        function Qualities() {
4235            if (!quality_received) {
4236                var x = player.getAvailableQualityLevels() + '';
4237                if (x != '' && x != undefined) {
4238                    o.files_quality = x.split(',');
4239                    o.files_quality = o.files_quality.reverse();
4240                    if (v.ytautoquality == 0) {
4241                        var y = o.files_quality.indexOf('auto');
4242                        if (y > -1) {
4243                            o.files_quality.splice(y, 1)
4244                        }
4245                    }
4246                    for (var i = 0; i < o.files_quality.length; i++) {
4247                        o.files_quality[i] = RenameQualities(o.files_quality[i])
4248                    }
4249                    quality_received = true;
4250                    SetCurrentQuality(player.getPlaybackQuality())
4251                }
4252            }
4253        }
4254
4255        function SetCurrentQuality(x) {
4256            o.current_quality = o.files_quality.indexOf(RenameQualities(x + ''));
4257            o.controls.QualityChanged(o.current_quality)
4258        }
4259        this.size = function () {
4260            return {
4261                "width": 0,
4262                "height": 0
4263            }
4264        };
4265        this.src = function (x) {
4266            youtube_id = YoutubeID(x);
4267            if (o.seekto > 0) {
4268                _start = parseInt(o.seekto)
4269            }
4270            playById(youtube_id)
4271        };
4272
4273        function Status() {
4274            var state = -1;
4275            if (ready) {
4276                state = player.getPlayerState()
4277            }
4278            var x = '';
4279            if (state == -1) {
4280                x = "paused"
4281            }
4282            if (state == 1 || state == 3) {
4283                x = "playing"
4284            }
4285            if (state == 2) {
4286                x = "paused";
4287                if (o.play) {
4288                    o.actions.Pause()
4289                }
4290            }
4291            if (state == 5) {
4292                x = "paused"
4293            }
4294            if (state == 0) {
4295                x = "ended"
4296            }
4297            return x
4298        }
4299
4300        function Resize() {
4301            try {
4302                if (exist(player)) {
4303                    player.setSize(o.screen_w, o.screen_h)
4304                }
4305            } catch (e) {
4306                log(e)
4307            }
4308        }
4309
4310        function RenameQualities(x) {
4311            var y = x;
4312            if (x == "tiny") {
4313                y = "160p"
4314            }
4315            if (x == "small") {
4316                y = "240p"
4317            }
4318            if (x == "medium") {
4319                y = "360p"
4320            }
4321            if (x == "large") {
4322                y = "480p"
4323            }
4324            if (x == "hd720") {
4325                y = "720p"
4326            }
4327            if (x == "hd1080") {
4328                y = "1080p"
4329            }
4330            if (v.nameofyoutubequality == 1) {
4331                y = Lang(y)
4332            }
4333            if (x == "auto") {
4334                y = Lang("auto")
4335            }
4336            _set_quality[y] = x;
4337            return y
4338        }
4339
4340        function time() {
4341            var x = ready ? player.getCurrentTime() : 0;
4342            if (x > 0 && v.seekwindow > 0) {
4343                v.delete = x - v.seekwindow;
4344                v.seekwindow = -1
4345            }
4346            return x
4347        };
4348
4349        function SetSpeed(x) {
4350            try {
4351                player ? player.setPlaybackRate(x) : '';
4352                _speed = x
4353            } catch (e) {}
4354        };
4355        this.YoutubeReady = function () {
4356            YouTubeIframeAPIReady()
4357        };
4358        this.Play = function () {
4359            if (ready) {
4360                player.playVideo()
4361            } else {
4362                if (!created) {
4363                    YtInit()
4364                } else {}
4365            }
4366        };
4367        this.Pause = function () {
4368            if (ready) {
4369                player.pauseVideo()
4370            }
4371        };
4372        this.Toggle = function () {
4373            if (ready) {
4374                Status() == 'playing' ? player.pauseVideo() : player.playVideo()
4375            }
4376        };
4377        this.Seek = function (x) {
4378            if (ready) {
4379                player.seekTo(x, true);
4380                js("seek", x)
4381            }
4382        };
4383        this.tag = function () {
4384            return false
4385        };
4386        this.Mute = function () {
4387            ready ? player.mute() : ''
4388        };
4389        this.Unmute = function () {
4390            ready ? player.unMute() : ''
4391        };
4392        this.Volume = function (x) {
4393            ready ? player.setVolume(x * 100) : ''
4394        };
4395        this.isPlaying = function () {
4396            return Status() == 'playing'
4397        };
4398        this.isLive = function () {
4399            return false
4400        };
4401        this.setQuality = function (x) {
4402            SetQuality(x)
4403        };
4404
4405        function SetQuality(x) {
4406            if (ready) {
4407                if (exist(o.files_quality[x])) {
4408                    var y = _set_quality[o.files_quality[x]];
4409                    auto = y == 'auto';
4410                    var z = time();
4411                    player.setPlaybackQuality(y)
4412                }
4413            }
4414        }
4415        this.setSpeed = function (x) {
4416            SetSpeed(x)
4417        };
4418        this.ready = function () {
4419            return ready
4420        };
4421        this.status = function () {
4422            return Status()
4423        };
4424        this.time = function () {
4425            return time()
4426        };
4427        this.duration = function () {
4428            var x = ready ? player.getDuration() : 0;
4429            if (x != drtn) {
4430                drtn = x;
4431                o.media.onDuration()
4432            }
4433            if (exist(v.end)) {
4434                if (indOf([v.end], '-')) {
4435                    x = x + v.end * 1
4436                } else {
4437                    x = v.end
4438                }
4439            }
4440            return x
4441        };
4442        this.loaded = function () {
4443            var x = 0;
4444            if (ready) {
4445                x = player.getVideoLoadedFraction() * player.getDuration()
4446            }
4447            return x
4448        };
4449        this.resize = function () {
4450            Resize()
4451        };
4452        this.errorMessage = function () {
4453            return error
4454        };
4455        this.auto = function () {
4456            return v.ytautoquality == 1 ? auto : false
4457        };
4458        this.playId = function (x) {
4459            playById(x)
4460        };
4461
4462        function playById(x) {
4463            url = x;
4464            if (player) {
4465                _readyonplay = 1;
4466                player.loadVideoById(x, 0)
4467            }
4468        }
4469        this.BeforeVast = function () {
4470            if (o.system.mobile && o.system.android) {
4471                this.Play();
4472                vastonmobile = true
4473            } else {
4474                if (Status() == "playing") {
4475                    this.Pause()
4476                }
4477            }
4478        };
4479        this.AfterVast = function () {
4480            vastonmobile = false
4481        };
4482        this.nativeControls = function () {
4483            return true
4484        };
4485        this.Remove = function () {
4486            ready ? player.destroy() : '';
4487            ready = false;
4488            quality_received = false;
4489            try {
4490                if (container) {
4491                    parentcontainer.removeChild(container)
4492                }
4493                parentcontainer.removeChild(layer)
4494            } catch (e) {}
4495        }
4496    };
4497    var PluginSub = function () {
4498        var sub = [];
4499        var upld = [];
4500        var empty = true;
4501        var ioff;
4502        var loading = -1;
4503        var lastsub;
4504        var wait;
4505        var parsed = [];
4506        var alldd;
4507        var hlsrows = [];
4508        this.start = function (x) {
4509            if (!x && wait) {
4510                Start0(wait);
4511                wait = undefined
4512            } else {
4513                x ? Start0(x) : ''
4514            }
4515        };
4516        this.check = function (x) {
4517            Start0(x)
4518        };
4519        this.reHls = function () {
4520            hlsrows = []
4521        };
4522
4523        function Start0(x) {
4524            if (x.indexOf("#" + v.enc3) == 0 && x.indexOf(v.file3_separator) > 0) {
4525                o[o.fd[1]](x, Start00)
4526            } else {
4527                Start(x)
4528            }
4529        }
4530
4531        function Start00(x) {
4532            if (x) {
4533                o.subs = x;
4534                Start(x)
4535            }
4536        }
4537
4538        function Start(x) {
4539            !x ? x = '' : '';
4540            if (x != '11') {
4541                var start = 0;
4542                var urlcnfg = true;
4543                var memory = '';
4544                o.subs = x.split(",");
4545                o.files_subtitle = [];
4546                o.current_subtitle = -1;
4547                if (StorageSupport() && v.sub_store == 1) {
4548                    if (localStorage.getItem("pljssubtitle") != null) {
4549                        memory = localStorage.getItem("pljssubtitle")
4550                    }
4551                } else {
4552                    if (o.remember_sub) {
4553                        memory = o.remember_sub
4554                    }
4555                }
4556                for (var i = 0; i < o.subs.length; i++) {
4557                    if (o.subs[i].indexOf("#0") == 0) {
4558                        o.subs[i] = fd0(o.subs[i])
4559                    }
4560                    if (o.subs[i].indexOf("#" + v.enc2) == 0) {
4561                        o.subs[i] = o[o.fd[0]](o.subs[i])
4562                    }
4563                    if (o.subs[i].indexOf("[") == 0 && o.subs[i].indexOf("]") > 1) {
4564                        o.files_subtitle[i] = o.subs[i].substr(o.subs[i].indexOf("[") + 1, o.subs[i].indexOf("]") - 1);
4565                        o.subs[i] = o.subs[i].substr(o.subs[i].indexOf("]") + 1);
4566                        urlcnfg = false
4567                    } else {
4568                        o.files_subtitle[i] = o.subs[i].substr(o.subs[i].lastIndexOf("/") + 1);
4569                        o.files_subtitle[i] = o.files_subtitle[i].substr(0, o.files_subtitle[i].lastIndexOf("."))
4570                    }
4571                    if (o.subs[i].indexOf("#0") == 0) {
4572                        o.subs[i] = fd0(o.subs[i])
4573                    }
4574                    if (o.subs[i].indexOf("#" + v.enc2) == 0) {
4575                        o.subs[i] = o[o.fd[0]](o.subs[i])
4576                    }
4577                }
4578                if (o.files_subtitle.length > 1 && v.sub_all == 1) {
4579                    o.files_subtitle.push(StringVar('sub_all_title', (v.sub_allmy == 1 && exist(v.sub_allmyt) ? v.sub_allmyt : Lang('together'))));
4580                    o.subs.push("all")
4581                }
4582                if (o.files_subtitle.length > 0 && v.sub_off == 1) {
4583                    if (v.sub_off0 == 1) {
4584                        ioff = 0;
4585                        start++;
4586                        o.files_subtitle.unshift(StringVar('sub_off_title', Lang('off')));
4587                        o.subs.unshift("")
4588                    } else {
4589                        o.files_subtitle.push(StringVar('sub_off_title', Lang('off')));
4590                        o.subs.push("");
4591                        ioff = o.files_subtitle.length - 1
4592                    }
4593                }
4594                for (var i = 0; i < o.subs.length; i++) {
4595                    if (exist(v.default_subtitle)) {
4596                        if (v.default_subtitle == o.files_subtitle[i]) {
4597                            start = i;
4598                            o.current_subtitle = i;
4599                            v.subtitle_start = 1
4600                        }
4601                    }
4602                    if (memory != '') {
4603                        if (memory == o.files_subtitle[i]) {
4604                            start = i;
4605                            o.current_subtitle = i
4606                        }
4607                    }
4608                }
4609                if (v.sub_off == 1 && v.subtitle_start == 0) {
4610                    o.current_subtitle = ioff
4611                }
4612                exist(o.controls) ? o.controls.SubtitleChanged() : '';
4613                if (v.subtitle_start == 1) {
4614                    o.current_subtitle = start;
4615                    if (o.start) {
4616                        if (v.sub_all == 1 && o.subs[start] == "all") {
4617                            SubtitleLoadAll(o.current_subtitle)
4618                        } else {
4619                            SubtitleLoad(o.current_subtitle)
4620                        }
4621                    } else {
4622                        wait = x;
4623                        o.subtitle_on = o.subs[start] != 'off' && start != ioff;
4624                        setTimeout(Parsed, 500)
4625                    }
4626                } else {
4627                    if (urlcnfg && o.subs.length < 3) {
4628                        SubtitleLoad(ioff == 0 ? 1 : 0)
4629                    }
4630                    v.sub_off != 1 ? o.current_subtitle = -1 : ''
4631                }
4632            } else {
4633                Remove()
4634            }
4635        };
4636
4637        function sfjs(x) {
4638            if (x.indexOf('js:') == 0) {
4639                try {
4640                    x = eval(x.substr(3))
4641                } catch (e) {
4642                    console.log(e.message)
4643                }
4644            }
4645            return x ? x : ''
4646        };
4647        this.hlsSub = function (x) {
4648            SubtitleLoad2(x, 'hls')
4649        };
4650
4651        function SubtitleLoad(x) {
4652            if (exist(o.subs[x])) {
4653                o.subs[x] = sfjs(o.subs[x]);
4654                if (o.subs[x]) {
4655                    if (o.subs[x].indexOf(".") > -1) {
4656                        o.subsor = o.subs[x].split(" or ");
4657                        o.sub_or = 0;
4658                        SubtitleLoad2(x)
4659                    } else {
4660                        if (o.subs[x].indexOf('upld') == 0) {
4661                            if (upld[o.subs[x].substr(4)]) {
4662                                SubtitleParse(o.files_subtitle[x], upld[o.subs[x].substr(4)])
4663                            }
4664                        }
4665                        if (o.subs[x].indexOf('hls') == 0) {
4666                            o.media.hlsDashSub(x, "hls2");
4667                            o.subtitle_on = true;
4668                            o.current_subtitle = x;
4669                            o.controls.SubtitleChanged()
4670                        }
4671                    }
4672                }
4673            }
4674        }
4675
4676        function SubtitleLoadAll(x) {
4677            o.subtitle_on = true;
4678            Parsed()
4679        }
4680
4681        function SubtitleLoad2(x, y) {
4682            var url = y == 'hls' ? x : trim(o.subsor[o.sub_or]);
4683            var url2 = url;
4684            var _id;
4685            if (parsed[url]) {
4686                if (o.subs[x] != 'all') {
4687                    o.subtitle_on = true;
4688                    Parsed()
4689                }
4690            } else {
4691                if (url.indexOf('id_') > 0 && url.indexOf('id_') < 4) {
4692                    _id = url.substr(0, url.indexOf('id_'));
4693                    url2 = url.substr(url.indexOf('id_') + 3)
4694                }
4695                var xhr = XHR(url2);
4696                loading = x;
4697                o.subload = 1;
4698                xhr.onload = function () {
4699                    o.subload = 0;
4700                    if (this.readyState == 4 && this.status == 200) {
4701                        o.subtitle_on = true;
4702                        SubtitleParse(url, this.responseText, x, y)
4703                    } else {
4704                        if (o.sub_or + 1 < o.subsor.length) {
4705                            o.sub_or++;
4706                            SubtitleLoad2(loading)
4707                        } else {
4708                            SubtitleError("loading_error")
4709                        }
4710                    }
4711                };
4712                xhr.onerror = function (e) {
4713                    o.subload = 0;
4714                    if (o.sub_or + 1 < o.subsor.length) {
4715                        o.sub_or++;
4716                        SubtitleLoad2(loading)
4717                    } else {
4718                        SubtitleError("loading_error")
4719                    }
4720                };
4721                xhr.send()
4722            }
4723        };
4724
4725        function SubtitleError(x) {
4726            log("subtitle not found or access denied");
4727            if (o.files_subtitle && o.subs) {
4728                if (o.files_subtitle[o.current_subtitle]) {
4729                    if (o.files_subtitle[o.current_subtitle].indexOf(Lang("loading_error")) == -1) {
4730                        o.files_subtitle[o.current_subtitle] = o.files_subtitle[o.current_subtitle] + ' (' + Lang(x) + ')'
4731                    }
4732                }
4733                if (v.subtitle_errdel == 1 && loading > -1) {
4734                    o.subs[loading] = '';
4735                    o.files_subtitle[loading] = ''
4736                }
4737            }
4738            o.current_subtitle = -1;
4739            o.subtitle_on = false;
4740            if (o.constrols) {
4741                o.controls.SubtitleChanged();
4742                o.controls.refresh()
4743            } else {
4744                setTimeout(function () {
4745                    if (o.controls) {
4746                        o.controls.SubtitleChanged();
4747                        o.controls.refresh()
4748                    }
4749                }, 100)
4750            }
4751            if (exist(o.subtitle)) {
4752                o.frame.removeChild(o.subtitle);
4753                o.subtitle = null
4754            }
4755        }
4756
4757        function SubtitleParse(url, x, y, z) {
4758            var _id;
4759            if (x.indexOf("#" + v.enc2) == 0) {
4760                x = o[o.fd[0]](x)
4761            }
4762            if (x.indexOf("#" + v.enc3) == 0 && x.indexOf(v.file3_separator) > 0) {
4763                x = o[o.fd[1]](x)
4764            }
4765            if (url.indexOf('id_') > 0 && url.indexOf('id_') < 4) {
4766                _id = url.substr(0, url.indexOf('id_'))
4767            }
4768            if (url.indexOf('.srt') > -1 || url.indexOf('.ass') > -1 || url.indexOf('.ssa') > -1 || url.indexOf('.vtt') > -1) {
4769                var l = _id ? _id : o.current_subtitle;
4770                !o.subs ? o.subs = [] : '';
4771                if (o.subs[l] == "all") {
4772                    l = y
4773                }
4774                if (z != 'hls' || !sub[l]) {
4775                    sub[l] = Object();
4776                    sub[l][0] = [];
4777                    sub[l][1] = []
4778                }
4779                var rows = Array();
4780                rows = x.split(/\r|\n/);
4781                var cnt = 1;
4782                var t1 = 0;
4783                var t2 = 0;
4784                var url_shift = (exist(v.subshift) ? v.subshift : 0);
4785                if (url.indexOf('shift=') > 0) {
4786                    url_shift = url.substr(url.indexOf('shift=') + 6) * 1
4787                }
4788                for (var i = 0; i < rows.length; i++) {
4789                    if (url.indexOf('.srt') > -1 || url.indexOf('.vtt') > -1) {
4790                        if (rows[i].indexOf('-->') > -1 && rows[i].indexOf(':') > -1) {
4791                            if (z == 'hls') {
4792                                if (hlsrows.indexOf(rows[i]) > -1) {
4793                                    break
4794                                }
4795                                hlsrows.push(rows[i])
4796                            }
4797                            t1 = TimeSub(rows[i].substr(0, rows[i].indexOf('-->'))) * 1 + url_shift;
4798                            t1 == 0 ? t1 = 1 : '';
4799                            t2 = TimeSub(rows[i].substr(rows[i].indexOf('-->') + 4, 12)) * 1 + url_shift;
4800                            exist(sub[l][0][t1]) ? '' : sub[l][0][t1] = '';
4801                            for (var j = t1; j < t2; j++) {
4802                                sub[l][1][j] = t1
4803                            }
4804                            cnt++
4805                        } else {
4806                            rows[i] = trim(rows[i]);
4807                            if (rows[i] != '' && rows[i].length > 0 && rows[i] != cnt && rows[i] != 'WEBVTT') {
4808                                if (exist2(sub[l][0][t1])) {
4809                                    sub[l][0][t1] = sub[l][0][t1] + '<br>' + rows[i]
4810                                } else {
4811                                    sub[l][0][t1] = rows[i]
4812                                }
4813                            }
4814                        }
4815                    }
4816                    if (url.indexOf('.ass') > -1 || url.indexOf('.ssa') > -1) {
4817                        if (rows[i].indexOf('Dialogue:') > -1) {
4818                            t1 = TimeSub(rows[i].substr((url.indexOf('.ssa') > -1 ? rows[i].indexOf('=0') + 3 : 12), 12)) * 1 + url_shift;
4819                            t2 = TimeSub(rows[i].substr((url.indexOf('.ssa') > -1 ? rows[i].indexOf('=0') + 14 : 23), 10)) * 1 + url_shift;
4820                            var p = '';
4821                            if (rows[i].indexOf('0,,') > 0) {
4822                                p = rows[i].substr(rows[i].indexOf('0,,') + 3)
4823                            } else {
4824                                if (rows[i].indexOf('ffect,') > 0) {
4825                                    p = rows[i].substr(rows[i].indexOf('ffect,') + 6)
4826                                }
4827                                if (rows[i].indexOf(')}') > 0) {
4828                                    p = rows[i].substr(rows[i].indexOf(')}') + 2)
4829                                }
4830                            }
4831                            if (p != '') {
4832                                if (sub[l][0][t1] != undefined) {
4833                                    sub[l][0][t1] += '<br>' + p
4834                                } else {
4835                                    sub[l][0][t1] = p
4836                                }
4837                                sub[l][0][t1] = sub[l][0][t1].replace(/{.*?}/, '');
4838                                sub[l][0][t1] = sub[l][0][t1].replace(/\\\\N/, '<br>');
4839                                sub[l][0][t1] = sub[l][0][t1].replace(/\\N/, '<br>');
4840                                for (var j = t1; j < t2; j++) {
4841                                    sub[l][1][j] = t1
4842                                }
4843                            }
4844                        }
4845                    }
4846                }
4847                parsed[url] = true;
4848                if (o.subs[y] != 'all') {
4849                    z != 'hls' ? Parsed() : ''
4850                }
4851            } else {
4852                if (x != '') {
4853                    if (x.indexOf('[') == 0) {
4854                        Start(x)
4855                    } else {
4856                        SubtitleError("error")
4857                    }
4858                } else {
4859                    Remove();
4860                    o.controls.refresh()
4861                }
4862            }
4863        }
4864
4865        function Parsed() {
4866            o.controls.SubtitleChanged();
4867            o.actions.RenewSubtitle();
4868            o.controls.refresh()
4869        }
4870
4871        function TimeSub(srt) {
4872            var tmp = srt.split(':');
4873            var out = 0;
4874            tmp.length == 2 ? tmp.unshift("00") : '';
4875            tmp[0] != '00' ? out += tmp[0] * 3600 : '';
4876            tmp[1] != '00' ? out += tmp[1] * 60 : '';
4877            out += tmp[2].substr(0, 2) * 1;
4878            out = out * 10 + tmp[2].substr(3, 1) * 1;
4879            return out
4880        };
4881
4882        function SetSubtitle(x) {
4883            if (exist(o.current_subtitle)) {
4884                if (o.current_subtitle != x) {
4885                    hlsrows = [];
4886                    if (x == -1 || (v.sub_off == 1 && x == ioff)) {
4887                        SubtitleOff()
4888                    } else {
4889                        v.sub_shift = 0;
4890                        o.current_subtitle = x;
4891                        o.subtitle_on = true;
4892                        v.subtitle_start = 1;
4893                        SetSubtitle2(x);
4894                        js("subtitle", o.files_subtitle[x]);
4895                        o.controls.SubtitleChanged()
4896                    }
4897                } else {
4898                    if (v.sub_off != 1) {
4899                        SubtitleOff()
4900                    }
4901                }
4902            }
4903        }
4904
4905        function SubRem() {
4906            if (exist(o.files_subtitle[o.current_subtitle])) {
4907                if (o.storage && v.sub_store == 1) {
4908                    localStorage.setItem("pljssubtitle", o.files_subtitle[o.current_subtitle])
4909                } else {
4910                    o.remember_sub = o.files_subtitle[o.current_subtitle]
4911                }
4912            }
4913        }
4914
4915        function SetSubtitle2(x) {
4916            if (exist(o.subs[x])) {
4917                log("Subtitle", x);
4918                o.current_subtitle = x;
4919                SubRem();
4920                if (o.file_type == "hls" && o.hls_subs == true) {
4921                    o.media.hlsDashSub(x, "hls")
4922                } else {
4923                    if (o.file_type == "dash" && o.dash_subs == true) {
4924                        o.media.hlsDashSub(x, "dash")
4925                    } else {
4926                        if (o.subs[x] == "all") {
4927                            SubtitleLoadAll(o.current_subtitle)
4928                        } else {
4929                            SubtitleLoad(o.current_subtitle)
4930                        }
4931                    }
4932                }
4933            }
4934        };
4935        this.SubUpload = function () {
4936            if (o.subupld) {
4937                var x = o.subupld.files;
4938                if (x[0]) {
4939                    var y = new FileReader();
4940                    y.onload = function (e) {
4941                        var z = e.target.result;
4942                        upld.push(z);
4943                        o.current_subtitle = -1;
4944                        var z = x[0].name;
4945                        if (z.length > 40) {
4946                            z = x[0].name.substr(0, 15) + '...' + x[0].name.substr(-15)
4947                        }
4948                        if (v.sub_off == 1 && v.sub_off0 == 1) {
4949                            o.subs.push('upld' + (upld.length - 1));
4950                            o.files_subtitle.push(z + '');
4951                            SetSubtitle(o.subs.length - 1)
4952                        } else {
4953                            o.subs.unshift('upld' + (upld.length - 1));
4954                            o.files_subtitle.unshift(z + '');
4955                            v.sub_off == 1 ? ioff++ : '';
4956                            SetSubtitle(0)
4957                        }
4958                        o.subupld.value = ""
4959                    };
4960                    y.readAsText(x[0])
4961                } else {
4962                    o.subupld.click()
4963                }
4964            }
4965        };
4966        this.SetSubtitle = function (x) {
4967            SetSubtitle(x)
4968        };
4969        this.ioff = function () {
4970            return ioff
4971        };
4972        this.setioff = function (x) {
4973            ioff = x
4974        };
4975        this.show = function (x) {
4976            Show(x)
4977        };
4978        this.style = function () {
4979            Style()
4980        };
4981        this.remove = function () {
4982            Remove()
4983        };
4984        this.off = function () {
4985            SubtitleOff()
4986        };
4987
4988        function SubtitleOff() {
4989            js("subtitle", "off");
4990            o.subtitle_on ? o.last_subtitle = o.current_subtitle : '';
4991            o.current_subtitle = v.sub_off == 1 ? ioff : -1;
4992            v.subtitle_start = 0;
4993            o.subtitle_on = false;
4994            o.controls.SubtitleChanged();
4995            SubRem();
4996            o.dash_subs ? SetSubtitle2(o.current_subtitle) : '';
4997            exist(o.subtitle) ? o.frame.removeChild(o.subtitle) : '';
4998            o.subtitle = null
4999        }
5000
5001        function Show(time) {
5002            if (o.nativecontrols) {
5003                return
5004            }
5005            var t = parseInt(time * 10);
5006            if (v.sub_shift) {
5007                time = time - v.sub_shift * 1
5008            }
5009            if (o.subtitle_on && exist(o.subs)) {
5010                if (sub) {
5011                    var x = o.current_subtitle;
5012                    var t = parseInt(time * 10);
5013                    if (v.subpausehide == 1 && !o.play) {
5014                        return
5015                    }
5016                    if (o.subs[x] == "all") {
5017                        if (!alldd) {
5018                            for (var i = 0; i < o.subs.length; i++) {
5019                                setTimeout(SubtitleLoad, i * 500, i)
5020                            }
5021                            if (!sub[x]) {
5022                                sub[x] = Object();
5023                                sub[x][0] = Array();
5024                                sub[x][1] = Array()
5025                            }
5026                            alldd = true
5027                        } else {
5028                            if (sub[x][1][t]) {} else {
5029                                for (var i = 0; i < o.subs.length; i++) {
5030                                    if (sub[i]) {
5031                                        if (exist(sub[i][1])) {
5032                                            if (exist(sub[i][1][t])) {
5033                                                if (!sub[x][0][t]) {
5034                                                    sub[x][0][t] = ''
5035                                                }
5036                                                sub[x][0][t] += (sub[x][0][t] != '' ? '<br>[sub2]' : '') + sub[i][0][sub[i][1][t]] + (sub[x][0][t] != '' ? '[/sub2]' : '')
5037                                            }
5038                                        }
5039                                    }
5040                                }
5041                                if (exist(sub[x][0])) {
5042                                    if (exist(sub[x][0][t])) {
5043                                        sub[x][1][t] = t
5044                                    }
5045                                }
5046                            }
5047                        }
5048                    }
5049                    if (exist(sub[x])) {
5050                        if (exist(sub[x][1])) {
5051                            if (exist(sub[x][1][t])) {
5052                                var y = '';
5053                                y = sub[x][0][sub[x][1][t]];
5054                                if (!exist(o.subtitle)) {
5055                                    o.subtitle = createElement('div');
5056                                    attr(o.subtitle, {
5057                                        id: 'pjs_' + v.id + '_' + 'subtitle'
5058                                    });
5059                                    o.frame.appendChild(o.subtitle);
5060                                    Style();
5061                                    js("subtitles", o.files_subt
5061itle[x])
5062                                }
5063                                if (empty) {
5064                                    show2(o.subtitle)
5065                                }
5066                                SubtitleBottom();
5067                                if (v.sub_split2words == 1) {
5068                                    y = PluginSubword(y)
5069                                }
5070                                if (v.sub_all == 1) {
5071                                    y = y.replace(/\[sub2\]/gm, '<span style="color:' + CheckColor(v.sub_color2) + '">');
5072                                    y = y.replace(/\[\/sub2\]/gm, '</span>')
5073                                }
5074                                if (y.indexOf('<c.') > -1) {
5075                                    y = y.replace(/\<c./gm, '<span style=color:');
5076                                    y = y.replace(/\<\/c\>/gm, '</span>')
5077                                }
5078                                if (v.apiprm) {
5079                                    if (v.apiprm.sub == 1 && lastsub != y) {
5080                                        js("sub", y);
5081                                        lastsub = y
5082                                    }
5083                                }
5084                                o.subtitle.innerHTML = '<span style="' + (v.sub_bg == 1 ? 'background-color:' + hex2rgb(v.sub_bgcolor, v.sub_bga) + ';' : '') + '-webkit-box-decoration-break: clone;color:' + CheckColor(v.sub_color) + ';padding:' + v.sub_bgpadding + 'px ' + v.sub_bgpadding * 2 + 'px;border-radius:' + v.sub_bgo + 'px;margin:0 0;line-height:' + (v.sub_lineheight ? v.sub_lineheight : 1.8) + ';font-weight:' + v.sub_weight + '">' + trim(y) + '</span>';
5085                                css(o.subtitle, {
5086                                    "font-size": ((parseInt(v.sub_size) + ((parseInt(v.sub_sizeproc) - 100) * parseInt(v.sub_size) / 100)) + "px")
5087                                });
5088                                if (v.sub_big_fullscreen == 1) {
5089                                    if (o.fullscreen) {
5090                                        css(o.subtitle, {
5091                                            "font-size": ((v.sub_size_fullscreen + ((parseInt(v.sub_sizeproc) - 100) * v.sub_size_fullscreen / 100)) + "px")
5092                                        })
5093                                    }
5094                                }
5095                                empty = false
5096                            } else {
5097                                if (!empty && exist(o.subtitle)) {
5098                                    Empty()
5099                                }
5100                            }
5101                        }
5102                    } else {
5103                        Empty()
5104                    }
5105                }
5106            }
5107        }
5108
5109        function Empty() {
5110            if (!empty) {
5111                o.subtitle ? o.subtitle.innerHTML = '' : '';
5112                empty = true;
5113                hide2(o.subtitle)
5114            }
5115        }
5116
5117        function Style() {
5118            if (o.subtitle) {
5119                css(o.subtitle, {
5120                    "position": "absolute",
5121                    "width": "100%",
5122                    "padding-left": "10%",
5123                    "padding-right": "10%",
5124                    "left": 0,
5125                    "color": v.sub_color,
5126                    "text-align": "center",
5127                    "box-sizing": "border-box"
5128                });
5129                if (v.sub_fonted == 1 && exist(v.sub_font)) {
5130                    v.sub_font != '' ? css(o.subtitle, {
5131                        "font-family": v.sub_font
5132                    }) : ''
5133                }
5134                if (v.sub_stroke == 1) {
5135                    css(o.subtitle, {
5136                        "text-shadow": "-1px -1px 0 #000,1px -1px 0 #000,-1px  1px 0 #000,1px  1px 0 #000"
5137                    })
5138                } else {
5139                    if (v.sub_shadow == 1) {
5140                        css(o.subtitle, {
5141                            "text-shadow": "1px 1px 2px black"
5142                        })
5143                    } else {
5144                        css(o.subtitle, {
5145                            "text-shadow": "none"
5146                        })
5147                    }
5148                }
5149                if (v.sub_drag == 1) {
5150                    PluginMovable(o.subtitle, 'o.subdrag')
5151                } else {
5152                    v.sub_split2words != 1 ? Pnt0(o.subtitle) : ''
5153                }
5154            }
5155        }
5156
5157        function SubtitleBottom() {
5158            if (!o.subdrag) {
5159                if ((o.controls.ToolbarHidden() || v.sub_bottom > v.toolbar.h) && v.sub_move == 1) {
5160                    css(o.subtitle, {
5161                        "position": "absolute",
5162                        "top": "auto",
5163                        "left": 0,
5164                        "bottom": v.sub_bottom * 1
5165                    })
5166                } else {
5167                    css(o.subtitle, {
5168                        "position": "absolute",
5169                        "top": "auto",
5170                        "left": 0,
5171                        "bottom": (v.sub_bottom * 1 + v.toolbar.h * 1)
5172                    })
5173                }
5174            }
5175        }
5176
5177        function Remove() {
5178            o.current_subtitle = -1;
5179            o.subtitle_on = false;
5180            o.thumbs_on = false;
5181            v.subtitle = null;
5182            v.thumbnails = null;
5183            o.sub = null;
5184            o.subs = null;
5185            alldd = false;
5186            parsed = [];
5187            sub = [];
5188            if (exist(o.controls)) {
5189                o.controls.SubtitleChanged()
5190            }
5191            o.files_subtitle = [];
5192            if (exist(o.subtitle)) {
5193                o.frame.removeChild(o.subtitle);
5194                o.subtitle = null
5195            }
5196            o.current_subtitle = null;
5197            o.subtitle_on = false
5198        }
5199    };
5200    var PluginOldGA = function () {
5201        var tr = 0;
5202        if (v.ga_proc < 100) {
5203            if (random(1, (100 / v.ga_proc)) != 1) {
5204                v.ga = 0
5205            }
5206        }
5207        if (v.ga == 1) {
5208            if (v.ga4 == 1) {} else {
5209                if (exist(v.gaid)) {
5210                    if (v.gaid.indexOf("UA") == 0) {
5211                        if (!window.ga) {
5212                            Script(o.gaurl, o.gaurl);
5213                            setTimeout(InitUa, 2000)
5214                        } else {
5215                            InitUa()
5216                        }
5217                    }
5218                }
5219            }
5220        }
5221
5222        function InitUa() {
5223            if (window.ga) {
5224                ga('create', v.gaid, 'auto', {
5225                    'name': 'user',
5226                    'allowLinker': true
5227                });
5228                gaTracker("init", "Init", 1);
5229                o.play ? gaTracker("play", "Play") : ''
5230            } else {
5231                if (tr > 2) {
5232                    v.ga = 0
5233                } else {
5234                    tr++;
5235                    setTimeout(InitUa, 1000)
5236                }
5237            }
5238        }
5239    };
5240    o.lang_ru = {
5241        "auto": "Авто",
5242        "play": "Пуск",
5243        "pause": "Пауза",
5244        "stop": "Стоп",
5245        "fullscreen": "Во весь экран",
5246        "normalscreen": "Выйти из полноэкранного режима",
5247        "settings": "Настройки",
5248        "options": "Параметры",
5249        "volume": "Громкость",
5250        "mute": "Выключить звук",
5251        "unmute": "Включить звук",
5252        "live": "В ЭФИРЕ",
5253        "playlist": "Плейлист",
5254        "quality": "Качество",
5255        "download": "Скачать",
5256        "subtitle": "Субтитры",
5257        "speed": "Скорость",
5258        "normal": "Обычная",
5259        "error": "ошибка",
5260        "unmute_video": "Включите звук",
5261        "audiotrack": "Аудио",
5262        "loading_error": "ошибка загрузки",
5263        "160p": "Очень низкое",
5264        "240p": "Низкое",
5265        "360p": "Среднее",
5266        "480p": "Высокое",
5267        "540p": "Высокое",
5268        "next": "Следующий",
5269        "prev": "Предыдущий",
5270        "share": "Поделиться",
5271        "copied": "Скопировано в буфер обмена",
5272        "ads": "Реклама",
5273        "skip": "Пропустить",
5274        "skip_after_": "Пропустить через ",
5275        "adsinvitation": "Перейти на сайт рекламодателя",
5276        "sub_sizeproc": "Размер текста",
5277        "sub_shift": "Сдвиг по времени",
5278        "sub_color": "Цвет текста",
5279        "sub_color2": "Цвет текста 2",
5280        "sub_bgcolor": "Цвет фона",
5281        "sub_bga": "Прозрачность фона",
5282        "sub_shadow": "Тень",
5283        "sub_stroke": "Контур",
5284        "sub_weight": "Толщина текста",
5285        "sub_bottom": "Отступ снизу",
5286        "sub_reset": "Сбросить",
5287        "sub_x": "Скрыть параметры",
5288        "upload": "Загрузить",
5289        "sleeptimer": "Сон",
5290        "offsettimer": "Пропуск",
5291        "hour": "Час",
5292        "minute": "Минута",
5293        "second": "Секунда",
5294        "1val": "Да",
5295        "0val": "Нет",
5296        "of": "из",
5297        "pass": "Пароль",
5298        "casterror": "Ошибка воспроизведения на устройстве",
5299        "castdevice": "Играет на устройстве",
5300        "channel": "Канал",
5301        "scale": "Масштаб",
5302        "on": "Вкл.",
5303        "off": "Выкл.",
5304        "together": "Все сразу",
5305        "kbps": "кбит/с",
5306        "embed": "Код",
5307        "url": "Ссылка",
5308        "color": "Цвет",
5309        "contrast": "Контраст",
5310        "brightness": "Яркость",
5311        "saturate": "Насыщенность",
5312        "sepia": "Сепия"
5313    };
5314    var Motion = function (x) {
5315        var _ease;
5316        var _timer;
5317        var _type;
5318        var _from;
5319        var _to;
5320        var _steps;
5321        var _step = 0;
5322        var _speed;
5323        var _stop = false;
5324        var _timeout;
5325        if (x.me != undefined && x.mc != undefined && x.type != undefined && x.to != undefined) {
5326            if (x.time == null) {
5327                if (x.type.indexOf("alpha") > -1) {
5328                    x.to == 0 ? x.time = 0.5 : x.time = 0.2
5329                } else {
5330                    x.time = 0.20
5331                }
5332            }
5333            _ease = Ease(x.ease);
5334            if (x.type.indexOf("scale") == -1) {
5335                if (exist(o.motions[x.me])) {
5336                    o.motions[x.me].TheEnd()
5337                }
5338                o.motions[x.me] = this
5339            }
5340            if (x.show == 1) {
5341                x.mc.set("display", true)
5342            }
5343            _type = x.type.split('|');
5344            _to = String(x.to).split('|');
5345            _from = new Array();
5346            for (var i = 0; i < _type.length; i++) {
5347                if (!_to[i]) {
5348                    _to[i] = _to[0]
5349                }
5350                if (_type[i] == "alpha") {
5351                    _from[i] = x.mc.g("opacity")
5352                }
5353                if (_type[i] == "alpha_div") {
5354                    _from[i] = x.mc.style.opacity
5355                }
5356                if (_type[i] == "y") {
5357                    _from[i] = x.mc.g("y")
5358                }
5359                if (_type[i] == "x") {
5360                    _from[i] = x.mc.g("x")
5361                }
5362                if (_type[i] == "left") {
5363                    _from[i] = parseInt(x.mc.style.left)
5364                }
5365                if (_type[i] == "top") {
5366                    _from[i] = parseInt(x.mc.style.top)
5367                }
5368                if (_type[i] == "scale") {
5369                    _from[i] = x.mc.g("scaleX")
5370                }
5371                if (_type[i] == "scroll") {
5372                    _from[i] = x.mc.scrollTop
5373                }
5374                if (_type[i] == "scrollleft") {
5375                    _from[i] = x.mc.scrollLeft
5376                }
5377                if (_type[i] == "scaleY") {
5378                    _from[i] = x.mc.g("scaleY")
5379                }
5380                if (_type[i] == "scaleX") {
5381                    _from[i] = x.mc.g("scaleX")
5382                }
5383                if (_type[i] == "width") {
5384                    _from[i] = x.mc.g("width")
5385                }
5386                if (_type[i] == "width_div") {
5387                    _from[i] = x.mc.offsetWidth;
5388                    _to[i] = Math.floor(_to[i]);
5389                    x.me == "line_play" ? log("width", x.me, _from[i], _to[i], x.mc.offsetWidth) : ''
5390                }
5391                if (_type[i] == "height") {
5392                    _from[i] = x.mc.g("height")
5393                }
5394                if (_type[i] == "height_div") {
5395                    _from[i] = x.mc.offsetHeight
5396                }
5397                _to[i] = Number(_to[i]);
5398                _from[i] = Number(_from[i])
5399            }
5400            _speed = x.time * 1000 / _ease.length;
5401            _steps = _ease.length;
5402            if (_type.length == 1 && _from[0] == _to[0]) {
5403                End()
5404            } else {
5405                setTimeout(onStep, Math.round(_speed))
5406            }
5407        }
5408
5409        function onStep() {
5410            for (var i = 0; i < _type.length; i++) {
5411                var tmp = _from[i] + (_to[i] - _from[i]) * (_ease[_step] ? _ease[_step] : 0);
5412                Alpha(_type[i], tmp);
5413                if (_type[i] == "y") {
5414                    x.mc.set("top", tmp)
5415                }
5416                if (_type[i] == "x") {
5417                    x.mc.set("left", tmp)
5418                }
5419                if (_type[i] == "left") {
5420                    x.mc.style.left = tmp + "px"
5421                }
5422                if (_type[i] == "top") {
5423                    x.mc.style.top = tmp + "px"
5424                }
5425                if (_type[i] == "scale") {
5426                    x.mc.set("scale", tmp)
5427                }
5428                if (_type[i] == "scaleY") {
5429                    x.mc.set("scaleY", tmp)
5430                }
5431                if (_type[i] == "scaleX") {
5432                    x.mc.set("scaleX", tmp)
5433                }
5434                if (_type[i] == "scroll") {
5435                    x.mc.scrollTop = tmp
5436                }
5437                if (_type[i] == "scrollleft") {
5438                    x.mc.scrollLeft = tmp
5439                }
5440                if (_type[i] == "width") {
5441                    x.mc.set("width", tmp)
5442                }
5443                if (_type[i] == "width_div") {
5444                    css(x.mc, {
5445                        "width": tmp
5446                    })
5447                }
5448                if (_type[i] == "height") {
5449                    x.mc.set("height", tmp)
5450                }
5451                if (_type[i] == "height_div") {
5452                    css(x.mc, {
5453                        "height": tmp
5454                    })
5455                }
5456            }
5457            _step++;
5458            if (!_stop) {
5459                if (_step == _steps) {
5460                    End()
5461                } else {
5462                    _timeout = setTimeout(onStep, Math.round(_speed))
5463                }
5464            }
5465        }
5466
5467        function End() {
5468            _stop = true;
5469            if (x.hide) {
5470                if (_type[0] == "alpha_div" || _type[0] == "left") {
5471                    hide(x.mc)
5472                } else {
5473                    x.mc.set("display", false)
5474                }
5475            }
5476            if (x.type.indexOf("scale") == -1) {
5477                o.motions[x.me] = null;
5478                delete o.motions[x.me]
5479            }
5480            for (var i = 0; i < _type.length; i++) {
5481                Alpha(_type[i], _to[i])
5482            }
5483            clearTimeout(_timeout)
5484        };
5485
5486        function Alpha(y, z) {
5487            if (y == "alpha") {
5488                x.mc.set("opacity", z)
5489            }
5490            if (y == "alpha_div") {
5491                x.mc.style.opacity = z
5492            }
5493        }
5494        this.TheEnd = function () {
5495            End()
5496        };
5497        this.TheEnd2 = function () {
5498            _step = _steps - 1;
5499            onStep();
5500            End()
5501        };
5502        this.XY = function (x0, x1, y0, y1) {
5503            var e = false;
5504            for (var i = 0; i < _type.length; i++) {
5505                if (_type[i] == 'x' && x0 != x1) {
5506                    e = true
5507                }
5508                if (_type[i] == 'y' && y0 != y1) {
5509                    e = true
5510                }
5511            }
5512            e ? End() : ''
5513        };
5514
5515        function Ease(str) {
5516            switch (str) {
5517            case "elastic":
5518                return [0, 0.432, 0.857, 1.275, 1.372, 1.296, 1.102, 0.957, 0.883, 0.87, 0.914, 0.992, 1.029, 1.041, 1.036, 1.019, 0.996, 0.984, 0.981, 0.988, 1.001, 1.006, 1.007, 1.006, 1.003, 0.999, 0.998, 0.998, 0.998, 0.998, 1];
5519                break;
5520            case "cubic":
5521                return [0, 0.096, 0.185, 0.267, 0.344, 0.416, 0.483, 0.547, 0.606, 0.659, 0.705, 0.747, 0.785, 0.818, 0.848, 0.874, 0.897, 0.918, 0.935, 0.95, 0.962, 0.971, 0.979, 
55210.985, 0.99, 0.994, 0.997, 0.999, 1];
5522                break;
5523            default:
5524                return [0, 0.175, 0.32, 0.44, 0.52, 0.6, 0.67, 0.73, 0.775, 0.82, 0.85, 0.885, 0.915, 0.935, 0.95, 0.97, 0.983, 0.993, 1];
5525                break
5526            }
5527        }
5528    };
5529    var System = function () {
5530        var N = navigator.appName,
5531            ua = navigator.userAgent,
5532            tem;
5533        var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
5534        var M = ua.match(/(opera|chrome|safari|firefox|msie|trident|edge)\/?\s*(\.?\d+(\.\d+)*)/i);
5535        if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1];
5536        var mtp = navigator.maxTouchPoints;
5537        this.browser = M ? M[1] : N;
5538        this.version = M ? M[2] : navigator.appVersion;
5539        this.touch = navigator.maxTouchPoints > 1;
5540        this.lang = navigator.language;
5541        this.opera = this.browser == "Opera";
5542        this.ie9 = this.browser == "MSIE 9.0";
5543        this.ie = this.browser == "MSIE" || this.browser == "Trident" || this.browser == "Edge";
5544        this.edge = ua.search(/(edge)\/?\s*/i) > -1;
5545        this.ff = this.browser == "Firefox";
5546        this.safari = this.browser == "Safari";
5547        this.chrome = window.chrome;
5548        this.win = ua.search("Windows NT") > -1;
5549        this.ios = (ua.search(/(iphone|ipad|ipod)\/?\s*/i) > -1) || (navigator.platform === 'MacIntel' && mtp > 1);
5550        this.tv = v.notv != 1 && ua.search(/(TV|tvOS|webOS|armv|BRAVIA|Roku|Tizen|Philips)\/?\s*/i) > -1;
5551        this.lg = v.notv != 1 && ua.search(/(LG)\/?\s*/i) > -1;
5552        this.iphone = ua.search(/(iphone)\/?\s*/i) > -1;
5553        this.ipad = this.ios && !this.iphone;
5554        this.webkit = 'WebkitAppearance' in document.documentElement.style;
5555        if (ua.search(/(android)\/?\s*/i) > -1) {
5556            mtp > 0 ? this.android = true : this.tv = true;
5557            if (matchMedia('(pointer:fine)').matches) {
5558                this.tv = true
5559            }
5560        }
5561        this.mobile = (options.mobile == 1 || this.ios || this.android || (ua.search(/(blackberry|iemobile|opera mini)\/?\s*/i) > -1)) && !this.tv && options.nomobile != 1;
5562        this.mutedautoplay = this.safari || this.chrome;
5563        this.fullscreen = false;
5564        if (this.ios) {
5565            this.iosv = parseFloat(ua.substr(ua.indexOf('OS ') + 3, 4).replace('_', '.'));
5566            if (this.ipad && (!'ontouchstart' in window || mtp < 2)) {
5567                this.mobile = this.ios = false;
5568                this.tv = true
5569            }
5570        }
5571        this.desktop = !this.mobile;
5572        this.mobtch = this.mobile || this.touch;
5573        this.mobiletv = this.mobile || this.tv;
5574        this.wkdt = this.webkit && this.desktop;
5575        if (o.frame.requestFullScreen || o.frame.requestFullscreen || o.frame.mozRequestFullScreen || o.frame.webkitRequestFullScreen || o.frame.msRequestFullscreen) {
5576            this.fullscreen = true
5577        }
5578    };
5579
5580    function UpdateObject(obj, obj2) {
5581        for (var s in obj2) {
5582            if (typeof (obj2[s]) == 'object') {
5583                if (s == "events" || s == "file") {
5584                    obj[s] = obj2[s]
5585                } else {
5586                    for (var s2 in obj2[s]) {
5587                        if (typeof (obj[s]) != 'object') {
5588                            obj[s] = {}
5589                        }
5590                        if (typeof (obj2[s][s2]) == 'object') {
5591                            for (var s3 in obj2[s][s2]) {
5592                                if (typeof (obj[s][s2]) != 'object') {
5593                                    obj[s][s2] = {}
5594                                }
5595                                if (typeof (obj2[s][s2][s3]) == 'object') {
5596                                    for (var s4 in obj2[s][s2][s3]) {
5597                                        if (typeof (obj[s][s2][s3]) != 'object') {
5598                                            obj[s][s2][s3] = {}
5599                                        }
5600                                        obj[s][s2][s3][s4] = obj2[s][s2][s3][s4];
5601                                        if (s3 == 'padding' || s3 == 'margin') {
5602                                            obj[s][s2][s3][s4] = parseInt(obj[s][s2][s3][s4])
5603                                        }
5604                                    }
5605                                } else {
5606                                    obj[s][s2][s3] = obj2[s][s2][s3];
5607                                    if (s2 == 'padding' || s2 == 'margin') {
5608                                        obj[s][s2][s3] = parseInt(obj[s][s2][s3])
5609                                    }
5610                                }
5611                            }
5612                        } else {
5613                            obj[s][s2] = obj2[s][s2];
5614                            if (s == 'padding' || s == 'margin') {
5615                                obj[s][s2] = parseInt(obj[s][s2])
5616                            }
5617                        }
5618                    }
5619                }
5620            } else {
5621                if (s.indexOf("roll") > 0 && trim(obj2[s]) === "") {} else {
5622                    obj[s] = SettingsParser(s, obj2[s])
5623                }
5624            }
5625        }
5626        return obj
5627    };
5628    var SettingsParser = function (key, value) {
5629        if (typeof (value) == 'string') {
5630            value = trim(value);
5631            if (key.indexOf("color") > -1 && value != -1) {
5632                value = CheckColor(value)
5633            }
5634        }
5635        return value
5636    };
5637
5638    function StorageSupport() {
5639        try {
5640            var storage = window['localStorage'],
5641                x = '__storage_test__';
5642            storage.setItem(x, x);
5643            storage.removeItem(x);
5644            return true
5645        } catch (e) {
5646            return false
5647        }
5648    };
5649
5650    function killMotion(motion_id) {
5651        if (motion_id) {
5652            if (exist(o.motions[motion_id])) {
5653                o.motions[motion_id].TheEnd()
5654            }
5655        }
5656    };
5657    var Lang = function (x) {
5658        var y = x;
5659        if (y) {
5660            y = x.charAt(0).toUpperCase() + x.slice(1);
5661            if (y.indexOf("_") > -1) {
5662                y = y.replace(/_/ig, " ")
5663            }
5664        }
5665        var en = {
5666            "of": "of",
5667            "kbps": "kbps",
5668            "castdevice": "Playback on device",
5669            "casterror": "Playback error on device",
5670            "together": "All at once",
5671            "pass": "Password",
5672            "0val": "No",
5673            "sleeptimer": "Sleep",
5674            "offsettimer": "Skip",
5675            "1val": "Yes",
5676            "sub_bottom": "Bottom margin",
5677            "sub_weight": "Font weight",
5678            "sub_shadow": "Shadow",
5679            "sub_bga": "Background opacity",
5680            "sub_bgcolor": "Background color",
5681            "sub_sizeproc": "Text size",
5682            "sub_color": "Text color",
5683            "sub_color2": "Text color 2",
5684            "sub_shift": "Time shift",
5685            "sub_x": "Close options",
5686            "sub_reset": "Reset",
5687            "prev": "Previous",
5688            "copied": "Copied to clipboard",
5689            "160p": "Tiny",
5690            "240p": "Small",
5691            "360p": "Medium",
5692            "480p": "High",
5693            "540p": "High",
5694            "720p": "HD",
5695            "1080p": "Full HD",
5696            "1296p": "Super HD",
5697            "1440p": "Quad HD",
5698            "2160p": "Ultra HD 4K",
5699            "ads": "Ad",
5700            "adsinvitation": "Go to the advertiser's website",
5701            "audiotrack": "Audio",
5702            "live": "LIVE",
5703            "fullscreen": "Enter fullscreen",
5704            "normalscreen": "Exit fullscreen"
5705        };
5706        if (exist(en[x])) {
5707            y = en[x]
5708        }
5709        if (v.slng == 1) {
5710            if (o['lang_' + o.system.lang]) {
5711                v.lang = o.system.lang;
5712                v.slng = 0
5713            }
5714        }
5715        if (exist(o['lang_' + v.lang])) {
5716            if (exist(o['lang_' + v.lang][x])) {
5717                y = o['lang_' + v.lang][x]
5718            }
5719        }
5720        if (v.rename) {
5721            if (v.rename[x]) {
5722                y = v.rename[x]
5723            }
5724        }
5725        return y
5726    };
5727    var gaTracker = function (x, y, z) {
5728        if (!exist(o.gatracked[y]) && v.playerjscom != 1) {
5729            var t = o.titlestore ? o.titlestore : (v.title ? v.title : '');
5730            exist(v.label) ? t = v.label : '';
5731            if (v.yamtr_event[x] == 1 && v.yamtr == 1 && exist(v.yamtrid)) {
5732                if (x == "init") {
5733                    setInterval(yaHit, 300000)
5734                }
5735                if (exist(window["yaCounter" + v.yamtrid])) {
5736                    window["yaCounter" + v.yamtrid].reachGoal('playerjs_' + x, {
5737                        title: t
5738                    });
5739                    log("Yandex", 'playerjs_' + x)
5740                } else {
5741                    log("Yandex Metric error")
5742                }
5743            }
5744            if (v.ga_event[x] == 1) {
5745                if (v.ga == 1) {
5746                    var gao;
5747                    if (window.gtag) {
5748                        gao = {
5749                            'event_category': 'PlayerJS',
5750                            'event_label': t
5751                        };
5752                        if (v.galabels) {
5753                            if (typeof (v.galabels) == "object") {
5754                                for (var g in v.galabels) {
5755                                    if (v.galabels.hasOwnProperty(g)) {
5756                                        gao[g] = v.galabels[g]
5757                                    }
5758                                }
5759                            }
5760                        }
5761                        v.galog == 1 ? log('ga', 'playerjs_' + x, gao) : '';
5762                        gtag('event', 'playerjs_' + x, gao)
5763                    }
5764                }
5765            }
5766        }
5767        z ? o.gatracked[y] = true : ''
5768    };
5769
5770    function yaHit() {
5771        if (exist(window["yaCounter" + v.yamtrid])) {
5772            window["yaCounter" + v.yamtrid].reachGoal('playerjs_hit')
5773        }
5774    };
5775    var YoutubeID = function (url) {
5776        var x = '';
5777        url = url.replace("v=", "{=");
5778        if (url) {
5779            if (url.indexOf('youtu.be/') > -1) {
5780                x = url.substr(url.indexOf(".be/") + 4);
5781                x.replace("/", "")
5782            } else {
5783                x = url.split(/(youtu.be\/|v\/|embed\/|watch\?|youtube.capiom\/user\/[^#]*#([^\/]*?\/)*)\??{?=?([^#\&\?]*)/)[3]
5784            }
5785            if (x != '') {
5786                if (x.indexOf("?t=") > 0) {
5787                    v.start = x.substr(x.indexOf("?t=") + 3);
5788                    var h = 0;
5789                    var m = 0;
5790                    var s = 0;
5791                    if (v.start.indexOf("h") > 0) {
5792                        h = v.start.substr(0, v.start.indexOf("h"));
5793                        v.start = v.start.substr(v.start.indexOf("h") + 1)
5794                    }
5795                    if (v.start.indexOf("m") > 0) {
5796                        m = v.start.substr(0, v.start.indexOf("m"));
5797                        v.start = v.start.substr(v.start.indexOf("m") + 1)
5798                    }
5799                    if (v.start.indexOf("s") > 0) {
5800                        s = v.start.substr(0, v.start.indexOf("s"));
5801                        v.start = v.start.substr(v.start.indexOf("s") + 1)
5802                    }
5803                    if (h > 0 || m > 0 || s > 0) {
5804                        v.start = h * 3600 + m * 60 + s * 1
5805                    }
5806                }
5807                if (x.indexOf("?") > 0) {
5808                    x = x.substr(0, x.indexOf("?"))
5809                }
5810            }
5811        }
5812        return x
5813    };
5814    var js = function (x, y, li, ev) {
5815        if (x == "init") {
5816            o.init = true
5817        }
5818        if (ev == 1) {
5819            for (var yi in y) {
5820                if (y.hasOwnProperty(yi)) {
5821                    if (typeof (y[yi]) == "object") {
5822                        y[yi] = ''
5823                    }
5824                }
5825            }
5826        }
5827        if (v.eventstracker == 1 && o.init) {
5828            if (v.eventlisteners == 1 || li == 1) {
5829                JsEvent(x, y)
5830            } else {
5831                if (y != undefined) {
5832                    if (typeof (y) == 'object') {
5833                        try {
5834                            y = JSON.stringify(y)
5835                        } catch (e) {}
5836                    } else {
5837                        if (typeof (y) == 'string') {
5838                            y = y.replace(/'/ig, '′')
5839                        }
5840                    }
5841                }
5842                if (typeof (v.events) == 'string') {
5843                    if (v.events.indexOf("{") == 0) {
5844                        try {
5845                            v.events = v.events.replace(/\'/ig, '"');
5846                            v.events = JSON.parse(v.events)
5847                        } catch (e) {
5848                            console.log(e)
5849                        }
5850                    }
5851                }
5852                if (typeof (v.events) == 'object') {
5853                    if (exist(v.events[x]) || exist(v.events['other'])) {
5854                        var z = x;
5855                        if (!exist(v.events[x]) && exist(v.events['other'])) {
5856                            z = 'other'
5857                        }
5858                        if (x.indexOf("vast_") == 0) {
5859                            if (exist(v.events['vast'])) {
5860                                z = 'vast'
5861                            }
5862                        }
5863                        try {
5864                            if (y !== undefined) {
5865                                eval(v.events[z] + "('" + x + "','" + v.id + "','" + y + "')")
5866                            } else {
5867                                eval(v.events[z] + "('" + x + "','" + v.id + "')")
5868                            }
5869                        } catch (e) {
5870                            log("events", e, x)
5871                        }
5872                    }
5873                } else {
5874                    if (v.events == '') {
5875                        v.events = "PlayerjsEvents"
5876                    }
5877                    try {
5878                        if (y !== undefined) {
5879                            eval(v.events + "('" + x + "','" + v.id + "','" + y + "')")
5880                        } else {
5881                            eval(v.events + "('" + x + "','" + v.id + "')")
5882                        }
5883                    } catch (e) {
5884                        log("events", e, x, y)
5885                    }
5886                }
5887            }
5888        }
5889        if (o.init && v.pjsframe == 1) {
5890            if (o.pjsfrm) {
5891                try {
5892                    o.pjsfrm.contentWindow.postMessage({
5893                        event: x,
5894                        info: y
5895                    }, "*")
5896                } catch (e) {}
5897            }
5898        }
5899        if (v.postmessage == 1 && li !== 1) {
5900            var zv = {
5901                event: x,
5902                time: o.media ? (x == "seek" ? o.seeked_time : o.media.time()) : 0
5903            };
5904            if (y != undefined) {
5905                zv["data"] = y
5906            }
5907            if (x == "duration" || x == "time") {
5908                zv["duration"] = o.media.duration()
5909            }
5910            if (x == "volume" || x == "unmute") {
5911                zv["volume"] = v.volume
5912            }
5913            if (x == "new") {
5914                zv["id"] = apiProcessor("playlist_id")
5915            }
5916            try {
5917                window.parent.postMessage(zv, '*')
5918            } catch (e) {};
5919            var z = x;
5920            x == "init" || x == "start" || x == "end" ? z = x + "ed" : '';
5921            x == "play" ? z = "resumed" : '';
5922            x == "pause" ? z = "paused" : '';
5923            x == "mute" ? z = "muted" : '';
5924            x == "unmute" ? z = "unmuted" : '';
5925            x == "seek" ? z = "rewound" : '';
5926            x == "vast_Impression" ? z = "adShown" : '';
5927            zv["event"] = z;
5928            if (z != '' && z != x) {
5929                zv = JSON.parse(JSON.stringify(zv));
5930                try {
5931                    window.parent.postMessage(zv, '*')
5932                } catch (e) {}
5933            }
5934        }
5935    };
5936    var JsEvent = function (x, y) {
5937        var ev = document.createEvent('Events');
5938        if (y !== undefined) {
5939            ev.info = y
5940        }
5941        ev.initEvent(x, true, true);
5942        o.container.dispatchEvent(ev)
5943    };
5944    this.api = function (x, y, but) {
5945        v.logapi == 1 ? log('api', x, y) : '';
5946        return apiProcessor(x, y, but)
5947    };
5948
5949    function apiProcessor(x, y, but) {
5950        if (exist(o.actions) && typeof (x) == 'string') {
5951            if (o.destroyed == 1) {
5952                return
5953            }
5954            if (but) {
5955                if (typeof (but) == 'string') {
5956                    if (but.indexOf("id:") == 0) {
5957                        but = o.controls.butByS(but.substr(3), "dom");
5958                        if (but) {
5959                            if (x == "button" && y == "toogle") {
5960                                but.Click()
5961                            }
5962                        }
5963                    }
5964                }
5965            }
5966            if (x == "play" || x == "file") {
5967                if (exist(y)) {
5968                    var noads = false;
5969                    if (typeof (y) == 'string') {
5970                        y = y.replace(/(\r\n|\n|\r)/gm, "");
5971                        var seekto = -1;
5972                        if (y.indexOf("[seek:") > -1 && y.lastIndexOf("]") == y.length - 1) {
5973                            seekto = y.substr(y.indexOf("[seek:") + 6, y.length - 1);
5974                            seekto = seekto.substr(0, seekto.length - 1);
5975                            if (seekto == "time") {
5976                                seekto = o.media.time()
5977                            } else {
5978                                seekto = parseInt(seekto)
5979                            }
5980                            y = y.substr(0, y.indexOf("[seek:"));
5981                            if (y == '') {
5982                                if (o.media.duration() > 0) {
5983                                    o.actions.Seek(seekto);
5984                                    o.actions.Play();
5985                                    return
5986                                } else {
5987                                    o.seekto = seekto;
5988                                    o.actions.Play();
5989                                    return
5990                                }
5991                            } else {
5992                                o.seekto = seekto
5993                            }
5994                        }
5995                        if (y.indexOf("[skipads]") > -1) {
5996                            noads = true;
5997                            y = y.replace('[skipads]', '')
5998                        }
5999                        if (y.indexOf("#" + v.enc2) == 0) {
6000                            y = o[o.fd[0]](y)
6001                        }
6002                        if (y.indexOf("#" + v.enc3) == 0 && y.indexOf(v.file3_separator) > 0) {
6003                            o[o.fd[1]](y, api_, x);
6004                            return
6005                        }
6006                        if (y.indexOf("#0") == 0) {
6007                            y = fd0(y)
6008                        }
6009                        if (v.fplace == 1) {
6010                            y = fplace(y)
6011                        }
6012                        if (y.indexOf(".txt") == y.length - 4) {
6013                            var xhr = XHR(y);
6014                            xhr.onload = function () {
6015                                if (this.readyState == 4 && this.status == 200) {
6016                                    try {
6017                                        apiProcessor('play', JSON.parse(this.responseText))
6018                                    } catch (e) {}
6019                                }
6020                            };
6021                            xhr.send();
6022                            return
6023                        }
6024                        if (y.indexOf("id:") == 0 && exist(o.playlist_dic)) {
6025                            var z = FindIdPl(y);
6026                            if (exist(o.playlist_dic[z])) {
6027                                o.controls.PlaylistPlayId(z);
6028                                seekto > -1 ? o.seekto = seekto : '';
6029                                return true
6030                            } else {
6031                                return false
6032                            }
6033                        }
6034                        if (y.indexOf("youtubeid:") == 0) {
6035                            var z = y.substr(10);
6036                            if (o.file_type == "youtube") {
6037                                o.media.playByYoutubeId(z);
6038                                return true
6039                            } else {
6040                                y = '//youtu.be/' + z
6041                            }
6042                        }
6043                    }
6044                    if (x == "play") {
6045                        o.controls.PreNewPl();
6046                        o.actions.NewFile(y, undefined, undefined, (noads ? 1 : 0))
6047                    }
6048                    if (x == "file") {
6049                        o.newfile = true;
6050                        v.autoplay = 0;
6051                        o.actions.NewFile(y, 1, undefined, (noads ? 1 : 0));
6052                        o.controls.Duration(0, 0);
6053                        o.start = false
6054                    }
6055                } else {
6056                    if (x == "play") {
6057                        o.actions.Play()
6058                    }
6059                    if (x == "file") {
6060                        typeof Papi41 == 'function' ? Papi41() : ''
6061                    }
6062                }
6063            }
6064            if (x == "file2") {
6065                y ? o.media.pipSrc(y) : ''
6066            }
6067            if (x == "preload") {
6068                if (exist(y)) {
6069                    o.newfile = true;
6070                    o.actions.NewFile(y, 1, 1)
6071                } else {
6072                    o.media.Preload()
6073                }
6074            }
6075            if (x == "pause") {
6076                if (o.play) {
6077                    o.actions.Pause();
6078                    o.actions.RenewSubtitle()
6079                }
6080            }
6081            if (x == "channel" && exist(y)) {
6082                o.start && o.channels ? o.channels.SetChannel(y) : ''
6083            }
6084            if (x.indexOf("vpaid_") == 0) {
6085                if (o.vast) {
6086                    o.vast.VpaidSet(x.substr(6), y)
6087                }
6088            }
6089            if (x == "alert") {
6090                o.alert.close();
6091                o.alert = new Alert();
6092                if (exist(y)) {
6093                    o.alert.txt(y)
6094                } else {
6095                    if (v.alert404 == 1) {
6096                        o.alert.txt(v.alert404text)
6097                    } else {
6098                        o.alert.txt("Test message")
6099                    }
6100                    if (v.alert404v == 1 && exist(v.alert404video)) {
6101                        o.err404v = new PluginErrorVideo()
6102                    }
6103                }
6104            }
6105            if (x == "waiting") {
6106                !o.start ? o.controls.startcss() : '';
6107                o.controls.Waiting();
6108                o.controls.HideElement("control_start")
6109            }
6110            if (x == "toggle") {
6111                o.play ? o.actions.Pause() : o.actions.Play()
6112            }
6113            if (x == "stop") {
6114                v.preload = 0;
6115                v.autoplay = 0;
6116                o.media.Recover();
6117                o.actions.Stop()
6118            }
6119            if (x == "reload") {
6120                o.time = o.media.time();
6121                o.actions.Reload()
6122            }
6123            if (x == "download") {
6124                if (v.apiprm) {
6125                    if (v.apiprm.on == 1 && v.apiprm.dwn == 1) {
6126                        o.actions.Download()
6127                    }
6128                }
6129            }
6130            if (x == "effect" && exist(y)) {
6131                if (o.effects) {
6132                    o.effects.api(y)
6133                }
6134            }
6135            if (x == "share") {
6136                o.controls.showShare()
6137            }
6138            if (x == "startvast" && exist(y)) {
6139                if (v.vast == 1) {
6140                    if (y.indexOf('js:') == 0) {
6141                        v.midroll = y;
6142                        v.midrolls = true;
6143                        o.actions.advertising("midroll")
6144                    } else {
6145                        if (o.p != '') {
6146                            var sv = JSON.parse(decode(o.p));
6147                            for (var l in sv) {
6148                                if (sv.hasOwnProperty(l)) {
6149                                    if (exist(sv[l].id)) {
6150                                        if (y == sv[l].id) {
6151                                            v.midroll = 'prt' + (exist(sv[l]['cpm']) ? 'cpm' + sv[l]['cpm'] : '') + y + '_' + sv[l].preroll;
6152                                            v.midrolls = true;
6153                                            o.actions.advertising("midroll")
6154                                        }
6155                                    }
6156                                }
6157                            }
6158                        }
6159                    }
6160                }
6161            }
6162            if (x == "vastbreak") {
6163                typeof VastBreak == "function" ? VastBreak(y) : ''
6164            }
6165            if (x == "cuid" && y) {
6166                v.cuid = y;
6167                o.continue ? o.continue.updateCuid() : ''
6168            }
6169            if (x == "mute") {
6170                o.actions.Mute()
6171            }
6172            if (x == "speed") {
6173                if (exist(y)) {
6174                    o.actions.SetSpeed(y)
6175                } else {
6176                    return o.files_speed[o.current_speed]
6177                }
6178            }
6179            if (x == "played") {
6180                if (v.apiprm && o.pld) {
6181                    if (v.apiprm.pld == 1) {
6182                        return Math.round((o.pld.filter(Boolean).length - 1) / Math.round(o.media.duration()) * 100)
6183                    }
6184                }
6185            }
6186            if (x == "speeds") {
6187                return o.files_speed
6188            }
6189            if (x == "unmute") {
6190                o.actions.Unmute()
6191            }
6192            if (x == "thumbnails") {
6193                if (exist(y)) {
6194                    v[x] = y;
6195                    o.actions.Thumbs()
6196                }
6197            }
6198            if (x == "qualities") {
6199                return o.files_quality
6200            }
6201            if (x == "adblock") {
6202                return o.ab ? true : false
6203            }
6204            if (x == "live") {
6205                return o.media ? o.media.isLive() : false
6206            }
6207            if (x == "subtitles") {
6208                return v.sub_off == 1 ? o.files_subtitle.slice(0, -1) : o.files_subtitle
6209            }
6210            if (x == "togglesubs") {
6211                o.subtitle_on ? o.sbt.off() : o.sbt.SetSubtitle(existv(o.last_subtitle, (o.sbt.ioff() == 0 ? 1 : 0)))
6212            }
6213            if (x == "native") {
6214                return o.nativecontrols
6215            }
6216            if (x.indexOf("subtitle:") == 0 && y) {
6217                v[x.replace('title:', '_')] = y;
6218                o.actions.RenewSubtitle()
6219            }
6220            if (x == "plduration") {
6221                return o.pldur
6222            }
6223            if (x == "audiotracks") {
6224                return o.files_audiotrack
6225            }
6226            if (x == "volume" || x == "setVolume") {
6227                if (exist(y)) {
6228                    if (typeof y == "string") {
6229                        if (y.indexOf("+") == 0) {
6230                            y = v.volume + parseFloat(y.substr(1))
6231                        } else {
6232                            if (y.indexOf("-") == 0) {
6233                                y = v.volume - parseFloat(y.substr(1))
6234                            }
6235                        }
6236                    }
6237                    if (y >= 0 && y <= 1) {
6238                        o.actions.Volume(y)
6239                    }
6240                }
6241                return o.muted ? 0 : v.volume
6242            }
6243            if (x == "muted") {
6244                return exist(o.muted) ? o.muted : false
6245            }
6246            if (x == "moveplaylist") {
6247                o.controls ? o.controls.PlaylistMove(y) : ''
6248            }
6249            if (x == "design") {
6250                y < 2 ? y = '' : '';
6251                if (exist2(o['u' + y])) {
6252                    var x2 = JSON.parse(decode(o['u' + y]));
6253                    var v2 = o.v0 ? copyObject(o.v0) : {};
6254                    v = v2;
6255                    v = UpdateObject(v, x2);
6256                    v = UpdateObject(v, options);
6257                    v = UpdateObject(v, o.plopt);
6258                    var show_settings = false;
6259                    if (o.controls.SettingsVisible()) {
6260                        o.controls.Settings();
6261                        show_settings = true
6262                    }
6263                    var show_playlist = false;
6264                    if (o.controls.PlaylistVisible()) {
6265                        o.controls.Playlist();
6266                        show_playlist = true
6267                    }
6268                    o.controls.Remove();
6269                    o.controls = null;
6270                    o.controls = new Controls();
6271                    if (o.media.status() == "playing") {
6272                        o.controls.Play()
6273                    }
6274                    o.controls.Volume(v.volume);
6275                    if (exist(v.title)) {
6276                        Title(v.title)
6277                    }
6278                    if (show_settings) {
6279                        o.controls.Settings()
6280                    }
6281                    if (show_playlist) {
6282                        o.controls.Playlist()
6283                    }
6284                    if (o.fullscreen) {
6285                        o.controls.Fullscreen()
6286                    }
6287                    o.controls.Duration(o.media.time(), o.media.duration());
6288                    MainResize()
6289                }
6290            }
6291            if (x == "vars") {
6292                return v.vars
6293            }
6294            if (x == "resize") {
6295                o.controls.resize(true)
6296            }
6297            if (x == "mainresize") {
6298                o.controls.resizeSettings()
6299            }
6300            if (x == "resize2") {
6301                MainResize()
6302            }
6303            if (x == "error") {
6304                o.media.onError(x)
6305            }
6306            if (x == "seek") {
6307                if (exist(y)) {
6308                    if (typeof y == "string") {
6309                        if (y.indexOf("%") > -1) {
6310                            y = parseInt(y.substr(0, y.indexOf("%")));
6311                            y = o.media.duration() * y / 100
6312                        } else {
6313                            var omt = o.media.time();
6314                            if (o.continue && !o.start) {
6315                                if (!o.continue.seeked) {
6316                                    var f = o.continue.flag();
6317                                    if (f.t && f.d) {
6318                                        omt = f.t;
6319                                        o.continue.seeked = true
6320                                    }
6321                                }
6322                            }
6323                            if (y.indexOf("+") == 0) {
6324                                y = omt + parseFloat(y.substr(1))
6325                            } else {
6326                                if (y.indexOf("-") == 0) {
6327                                    y = omt - parseFloat(y.substr(1))
6328                                }
6329                            }
6330                        }
6331                    }
6332                    y = y * 1;
6333                    y < 0 ? y = 0 : '';
6334                    if (o.media.duration() > 0) {
6335                        y > o.media.duration() ? y = 0 : ''
6336                    }
6337                    if (!exist(o.vast) && !exist(o.vastloader) && o.media.duration() > 0) {
6338                        o.seekto = undefined;
6339                        o.actions.Seek(y, true);
6340                        o.actions.Playing()
6341                    } else {
6342                        o.seekto = y
6343                    }
6344                }
6345            }
6346            if (x == "seekstep") {
6347                console.log(y);
6348                y ? v.hotkey.seek = y : ''
6349            }
6350            if (x == "fullscreen") {
6351                !o.fullscreen ? o.actions.Fullscreen() : ''
6352            }
6353            if (x == "exitfullscreen") {
6354                o.fullscreen ? o.actions.Normalscreen() : ''
6355            }
6356            if (x == "isfullscreen") {
6357                return o.fullscreen
6358            }
6359            if (x == "size") {
6360                return o.screen_w + '/' + o.screen_h
6361            }
6362            if (x == "videosize") {
6363                return o.media ? o.media.size() : undefined
6364            }
6365            if (x == "fix") {
6366                if (exist(o.minify)) {
6367                    o.minify.Do()
6368                }
6369            }
6370            if (x == "unfixing" || x == "unfix") {
6371                if (exist(o.minify)) {
6372                    o.minify.Un()
6373                }
6374            }
6375            if (x == "time" || x == "time2") {
6376                var _t = o.media ? o.media.time() : 0;
6377                if (o.continue && v.timestore == 1 && !o.start && _t == 0) {
6378                    var f = o.continue.flag();
6379                    if (f.t) {
6380                        _t = f.t
6381                    }
6382                }
6383                return x == "time2" ? timeFormat(_t) : _t
6384            }
6385            if (x == "timeplay") {
6386                if (o.butplstart) {
6387                    apiProcessor("play", "id:" + o.butplstart)
6388                }
6389                if (o.butseekto) {
6390                    apiProcessor("seek", o.butseekto);
6391                    apiProcessor("play")
6392                }
6393            }
6394            if (x == "duration") {
6395                return o.media ? o.media.duration() : 0
6396            }
6397            if (x == "buffered") {
6398                return o.media ? o.media.loaded() : 0
6399            }
6400            if (x == "points") {
6401                if (y) {
6402                    v.points = y;
6403                    o.controls.RenewPoints()
6404                }
6405            }
6406            if (x == "quality") {
6407                if (exist(y)) {
6408                    if (but) {
6409                        v.hd = Switcher(v.hd, y, but);
6410                        if (o.files_quality.length == 2) {
6411                            o.actions.SetQuality(v.hd)
6412                        }
6413                    } else {
6414                        o.actions.SetQuality(y)
6415                    }
6416                } else {
6417                    return o.media ? NoSpan(o.media.getQuality()) : 0
6418                }
6419            }
6420            if (x == "audiotrack") {
6421                if (exist(y)) {
6422                    if (y == 'index') {
6423                        return o.current_audiotrack * 1
6424                    }
6425                    if (but) {
6426                        v.ahd = Switcher(v.ahd, y, but);
6427                        if (o.files_audiotrack.length == 2) {
6428                            o.actions.SetAudioTrack(v.ahd)
6429                        }
6430                    } else {
6431                        o.actions.SetAudioTrack(y)
6432                    }
6433                } else {
6434                    return o.media ? o.media.getAudioTrack() : 0
6435                }
6436            }
6437            if (x == "isyoutube") {
6438                return o.file_type == "youtube"
6439            }
6440            if (x == "restart") {
6441                if (o.current_audiotrack > 0) {
6442                    o.restart_audio = o.current_audiotrack
6443                }
6444                o.actions.NewFile(o.files[o.current_file])
6445            }
6446            if (x == "playing") {
6447                return o.play
6448            }
6449            if (x == "started") {
6450                return o.start
6451            }
6452            if (x == "system") {
6453                return o.system[y]
6454            }
6455            if (x == "youtubeready") {
6456                o.destroyed != 1 ? o.media.onYoutubeReady() : ''
6457            }
6458            if (x == "id") {
6459                return v.id
6460            }
6461            if (x == "log") {
6462                v.log = y
6463            }
6464            if (x == "eventstracker") {
6465                v.eventstracker = y
6466            }
6467            if (x == "pip") {
6468                o.media.PipToggle()
6469            }
6470            if (x == "switchpip") {
6471                o.media.PipSwitch();
6472                if (but) {
6473                    o.piped = Switcher(o.piped, y, but)
6474                }
6475            }
6476            if (x == "airplay") {
6477                o.media.Airplay()
6478            }
6479            if (x == "pipwebkit") {
6480                o.media.PipWebkit()
6481            }
6482            if (x == "options" && v.playerjscom != 1) {
6483                console.log(options)
6484            }
6485            if (x == "castinit" && o.chromecast) {
6486                o.chromecast.init()
6487            }
6488            if (x == "castend" && o.chromecast) {
6489                o.chromecast.remove()
6490            }
6491            if (x == "subtitle") {
6492                if (exist(y)) {
6493                    if (y == 'index') {
6494                        return o.current_subtitle * 1
6495                    }
6496                    if (y == '0/1') {
6497                        if (o.subtitle_on) {
6498                            o.submm = o.current_subtitle;
6499                            y = -1
6500                        } else {
6501                            y = o.submm ? o.submm : 0
6502                        }
6503                    }
6504                    v.subtitle = y;
6505                    if (y.toString().length < 3 && o.sbt) {
6506                        o.sbt.SetSubtitle(y * 1)
6507                    } else {
6508                        o.actions.Subtitle(y)
6509                    }
6510                } else {
6511                    return o.files_subtitle ? o.files_subtitle[o.current_subtitle] : ''
6512                }
6513            }
6514            if (x == "+subtitle" && v.subtitle) {
6515                if (exist(y)) {
6516                    v.subtitle += ',' + y;
6517                    o.actions.Subtitle(v.subtitle)
6518                }
6519            }
6520            if (x == "quiz") {
6521                if (exist(o.quiz)) {
6522                    if (exist(y)) {
6523                        o.quiz.api(y)
6524                    } else {
6525                        return o.quiz.Active()
6526                    }
6527                }
6528            }
6529            if (x == "geo") {
6530                if (o.geobj) {
6531                    return o.geobj
6532                } else {
6533                    return false
6534                }
6535            }
6536            if (x == "ratio") {
6537                return o.media.ratio()
6538            }
6539            if (x == "box") {
6540                if (o.subtox) {
6541                    o.subtox.parentNode ? o.subtox.parentNode.removeChild(o.subtox) : ''
6542                }
6543                o.subtox = createElement("div");
6544                o.subtox.id = y;
6545                o.subtox.style.zIndex = 10000;
6546                o.frame.appendChild(o.subtox)
6547            }
6548            if (x == "screenshot") {
6549                if (o.tagvideo) {
6550                    var canvas = createElement("canvas");
6551                    var size = o.media.size();
6552                    canvas.width = size.width > 0 ? size.width : o.normal_w;
6553                    canvas.height = size.height > 0 ? size.height : o.normal_h;
6554                    css(canvas, {
6555                        "position": "absolute",
6556                        "top": -canvas.height,
6557                        "left": -canvas.width,
6558                        "display": "none"
6559                    });
6560                    document.body.appendChild(canvas);
6561                    var ctx = canvas.getContext('2d');
6562                    ctx.drawImage(o.media.tag(), 0, 0, canvas.width, canvas.height);
6563                    var quality = 2;
6564                    var canvas2 = document.createElement("canvas");
6565                    canvas2.width = canvas.width * quality;
6566                    canvas2.height = canvas.height * quality;
6567                    var ctx2 = canvas2.getContext("2d");
6568                    ctx2.drawImage(o.media.tag(), 0, 0, canvas.width * quality, canvas.height * quality);
6569                    if (v.sscopyright == 1 && exist(v.sstext)) {
6570                        !exist(v.ssfontsize) ? v.ssfontsize = 20 : '';
6571                        !exist(v.ssfontcolor) ? v.ssfontcolor = "ffffff" : '';
6572                        ctx2.font = v.ssfontsize + "px Courier, Arial";
6573                        ctx2.fillStyle = CheckColor(v.ssfontcolor);
6574                        ctx2.fillText((v.sstext == "domain" ? o.domain : v.sstext), v.ssfontsize, canvas.height * quality - v.ssfontsize - 5)
6575                    }
6576                    ctx.drawImage(canvas2, 0, 0, canvas.width, canvas.height);
6577                    var img;
6578                    try {
6579                        img = canvas.toDataURL("image/jpeg")
6580                    } catch (e) {
6581                        console.log(e.message);
6582                        return false
6583                    }
6584                    return img
6585                } else {
6586                    return false
6587                }
6588            }
6589            if (x == "dash") {
6590                return o.file_type == x ? o.media.getDASH() : undefined
6591            }
6592            if (x == "hls") {
6593                return o.file_type == x ? o.media.getHLS() : undefined
6594            }
6595            if (x == "poster") {
6596                if (!o.play || v.posterhide === 0) {
6597                    o.media.Poster(y);
6598                    return true
6599                } else {
6600                    return false
6601                }
6602            }
6603            if (x == "stretch") {
6604                if (exist(y)) {
6605                    y == '1/0' ? y = 1 - existv(v.covervideo, 0) : '';
6606                    v.covervideo = y;
6607                    o.media.normalscale()
6608                } else {
6609                    return existv(v.covervideo, 0)
6610                }
6611            }
6612            if (x == "scale") {
6613                if (exist(y)) {
6614                    if (y == 0) {
6615                        o.media.normalscale()
6616                    } else {
6617                        o.media.scale(y)
6618                    }
6619                } else {
6620                    return [o.mediascale.x, o.mediascale.y, o.mediacontainer.style.left, o.mediacontainer.style.top]
6621                }
6622            }
6623            if (x == "title") {
6624                if (exist(y)) {
6625                    exist(y) ? v.title = y : '';
6626                    o.actions.Title('title');
6627                    return true
6628                } else {
6629                    return v.title
6630                }
6631            }
6632            if (x == "invert") {
6633                o.actions.InvertPlaylist()
6634            }
6635            if (x == "push") {
6636                if (y) {
6637                    !o.playlist_source ? o.playlist_source = [] : '';
6638                    if (typeof (y) == 'object') {
6639                        y = o.playlist_source.concat(y);
6640                        x = "playlist"
6641                    }
6642                }
6643            }
6644            if (x == "playlist") {
6645                if (y) {
6646                    if (typeof (y) == 'object') {
6647                        try {
6648                            o.actions.UpdatePlaylist(y);
6649                            return true
6650                        } catch (e) {
6651                            return false
6652                        }
6653                    } else {
6654                        if (y.indexOf(".txt") == y.length - 4 || y.indexOf(".txt?") > 0) {
6655                            var xhr = XHR(y);
6656                            xhr.onload = function () {
6657                                if (this.readyState == 4 && this.status == 200) {
6658                                    try {
6659                                        apiProcessor('playlist', JSON.parse(this.responseText))
6660                                    } catch (e) {}
6661                                }
6662                            };
6663                            xhr.send();
6664                            return true
6665                        } else {
6666                            if (y == '') {
6667                                o.actions.UpdatePlaylist([])
6668                            } else {
6669                                if (y == 'played' && o.pldur > 0) {
6670                                    var tmp = Math.round(((o.pldur2 + (!o.controls.PlaylistG("played") ? o.media.time() : 0)) / o.pldur) * 100);
6671                                    if (tmp < o.pldur3 || tmp > 100) {
6672                                        return o.pldur3
6673                                    } else {
6674                                        o.pldur3 = tmp;
6675                                        return tmp
6676                                    }
6677                                }
6678                            }
6679                        }
6680                    }
6681                }
6682            }
6683            if (x == "next") {
6684                o.controls ? o.controls.PlaylistNext() : ''
6685            }
6686            if (x == "prev") {
6687                o.controls ? o.controls.PlaylistPrev() : ''
6688            }
6689            if (x == "cut") {
6690                o.controls ? o.controls.Cut(y) : ''
6691            }
6692            if (x == "cut?") {
6693                return o.cutted ? [o.cut1, o.cut2] : 0
6694            }
6695            if (x == "flip") {
6696                o.media ? o.media.flip() : ''
6697            }
6698            if (x == "find") {
6699                if (exist(y) && exist(o.playlist_dic)) {
6700                    !o.play ? v.autoplay = 0 : '';
6701                    for (var j in o.playlist_dic) {
6702                        if (o.playlist_dic.hasOwnProperty(j)) {
6703                            if (o.playlist_dic[j].pjs_id == y) {
6704                                y = j
6705                            }
6706                        }
6707                    }
6708                    if (exist(o.playlist_dic[y])) {
6709                        o.controls.PlaylistOpenId(y);
6710                        return true
6711                    } else {
6712                        return false
6713                    }
6714                }
6715            }
6716            if (x == "playlist_folders") {
6717                var tmp = [];
6718                if (exist(o.playlist_dic)) {
6719                    for (var j in o.playlist_dic) {
6720                        if (o.playlist_dic[j].folder && o.playlist_dic[j].pjs_parent_i == -1) {
6721                            tmp.push({
6722                                title: o.playlist_dic[j].title,
6723                                id: o.playlist_dic[j].id
6724                            })
6725                        }
6726                    }
6727                }
6728                return tmp
6729            }
6730            if (x == "playlist_id") {
6731                if (o.plid) {
6732                    return o.playlist_dic[o.plid].pjs_id ? o.playlist_dic[o.plid].pjs_id : o.plid
6733                }
6734            }
6735            if (x == "playlist_length") {
6736                if (o.playlist_dic) {
6737                    return Object.keys(o.playlist_dic).length
6738                } else {
6739                    return -1
6740                }
6741            }
6742            if (x == "playlist_title") {
6743                if (exist(o.playlist_title)) {
6744                    return o.playlist_title
6745                }
6746            }
6747            if (x == "showplaylist") {
6748                o.controls.PlaylistShow(y)
6749            }
6750            if (x == "showvlt") {
6751                o.media.VstLdTxt()
6752            }
6753            if (x == "toolbar") {
6754                if (y == "on") {
6755                    v.toolbar.hide = 0
6756                } else if (y == "off") {
6757                    v.toolbar.hide = 1;
6758                    o.controls.HideForce()
6759                } else {
6760                    o.controls.ShowForce()
6761                }
6762            }
6763            if (x == "menu") {
6764                o.controls.Settings()
6765            }
6766            if (x == "menu1" || x == "menu2" || x == "menu3") {
6767                if (exist(y)) {
6768                    o['current_custom' + x.slice(-1)] = v[x] = y * 1;
6769                    o.controls.SettingChanged('custom' + x.slice(-1))
6770                } else {
6771                    return v[x]
6772                }
6773            }
6774            if (x == "focus") {
6775                o[x] = true
6776            }
6777            if (x == "vastnow") {
6778                if (o.vast) {
6779                    return true
6780                } else {
6781                    return false
6782                }
6783            }
6784            if (x == "vastinfo") {
6785                if (o.vast) {
6786                    return VastInfo()
6787                } else {
6788                    return false
6789                }
6790            }
6791            if (x == "vastpause") {
6792                if (o.vast) {
6793                    return o.vast.pause()
6794                } else {
6795                    return false
6796                }
6797            }
6798            if (x == "vastresume") {
6799                if (o.vast) {
6800                    return o.vast.resume()
6801                } else {
6802                    return false
6803                }
6804            }
6805            if (x == "vaststart") {
6806                if (o.vast) {
6807                    o.vast.startAd()
6808                } else {
6809                    return false
6810                }
6811            }
6812            if (x == "vastmute") {
6813                if (o.vast) {
6814                    o.vast.mute()
6815                } else {
6816                    return false
6817                }
6818            }
6819            if (x == "captions") {
6820                if (but) {
6821                    v.captions = Switcher(v.captions, y, but);
6822                    o.media.captions()
6823                } else {
6824                    return v.captions
6825                }
6826            }
6827            if (x == "loop") {
6828                if (exist(but)) {
6829                    v.loop = Switcher(v.loop, y, but)
6830                } else {
6831                    if (exist(y)) {
6832                        y == '0/1' ? y = 1 - v.loop : '';
6833                        v.loop = y
6834                    } else {
6835                        return v.loop
6836                    }
6837                }
6838            }
6839            if (x == "shuffle") {
6840                if (exist(but)) {
6841                    v.shuffle = Switcher(v.shuffle, y, but)
6842                } else {
6843                    if (exist(y)) {
6844                        v.shuffle = y
6845                    } else {
6846                        return v.shuffle
6847                    }
6848                }
6849            }
6850            if (x == "autonext" || x == "playlistloop") {
6851                var z = "autoplaylist";
6852                x == "playlistloop" ? z = "playlistrewind" : "";
6853                if (exist(but)) {
6854                    v.playlist[z] = Switcher(v.playlist[z], y, but)
6855                } else {
6856                    if (exist(y)) {
6857                        y == '0/1' ? y = 1 - v.playlist[z] : '';
6858                        v.playlist[z] = y
6859                    }
6860                }
6861                return v.playlist[z]
6862            }
6863            if (x == "hd") {
6864                if (o.files_quality.length == 2) {
6865                    v.hd = o.files_quality[o.current_quality];
6866                    v.hd = Switcher(v.hd, y, but);
6867                    if (o.files_quality[0] == v.hd) {
6868                        o.actions.SetQuality(0)
6869                    } else {
6870                        o.actions.SetQuality(1)
6871                    }
6872                }
6873            }
6874            if (x == "v" && y) {
6875                if (y.indexOf('file') == 0 || y.indexOf('bk') == 0) {
6876                    return
6877                }
6878                return v[y]
6879            }
6880            if (x.indexOf("update:") == 0) {
6881                var xx = x.substr(7);
6882                if (typeof (y) == 'object' && typeof (v[xx]) == 'object') {
6883                    for (var yy in y) {
6884                        if (y.hasOwnProperty(yy)) {
6885                            v[xx][yy] = y[yy]
6886                        }
6887                    }
6888                } else {
6889                    if (x.indexOf('rc_') == -1) {
6890                        v[xx] = y
6891                    }
6892                }
6893                return true
6894            }
6895            if (x.indexOf("text:") == 0) {
6896                o.controls.customText(x.substr(5), y)
6897            }
6898            if (v.clrs == 1 && x.indexOf("color") == 0 && y) {
6899                pushCSS('pjsdiv, pjsdiv > *{--pjs' + x + ':' + CheckColor(y) + '}')
6900            }
6901            if (x == "currentfile") {
6902                return o.media ? o.media.currentFile() : ''
6903            }
6904            if (x == "vrsn") {
6905                return o.version + ' ' + o.playerid
6906            }
6907            if (x == "playerid") {
6908                return o.playerid
6909            }
6910            if (x == "hlserror") {
6911                return o.hlserror
6912            }
6913            if (x == "dasherror") {
6914                return o.dasherror
6915            }
6916            if (x == "v
6916isibility") {
6917                return o.visibility
6918            }
6919            if (x == "vastids") {
6920                return o.vast ? o.vast_adid : undefined
6921            }
6922            if (x == "destroy") {
6923                o.actions.StopMedia();
6924                v.hotkey.on = 0;
6925                if (v.stopotherplayers == 1) {
6926                    for (var i = 0; i < pljssglobal.length; i++) {
6927                        if (pljssglobal[i]) {
6928                            if (pljssglobal[i].api("id") == v.id) {
6929                                pljssglobal[i] = null
6930                            }
6931                        }
6932                    }
6933                }
6934                for (var w in window) {
6935                    if (window[w] == o.this) {
6936                        window[w] = null
6937                    }
6938                }
6939                if (window.pljssglobalid == v.id) {
6940                    window.pljssglobalid = ''
6941                }
6942                if (o.chromecast) {
6943                    o.chromecast.remove()
6944                }
6945                o.destroyed = 1;
6946                o.container.innerHTML = '';
6947                o.this = null
6948            }
6949        } else {
6950            return false
6951        }
6952    };
6953
6954    function api_(x, y) {
6955        if (x && y) {
6956            apiProcessor(y, x)
6957        }
6958    }
6959
6960    function Switcher(x, y, but) {
6961        var z = trim(y) + '';
6962        if (y) {
6963            if (y.indexOf("/") > 0) {
6964                var y2 = y.split("/");
6965                if (y2.length == 2) {
6966                    if (x == trim(y2[0])) {
6967                        z = trim(y2[1]);
6968                        if (but) {
6969                            but.CustomSwitch(1)
6970                        }
6971                    } else {
6972                        z = trim(y2[0]);
6973                        if (but) {
6974                            but.CustomSwitch(0)
6975                        }
6976                    }
6977                }
6978            }
6979        }
6980        return z
6981    }
6982
6983    function XHR(x) {
6984        var xhr = new XMLHttpRequest();
6985        xhr.open('GET', x, true);
6986        return xhr
6987    }
6988
6989    function FindIdPl(y) {
6990        var z = y.substr(3);
6991        if (o.playlist_dic) {
6992            for (var j in o.playlist_dic) {
6993                if (o.playlist_dic.hasOwnProperty(j)) {
6994                    if (o.playlist_dic[j].pjs_id == z) {
6995                        z = j
6996                    }
6997                }
6998            }
6999        }
7000        return z
7001    }
7002
7003    function VastInfo() {
7004        var x;
7005        if (o.vast) {
7006            if (o.vast.active()) {
7007                x = o.vast
7008            }
7009        }
7010        if (!x && o.vastloader) {
7011            x = o.vastloader
7012        }
7013        if (x) {
7014            var y = {
7015                is: o.vasttype,
7016                system: x.info("adsystem"),
7017                version: x.info("version"),
7018                vpaid: x.info("isVpaid"),
7019                url: o.current_vast_url + (x.info("wrapper") ? x.info("wrapper0") + x.info("wrapper") : ''),
7020                type: x.info("filetype"),
7021                duration: x.info("dur"),
7022                file: x.info("file"),
7023                time: (o.media ? o.media.time() : ''),
7024                volume: x.getVolume(),
7025                id: o.vast_adid
7026            };
7027            if (o.vasttype == "midroll") {
7028                y.midroll_time = o.midrollcrtm
7029            }
7030            return y
7031        }
7032    }
7033
7034    function MediaSess() {
7035        if ('mediaSession' in navigator) {
7036            navigator.mediaSession.metadata = new MediaMetadata({
7037                title: notag(existv(o.titlestore, v.title)),
7038                artwork: [{
7039                    src: existv(v.poster, '')
7040                }]
7041            });
7042            if (!o.mss) {
7043                navigator.mediaSession.setActionHandler('play', function () {
7044                    apiProcessor("play")
7045                });
7046                navigator.mediaSession.setActionHandler('pause', function () {
7047                    apiProcessor("pause")
7048                });
7049                if (o.controls.PlaylistExist()) {
7050                    navigator.mediaSession.setActionHandler('previoustrack', function () {
7051                        apiProcessor("prev")
7052                    });
7053                    navigator.mediaSession.setActionHandler('nexttrack', function () {
7054                        apiProcessor("next")
7055                    })
7056                }
7057                o.mss = true
7058            }
7059        }
7060    }
7061    var createElement = function (x) {
7062        var y = x;
7063        x == 'div' || x == 'div2' ? y = 'pjsdiv' : '';
7064        var z = document.createElement(y);
7065        if (x == 'div2') {
7066            css(z, {
7067                "cursor": "pointer",
7068                "display": "block"
7069            })
7070        }
7071        return z
7072    };
7073    var log = function (a, b, c, d, e, f, g) {
7074        if (v.log == 1 || v.logout == 1) {
7075            var x = a + (b != undefined ? " " + b : "") + (c != undefined ? " " + c : "") + (d != undefined ? " " + d : "") + (e != undefined ? " " + e : "") + (f != undefined ? " " + f : "") + (g != undefined ? " " + g : "");
7076            console.log("Playerjs" + (v.pjsframed == 1 ? "2" : "") + ": " + x);
7077            if (v.logout == 1 && exist(document.getElementById("pjslog"))) {
7078                document.getElementById("pjslog").innerHTML += x + '<br/>'
7079            }
7080        }
7081    };
7082    var CustomFonts = function () {
7083        if (v.fonts == 1 && exist(v.fontnames) && v.fontnames != '') {
7084            var x = document.createElement('link');
7085            x.rel = 'stylesheet';
7086            v.fontnames.indexOf(':') > 0 && v.fontnames.indexOf(':wght') == -1 ? v.fontnames = v.fontnames.replace(/:/ig, ':wght@') : '';
7087            x.href = 'https://fonts.googleapis.com/css2?family=' + v.fontnames.replace(/,/ig, "&family=").replace(/ /ig, "+");
7088            document.head.appendChild(x) + '&display=swap'
7089        }
7090    };
7091    var SvgColor = function (div, clr) {
7092        var x = ["path", "polygon", "polyline", "rect", "ellipse", "circle"];
7093        for (var y = 0; y < x.length; y++) {
7094            var z = div.querySelectorAll("svg " + x[y]);
7095            if (z.length > 0) {
7096                for (var y2 = 0; y2 < z.length; y2++) {
7097                    z[y2].style.fill = clr
7098                }
7099            }
7100        }
7101    };
7102    var JsClk = function () {
7103        if (v.apiprm) {
7104            if (v.apiprm.clk == 1) {
7105                js("click")
7106            }
7107        }
7108    };
7109    var Time = function (time) {
7110        time < 0 ? time = 0 : '';
7111        var full_minutes = o.media.duration >= 600 ? true : false;
7112        var full_hours = o.media.duration >= 3600 ? true : false;
7113        var minutes = Math.floor(time / 60);
7114        var seconds = Math.floor(time - minutes * 60);
7115        var hours = Math.floor(minutes / 60);
7116        var days = Math.floor(hours / 24);
7117        minutes = minutes - hours * 60;
7118        if (days > 0) {
7119            hours = hours - days * 24
7120        }
7121        if (v.dvrtime == 1 && o.media.isLive()) {
7122            var d = new Date();
7123            return String(new Date(d.getTime() + time * 1000).toLocaleTimeString())
7124        } else {
7125            return String((days > 0 ? days + ':' : '') + (hours > 0 || full_hours ? hours + ':' : '') + ((hours > 0 || full_minutes) && minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds)
7126        }
7127    };
7128    var timeFormat = function (x) {
7129        var seconds = Math.floor(x);
7130        var minutes = Math.floor(seconds / 60);
7131        var hours = Math.floor(minutes / 60);
7132        minutes = Math.floor(minutes % 60);
7133        seconds = Math.floor(seconds % 60);
7134        hours > 0 && minutes < 10 ? minutes = "0" + minutes : "";
7135        seconds = seconds >= 0 ? ((seconds >= 10) ? seconds : "0" + seconds) : "00";
7136        var out = (hours > 0 ? hours + ":" : "") + (minutes >= 0 ? minutes : "0") + ":" + seconds;
7137        if (v.dvrtime == 1 && o.media.isLive()) {
7138            var d = new Date();
7139            return String(new Date(d.getTime() + x * 1000).toLocaleTimeString())
7140        } else {
7141            return out
7142        }
7143    };
7144    var Href = function () {
7145        return encodeURIComponent((window.location != window.parent.location) ? document.referrer : document.location.href)
7146    };
7147    var NoSpan = function (x) {
7148        if (x) {
7149            x = x.toString();
7150            var spn = x.indexOf(" <span style='opacity");
7151            if (spn > -1) {
7152                x = x.substr(0, spn)
7153            }
7154        }
7155        return x
7156    };
7157    var Script = function (x, y, z) {
7158        var t;
7159        if (!Scripted(x) && y) {
7160            t = document.createElement('script');
7161            y == "same" ? y = x : '';
7162            t.src = y.indexOf('//') == -1 ? 'https://' + y : y;
7163            t.async = 1;
7164            if (z) {
7165                t.name = z
7166            }
7167            var s = document.getElementsByTagName('script')[0];
7168            s.parentNode.insertBefore(t, s)
7169        }
7170        return t
7171    };
7172    var notag = function (x) {
7173        if (x) {
7174            if (typeof (x) == 'string') {
7175                x = x.replace(/<[^>]*>?/gm, '')
7176            }
7177        }
7178        return x
7179    };
7180    var Scripted = function (y) {
7181        var x = false;
7182        var scripts = document.getElementsByTagName('script');
7183        for (var i = 0; i < scripts.length; i++) {
7184            if (scripts[i].src.indexOf(y) > -1) {
7185                x = true
7186            }
7187        }
7188        return x
7189    };
7190    var hex2rgb = function (x, y) {
7191        if (x) {
7192            if (x.indexOf('color') > -1 || x.indexOf('var') > -1) {
7193                return CheckColor(x)
7194            } else {
7195                x = x.replace('#', '');
7196                var r = parseInt(x.length == 3 ? x.slice(0, 1).repeat(2) : x.slice(0, 2), 16);
7197                var g = parseInt(x.length == 3 ? x.slice(1, 2).repeat(2) : x.slice(2, 4), 16);
7198                var b = parseInt(x.length == 3 ? x.slice(2, 3).repeat(2) : x.slice(4, 6), 16);
7199                if (exist(y)) {
7200                    return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + y + ')'
7201                } else {
7202                    return 'rgb(' + r + ', ' + g + ', ' + b + ')'
7203                }
7204            }
7205        }
7206    };
7207    var css = function (e, o) {
7208        if (exist(e)) {
7209            for (var key in o) {
7210                if (o.hasOwnProperty(key)) {
7211                    if (o[key] != 'NaNpx' && o[key] != undefined) {
7212                        if (typeof o[key] == 'number' && key != 'font-weight' && key != 'opacity' && key != 'zIndex') {
7213                            o[key] += 'px'
7214                        }
7215                        if (key.indexOf("olor") > -1 && key.indexOf("scheme") == -1) {
7216                            o[key] = CheckColor(o[key])
7217                        }
7218                        if (key == "transform" || key.indexOf("backdrop") > -1) {
7219                            e.style['-ms-' + key] = o[key];
7220                            e.style['-moz-' + key] = o[key];
7221                            e.style['-webkit-' + key] = o[key];
7222                            e.style['-o-' + key] = o[key]
7223                        }
7224                        if (key == "fontFamily") {
7225                            if (o[key].indexOf(" ") > -1) {
7226                                o[key] = '"' + o[key] + '"'
7227                            }
7228                        }
7229                        if (key == "box-sizing") {
7230                            e.style.setProperty(key, o[key], 'important')
7231                        } else {
7232                            e.style[key] = o[key]
7233                        }
7234                    }
7235                }
7236            }
7237        }
7238    };
7239    var Bglines = function (x, clr, b1, b2) {
7240        clr = CheckColor(clr);
7241        var y = existv(b1, 1) * 1;
7242        var z = existv(b2, 1) * 1;
7243        css(x, {
7244            "background": "repeating-linear-gradient(-45deg," + clr + "," + clr + " " + y + "px,rgba(0,0,0,0)," + y + "px,rgba(0,0,0,0) " + (y + z) + "px)"
7245        })
7246    };
7247    var CheckColor = function (c) {
7248        if (c) {
7249            c.indexOf("color") == 0 ? c = 'var(--pjs' + c + ')' : '';
7250            return c.substr(0, 1) != '#' && c.indexOf("var") == -1 && c.indexOf("rgb") == -1 ? c = "#" + c : c
7251        } else {
7252            return '#fff'
7253        }
7254    };
7255    var controlCSS = function (x, color, y) {
7256        !color ? color = '#fff' : '';
7257        color = CheckColor(color);
7258        var r = random(100000, 1000000);
7259        x = x.replace(/\(rand\)/g, r);
7260        x = x.replace(/\(color\)/g, color);
7261        x = x.replace(/\(scl\)/g, 1 + (v.control_buffer.scale - 1) / 2);
7262        var _html = x.substr(0, x.indexOf('|||'));
7263        var _css = x.substr(x.indexOf('|||') + 3);
7264        var _css2 = '';
7265        if (o.system.webkit) {
7266            _css2 = _css.replace(/animation:/g, "-webkit-animation:");
7267            _css2 = _css2.replace(/animation-/g, "-webkit-animation-");
7268            _css2 = _css2.replace(/@keyframes/g, "@-webkit-keyframes");
7269            _css2 = _css2.replace(/transform/g, "-webkit-transform")
7270        }
7271        y ? y.innerHTML = _html : '';
7272        pushCSS(_css2 + _css)
7273    };
7274    var indOf = function (x, y, f) {
7275        var z = false;
7276        if (x) {
7277            for (var i = 0; i < x.length; i++) {
7278                if (x[i]) {
7279                    if (f) {
7280                        if (parseFloat(y) == parseFloat(x[i])) {
7281                            z = i;
7282                            break
7283                        }
7284                    } else {
7285                        if (String(x[i]).indexOf(y) > -1) {
7286                            z = true
7287                        }
7288                    }
7289                }
7290            }
7291        }
7292        return z
7293    };
7294    var indOf2 = function (x, y) {
7295        var z = false;
7296        if (x && y) {
7297            for (var i = 0; i < y.length; i++) {
7298                if (String(x).indexOf(y[i]) > -1) {
7299                    z = true
7300                }
7301            }
7302        }
7303        return z
7304    };
7305    var pushCSS = function (x) {
7306        if (o.css) {
7307            if (o.css.styleSheet) {
7308                o.css.styleSheet.cssText = x
7309            } else {
7310                o.css.appendChild(document.createTextNode(x))
7311            }
7312        }
7313    };
7314    var Pos0 = function (x) {
7315        css(x, {
7316            "position": "absolute",
7317            "top": 0,
7318            "left": 0,
7319            "width": "100%",
7320            "height": "100%"
7321        })
7322    };
7323    var Pnt0 = function (x) {
7324        css(x, {
7325            "pointerEvents": "none"
7326        })
7327    };
7328    var xhr = function (y, z) {
7329        var x = new XMLHttpRequest();
7330        x.open('GET', y, true);
7331        x.onload = z;
7332        x.send()
7333    };
7334    var FindPjsDiv = function (x) {
7335        if (x) {
7336            for (var i = 0; i < 5; i++) {
7337                if (x.nodeName == "PJSDIV") {
7338                    break
7339                } else {
7340                    if (x.parentElement) {
7341                        x = x.parentElement
7342                    }
7343                }
7344            }
7345        }
7346        return x
7347    };
7348    var gif = function (z) {
7349        var gif = document.createElement("img");
7350        if (o.gifed.indexOf(z) > -1) {
7351            o.gifed.push(z);
7352            if (z.indexOf("?") > 0) {
7353                z = z + '&' + Math.random()
7354            } else {
7355                z = z + '?' + Math.random()
7356            }
7357        } else {
7358            o.gifed.push(z)
7359        }
7360        gif.setAttribute('src', z);
7361        gif.setAttribute('height', '1px');
7362        gif.setAttribute('width', '1px')
7363    };
7364    var attr = function (e, o) {
7365        for (var key in o) {
7366            if (o.hasOwnProperty(key)) {
7367                e.setAttribute(key, o[key])
7368            }
7369        }
7370    };
7371    var destroy = function (e) {
7372        if (e) {
7373            try {
7374                e.parentNode.removeChild(e);
7375                e = null
7376            } catch (e) {}
7377        }
7378    };
7379    var random = function (min, max) {
7380        return Math.floor(arguments.length > 1 ? (max - min + 1) * Math.random() + min : (min + 1) * Math.random())
7381    };
7382    var randomstr = function () {
7383        return Math.random().toString(36).substring(2, 12)
7384    };
7385    var removebykey = function (x, y) {
7386        x = Object.keys(x).reduce(function (obj, key) {
7387            if (key != y) {
7388                obj[key] = x[key]
7389            }
7390            return obj
7391        }, {});
7392        return x
7393    };
7394    var trim = function (x) {
7395        if (typeof x == "string") {
7396            return x.replace(/^\s+|\s+$/gm, '')
7397        } else {
7398            return x
7399        }
7400    };
7401    var cut = function (x, y, z) {
7402        var r = false;
7403        if (x) {
7404            if (x.indexOf(y) > -1) {
7405                var r = x.substr(x.indexOf(y) + y.length);
7406                if (z) {
7407                    if (r.indexOf(z) > -1) {
7408                        r = r.substr(0, r.indexOf(z))
7409                    }
7410                }
7411            }
7412        }
7413        return r
7414    };
7415    var encode = function (x, n) {
7416        if (n == 0) {
7417            return "#0" + salt.e(x)
7418        }
7419        if (n == -1) {
7420            return salt.e(x)
7421        }
7422        if (n == 1) {
7423            return "#1" + pepper(salt.e(x), 1)
7424        }
7425    };
7426    var str2obj = function (x) {
7427        if (v[x] != "") {
7428            if (typeof v[x] != "string") {
7429                o[x + 'o'] = v[x]
7430            } else {
7431                if (v[x].indexOf("[{") == 0) {
7432                    try {
7433                        v[x] = v[x].replace(/pjs'qt/ig, '"');
7434                        o[x + 'o'] = eval(v[x])
7435                    } catch (e) {}
7436                }
7437            }
7438        }
7439    };
7440    var dechar = function (x) {
7441        return String.fromCharCode(x)
7442    };
7443    var decode = function (x) {
7444        if (x.substr(0, 2) == "#1") {
7445            return salt.d(pepper(x.substr(2), -1))
7446        } else if (x.substr(0, 2) == "#0") {
7447            return salt.d(x.substr(2))
7448        } else {
7449            return x
7450        }
7451    };
7452    var checkBase64 = function (x) {
7453        if (x) {
7454            if (x.indexOf('http') == -1 && x.indexOf('.') == -1 && x.length > 100 && x.indexOf('data:') == -1) {
7455                x = 'data:image/png;base64,' + x
7456            }
7457        }
7458        return x
7459    };
7460    var hide = function (x) {
7461        x ? x.style.visibility = "hidden" : ''
7462    };
7463    var show = function (x) {
7464        x ? x.style.visibility = "visible" : ''
7465    };
7466    var hide2 = function (x) {
7467        x ? x.style.display = "none" : ''
7468    };
7469    var show2 = function (x) {
7470        x ? x.style.display = "block" : ''
7471    };
7472    var isVisible = function (x) {
7473        return x ? x.style.visibility != "hidden" && x.style.display != "none" : false
7474    };
7475    var int = function (s) {
7476        if (typeof s == "string") {
7477            if (s.indexOf("px") > 0) {
7478                s = s.substr(0, s.indexOf("px"))
7479            }
7480        }
7481        return parseInt(s)
7482    };
7483    var hidden = function (x) {
7484        return x.style.display == "none"
7485    };
7486    var MarginPadding = function (o, x, y) {
7487        o[x + 'top'] = 0;
7488        o[x + 'right'] = 0;
7489        o[x + 'bottom'] = 0;
7490        o[x + 'left'] = 0;
7491        if (exist(o[y])) {
7492            var z = o[y].split(" ");
7493            if (z.length == 4) {
7494                o[x + 'top'] = z[0] ? parseFloat(z[0]) : 0;
7495                o[x + 'right'] = z[1] ? parseFloat(z[1]) : 0;
7496                o[x + 'bottom'] = z[2] ? parseFloat(z[2]) : 0;
7497                o[x + 'left'] = z[3] ? parseFloat(z[3]) : 0
7498            }
7499        }
7500        return o
7501    };
7502    var MarPad = function (x) {
7503        if (x) {
7504            x = x.replace(/ /ig, 'px ')
7505        }
7506        return x + 'px'
7507    };
7508    var StringVar = function (x, y) {
7509        return v[x] && v[x] != '' ? v[x] : y
7510    };
7511    var abc = String.fromCharCode(65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122);
7512    var salt = {
7513        _keyStr: abc + "0123456789+/=",
7514        e: function (e) {
7515            var t = "";
7516            var n, r, i, s, o, u, a;
7517            var f = 0;
7518            e = salt._ue(e);
7519            while (f < e.length) {
7520                n = e.charCodeAt(f++);
7521                r = e.charCodeAt(f++);
7522                i = e.charCodeAt(f++);
7523                s = n >> 2;
7524                o = (n & 3) << 4 | r >> 4;
7525                u = (r & 15) << 2 | i >> 6;
7526                a = i & 63;
7527                if (isNaN(r)) {
7528                    u = a = 64
7529                } else if (isNaN(i)) {
7530                    a = 64
7531                }
7532                t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
7533            }
7534            return t
7535        },
7536        d: function (e) {
7537            var t = "";
7538            var n, r, i;
7539            var s, o, u, a;
7540            var f = 0;
7541            e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
7542            while (f < e.length) {
7543                s = this._keyStr.indexOf(e.charAt(f++));
7544                o = this._keyStr.indexOf(e.charAt(f++));
7545                u = this._keyStr.indexOf(e.charAt(f++));
7546                a = this._keyStr.indexOf(e.charAt(f++));
7547                n = s << 2 | o >> 4;
7548                r = (o & 15) << 4 | u >> 2;
7549                i = (u & 3) << 6 | a;
7550                t = t + dechar(n);
7551                if (u != 64) {
7552                    t = t + dechar(r)
7553                }
7554                if (a != 64) {
7555                    t = t + dechar(i)
7556                }
7557            }
7558            t = salt._ud(t);
7559            return t
7560        },
7561        _ue: function (e) {
7562            e = e.replace(/\r\n/g, "\n");
7563            var t = "";
7564            for (var n = 0; n < e.length; n++) {
7565                var r = e.charCodeAt(n);
7566                if (r < 128) {
7567                    t += dechar(r)
7568                } else if (r > 127 && r < 2048) {
7569                    t += dechar(r >> 6 | 192);
7570                    t += dechar(r & 63 | 128)
7571                } else {
7572                    t += dechar(r >> 12 | 224);
7573                    t += dechar(r >> 6 & 63 | 128);
7574                    t += dechar(r & 63 | 128)
7575                }
7576            }
7577            return t
7578        },
7579        _ud: function (e) {
7580            var t = "";
7581            var n = 0;
7582            var r = 0;
7583            var c1 = 0;
7584            var c2 = 0;
7585            var c3 = 0;
7586            while (n < e.length) {
7587                r = e.charCodeAt(n);
7588                if (r < 128) {
7589                    t += dechar(r);
7590                    n++
7591                } else if (r > 191 && r < 224) {
7592                    c2 = e.charCodeAt(n + 1);
7593                    t += dechar((r & 31) << 6 | c2 & 63);
7594                    n += 2
7595                } else {
7596                    c2 = e.charCodeAt(n + 1);
7597                    c3 = e.charCodeAt(n + 2);
7598                    t += dechar((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
7599                    n += 3
7600                }
7601            }
7602            return t
7603        }
7604    };
7605    var pepper = function (s, n) {
7606        s = s.replace(/\+/g, "#");
7607        s = s.replace(/#/g, "+");
7608        var a = sugar(o.y) * n;
7609        if (n < 0) a += abc.length / 2;
7610        var r = abc.substr(a * 2) + abc.substr(0, a * 2);
7611        return s.replace(/[A-Za-z]/g, function (c) {
7612            return r.charAt(abc.indexOf(c))
7613        })
7614    };
7615    var sugar = function (x) {
7616        x = x.split(dechar(61));
7617        var result = '';
7618        var c1 = dechar(120);
7619        var chr;
7620        for (var i in x) {
7621            if (x.hasOwnProperty(i)) {
7622                var encoded = '';
7623                for (var j in x[i]) {
7624                    if (x[i].hasOwnProperty(j)) {
7625                        encoded += (x[i][j] == c1) ? dechar(49) : dechar(48)
7626                    }
7627                }
7628                chr = parseInt(encoded, 2);
7629                result += dechar(chr.toString(10))
7630            }
7631        }
7632        return result.substr(0, result.length - 1)
7633    };
7634    var exist = function (x) {
7635        return x != null && typeof (x) != 'undefined' && x != 'undefined'
7636    };
7637    var existv = function (x, y) {
7638        return exist(x) ? x : y
7639    };
7640    var exist2 = function (x) {
7641        return exist(x) && x != -1 && x != ''
7642    };
7643    var exist2v = function (x, y) {
7644        return exist2(x) ? x : y
7645    };
7646    var copyObject = function (x) {
7647        if (typeof x == "object") {
7648            x = JSON.parse(JSON.stringify(x))
7649        }
7650        return x
7651    };
7652    var findLeft = function (el) {
7653        var x = el.getBoundingClientRect().left + (window.scrollX ? window.scrollX : window.pageXOffset);
7654        return x
7655    };
7656    var checkFont = function (x) {
7657        v.globalfont == 1 && exist2(v.globalfontname) ? x = v.globalfontname : '';
7658        return x
7659    };
7660    var findTop = function (el) {
7661        const rect = el.getBoundingClientRect();
7662        return rect.top + window.scrollY
7663    };
7664    var redirect = function (x, y) {
7665        if (x != '') {
7666            if (v.redirectblank == 1 || y == 'blnk') {
7667                window.open(x)
7668            } else {
7669                if (v.redirectparent == 1 || y == 'top') {
7670                    window.parent.location.href = x
7671                } else {
7672                    window.location.href = x
7673                }
7674            }
7675            x = ''
7676        }
7677    };
7678    var reRightMenu = function () {
7679        if (v.rightmenu == 1) {
7680            o.rightmenu ? o.frame.removeChild(o.rightmenu) : '';
7681            o.rightmenu = null
7682        }
7683    };
7684    var Actions = function () {
7685        var _fullscreen_end = false;
7686        o.system.tv ? log("tv") : '';
7687        o.system.mobile ? log("mobile") : '';
7688        this.Title = function (x) {
7689            o.controls ? o.controls.title(x) : ''
7690        };
7691        this.File = function (x) {
7692            if (x) {
7693                if (typeof (x) == 'string') {
7694                    x = fjs(x)
7695                }
7696                if (typeof (x) == 'string') {
7697                    x = x.replace(/(\r\n|\n|\r)/gm, "");
7698                    if (x.indexOf("[{") == 0) {
7699                        try {
7700                            x = x.replace(/pjs'qt/ig, '"');
7701                            x = JSON.parse(x)
7702                        } catch (e) {
7703                            x = "incorrect JSON"
7704                        }
7705                    }
7706                }
7707                if (typeof (x) == 'object') {
7708                    o.playlist_dic = [];
7709                    o.playlist_source = copyObject(x);
7710                    o.playlist = IndexPlaylist(x);
7711                    if (o.playlist.length > 0) {
7712                        if (v.playlist.openlast == 1 && !v.plstart) {
7713                            var keys = Object.keys(o.playlist_dic);
7714                            var last = keys.slice(-1)[0];
7715                            last ? v.plstart = last : ''
7716                        }
7717                        var y = FindFileInPlaylist();
7718                        if (y) {
7719                            x = y.file;
7720                            o.titlestore = y.title;
7721                            o.controls ? o.controls.titlepl(y.title) : '';
7722                            if (exist2(y.poster)) {
7723                                if (o.media) {
7724                                    o.media.Poster(y.poster)
7725                                } else {
7726                                    v.poster = y.poster
7727                                }
7728                            }
7729                            if (exist(y.sub)) {
7730                                y.subtitle = y.sub
7731                            }
7732                            if (exist(y.start)) {
7733                                if (y.start == "continue" && !o.start) {} else {
7734                                    v.start = o.seekto = y.start
7735                                }
7736                            }
7737                            SettingsTimers("offset");
7738                            if (exist(y.id)) {
7739                                o.plid = y.id
7740                            }
7741                            var sx = ["subtitle", "vars", "embed", "url", "url2", "url3", "heartbeat", "thumbnails", "casturl", "label", "download", "points", "remove", "end", "delete", "outside", "title2", "skip", "customtext", "volume"];
7742                            if (exist(v.control_title)) {
7743                                if (v.control_title.showfrom1file == 1 && v.control_title.showtitleplaylist == 1) {
7744                                    sx.push("title");
7745                                    sx.push("t1");
7746                                    sx.push("t2");
7747                                    sx.push("t3");
7748                                    sx.push("t4");
7749                                    sx.push("t5")
7750                                }
7751                            }
7752                            for (var i = 0; i < sx.length; i++) {
7753                                if (exist(y[sx[i]])) {
7754                                    v[sx[i]] = y[sx[i]];
7755                                    o.plopt[sx[i]] = y[sx[i]]
7756                                }
7757                            }
7758                            Ctxt(y);
7759                            if (sx.indexOf('title') > 0) {
7760                                if (v.control_title.templated == 1) {
7761                                    o.title_template = v.control_title.template;
7762                                    o.actions.TitleTemplate(y)
7763                                }
7764                                o.actions.Title('title')
7765                            }
7766                            if (exist(y.volume)) {
7767                                setTimeout(function () {
7768                                    o.actions.Volume(y.volume)
7769                                }, 200)
7770                            }
7771                            if (o.controls) {
7772                                o.controls.UpdatePlaylist(o.playlist);
7773                                if (v.customtext) {
7774                                    o.controls.customTextPl()
7775                                }
7776                            }
7777                            if (o.droplist) {
7778                                o.droplist.Update()
7779                            }
7780                        } else {}
7781                    }
7782                }
7783                if (typeof (x) == 'string') {
7784                    x = fjs(x);
7785                    if (x) {
7786                        if (x.indexOf("#" + v.enc2) == 0) {
7787                            x = o[o.fd[0]](x)
7788                        }
7789                        if (x) {
7790                            if (x.indexOf("#" + v.enc3) == 0 && x.indexOf(v.file3_separator) > 0) {
7791                                x = o[o.fd[1]](x)
7792                            }
7793                            if (x) {
7794                                if (x.indexOf("#0") == 0) {
7795                                    x = fd0(x)
7796                                }
7797                                x = fjs(x)
7798                            } else {
7799                                x = ''
7800                            }
7801                        }
7802                    }
7803                    if (v.fplace == 1) {
7804                        x = fplace(x)
7805                    }
7806                    if (x == '') {
7807                        log("empty file");
7808                        o.media_error = true;
7809                        js("error", "empty")
7810                    }
7811                    o.files_quality = [];
7812                    o.files_quality_ag = [];
7813                    o.files_audiotrack = [];
7814                    o.current_file = 0;
7815                    o.current_quality = 0;
7816                    o.current_audiotrack = 0;
7817                    o.ncrtat = 0;
7818                    v.file_separator == '' ? v.file_separator = ',' : '';
7819                    if ((x.indexOf(v.qbr1) > -1 && x.indexOf(v.qbr2) > -1) || exist(v.qualities)) {
7820                        o.files = x.split(v.file_separator)
7821                    } else {
7822                        o.files = [x]
7823                    }
7824                    o.audiotracks = [];
7825                    if (exist(v.qualities)) {
7826                        var qualities = v.qualities.split(v.file_separator)
7827                    }
7828                    if (o.files.length > 0) {
7829                        var q = -1;
7830                        for (var i = 0; i < o.files.length; i++) {
7831                            o.files[i] = trim(o.files[i]);
7832                            if (o.files[i] != '') {
7833                                if (o.files[i].indexOf(v.qbr1) == 0 && o.files[i].indexOf(v.qbr2) > 1) {
7834                                    o.files_quality[i] = o.files[i].substr(o.files[i].indexOf(v.qbr1) + v.qbr1.length, o.files[i].indexOf(v.qbr2) - v.qbr2.length);
7835                                    o.files[i] = o.files[i].substr(o.files[i].indexOf(v.qbr2) + v.qbr2.length)
7836                                } else {
7837                                    if (exist(v.qualities)) {
7838                                        o.files_quality[i] = exist(qualities[i]) ? qualities[i] : ''
7839                                    } else {
7840                                        o.files_quality[i] = i + 1
7841                                    }
7842                                }
7843                                var is = 0;
7844                                if (exist(v.default_quality) && q == -1) {
7845                                    if (String(v.default_quality).indexOf("num:") == 0) {
7846                                        if (v.default_quality.substr(4) * 1 == i) {
7847                                            is = 1
7848                                        }
7849                                    }
7850                                    if (v.default_quality == o.files_quality[i]) {
7851                                        is = 1
7852                                    }
7853                                    if (v.default_quality == "max" && i == o.files.length - 1) {
7854                                        is = 1
7855                                    }
7856                                }
7857                                if (exist(o.default_quality)) {
7858                                    if (o.default_quality == o.files_quality[i]) {
7859                                        is = 1;
7860                                        q = i
7861                                    }
7862                                }
7863                                if (is == 1) {
7864                                    o.current_file = i;
7865                                    o.current_quality = i
7866                                }
7867                                o.files[i] = Prefile(o.files[i])
7868                            }
7869                        }
7870                    } else {
7871                        o.files[0] = Prefile(o.files[0])
7872                    }
7873                    return o.files[o.current_file]
7874                }
7875            } else {
7876                return x
7877            }
7878        };
7879
7880        function Prefile(x) {
7881            if (exist(v.prefile) && x.indexOf("//") == -1) {
7882                x = v.prefile + x
7883            }
7884            return x
7885        };
7886        this.InvertPlaylist = function () {
7887            if (o.playlist) {
7888                var x = o.playlist.reverse();
7889                for (var i = 0; i < x.length; i++) {
7890                    x[i].pjs_i = i
7891                }
7892                o.playlist = x;
7893                o.controls.UpdatePlaylist(o.playlist)
7894            }
7895        };
7896
7897        function Ctxt(y) {
7898            var utx;
7899            for (var i = 1; i < 6; i++) {
7900                var t = "text" + i;
7901                if (exist(y[t])) {
7902                    v[t] = y[t];
7903                    utx = true
7904                }
7905            }
7906            if (utx && o.controls) {
7907                o.controls.upTexts()
7908            }
7909        }
7910        this.Ctxt = function (x) {
7911            Ctxt(x)
7912        };
7913        this.UpdatePlaylist = function (x) {
7914            if (typeof (x) == 'object') {
7915                o.playlist_dic = [];
7916                o.playlist_source = copyObject(x);
7917                o.playlist = IndexPlaylist(x);
7918                if (o.controls) {
7919                    o.controls.UpdatePlaylist(o.playlist)
7920                }
7921            }
7922        };
7923        this.NewFile = function (x, y, z, no) {
7924            if (!exist(y)) {
7925                o.autoplay = true;
7926                o.newplay = true
7927            }!exist(z) ? v.preload = 0 : '';
7928            v.duration = undefined;
7929            v.end = undefined;
7930            !options.delete ? v.delete = undefined : '';
7931            o.media_error != 2 ? o.media_error = false : '';
7932            o.metadata = false;
7933            o.pipwebkit = false;
7934            o.reloadTimer = 0;
7935            o.gatracked = [];
7936            o.checknative = false;
7937            o.gained = false;
7938            o.dvr = false;
7939            o.bitrate = undefined;
7940            o.quartile = [false, false, false];
7941            o.sess = randomstr();
7942            o.sesstime = 0;
7943            o.or0 = 0;
7944            o.pld ? o.pld = [] : '';
7945            o.file_type != 'pjs' && o.sbt ? o.sbt.remove() : '';
7946            if (o.trkp) {
7947                o.trkp = [];
7948                o.trkp2 = []
7949            }
7950            o.prc = 0;
7951            o.mxprc = 0;
7952            if (o.err404v) {
7953                o.err404v.remove()
7954            }
7955            if (o.media.status() == "playing") {
7956                this.Stop()
7957            }
7958            if (o.cut && o.cutted) {
7959                o.controls.Cut()
7960            }
7961            if (exist(o.share)) {
7962                o.share.Remove()
7963            }
7964            if (exist(o.reloadto)) {
7965                clearTimeout(o.reloadto)
7966            }
7967            js("new");
7968            if (v.vast == 1 && no != 1) {
7969                o.actions.VastRecover();
7970                o.actions.VastRecover('midroll')
7971            }
7972            x = this.File(x);
7973            if (y == 1) {
7974                o.file_type = ''
7975            }
7976            o.media.File(x);
7977            if ((o.system.mobile || o.system.safari) && !exist(y)) {
7978                o.actions.Play()
7979            }
7980            if (exist(o.custom_aspect)) {
7981                o.mediascale = {
7982                    x: 1,
7983                    y: 1,
7984                    x0: 1,
7985                    y0: 1
7986                };
7987                o.media.normalscale()
7988            }
7989            gaTracker("play", "Play");
7990            o.media.NativeControls();
7991            o.controls.QualityChangedNoHand();
7992            o.controls.AudioTrackChangedNoHand();
7993            o.controls.refresh();
7994            o.mediatags ? o.mediatags.read() : ''
7995        };
7996        this.TitleTemplate = function (x) {
7997            var y = false;
7998            if (x && o.title_template) {
7999                v.title = o.title_template;
8000                for (var i = 1; i < 6; i++) {
8001                    if (exist(x['t' + i])) {
8002                        v.title = v.title.replace("{" + i + "}", x['t' + i]);
8003                        y = true
8004                    }
8005                }
8006            }
8007            return y
8008        };
8009        this.MediaReady = function () {
8010            if (v.autoplay == 1 && !v.autoplayed || o.autoplay) {
8011                if (v.observer == 1) {
8012                    setTimeout(function () {
8013                        o.actions.Play()
8014                    }, 500)
8015                } else {
8016                    this.Play()
8017                }
8018                v.autoplayed = 1;
8019                o.autoplay = false
8020            }
8021            Thumbs()
8022        };
8023        this.Thumbs = function () {
8024            Thumbs()
8025        };
8026
8027        function Thumbs() {
8028            if (v.thumbs == 1) {
8029                if (typeof PluginThumbs !== "undefined") {
8030                    o.th = new PluginThumbs()
8031                }
8032            }
8033        }
8034        this.NativeControls = function () {
8035            var x = false;
8036            if (o.system.mobile) {
8037                x = true;
8038                if (v.nativenotiphone == 1 && o.system.iphone) {
8039                    x = false
8040                }
8041                if (v.nativenotipad == 1 && o.system.ipad) {
8042                    x = false
8043                }
8044                if (v.nativenotios == 1 && o.system.ios) {
8045                    x = false
8046                }
8047                if (v.nativenotandroid == 1 && o.system.android) {
8048                    x = false
8049                }
8050            }
8051            if (v.nativeontv == 1 && o.system.tv) {
8052                x = true
8053            }
8054            return x
8055        };
8056        this.Metadata = function () {
8057            o.media.Volume(v.volume);
8058            if (o.muted) {
8059                o.media.Mute()
8060            }
8061            o.metadata = true;
8062            o.controls ? o.controls.refresh() : '';
8063            if (!o.play && !o.start) {
8064                v.effects == 1 ? o.effects.api("pause") : ''
8065            }
8066            if (o.casting && o.tagvideo) {
8067                o.chromecast.Exit();
8068                o.chromecast.Go()
8069            }
8070            if (v.vast == 1) {
8071                if (v.nomidroll != 1 && v.midrolls == 1) {
8072                    !exist(o.vast) ? MidrollOverlay("midroll", "metadata") : ''
8073                }
8074            }
8075        };
8076        this.onPlayTag = function () {
8077            !o.onplay ? onPlay(true) : ''
8078        };
8079
8080        function onPlay(x) {
8081            o.onplay = true;
8082            if (o.controls) {
8083                if (o.controls.SettingsVisible()) {
8084                    o.controls.Settings()
8085                }
8086            }
8087            if (o.droplist) {
8088                o.droplist.Close()
8089            }
8090            if (o.rel) {
8091                o.rel.Close()
8092            }!x ? o.media.Play() : '';
8093            if (!o.checknative) {
8094                setTimeout(function () {
8095                    o.media.NativeControls()
8096                }, 500)
8097            }!o.play ? o.controls.Play() : '';
8098            v.effects == 1 ? o.effects.api("play") : '';
8099            v.vast == 1 ? o.actions.VastRecover('pauseroll') : '';
8100            if (o.system.mobile) {
8101                o.controls.HideInterval()
8102            }
8103            if (exist(o.share)) {
8104                o.share.isOpen() ? o.share.Hide() : ''
8105            }
8106        }
8107        this.Play = function (noads) {
8108            if (!o.play && o.media) {
8109                o.actplay = true;
8110                o.vstpause = false;
8111                o.ended = false;
8112                v.reload == 9 ? v.reload = 1 : '';
8113                clearTimeout(o.plapto);
8114                var stop = false;
8115                if (o.file_type == "youtube") {
8116                    if (!o.media.YoutubeReady() && v.autoplay != 1 && v.preload == 1) {
8117                        stop = true;
8118                        if (window['YT']) {
8119                            v.autoplay = 1;
8120                            o.autoplay = true;
8121                            o.media.onYoutubeReady()
8122                        }
8123                    }
8124                }
8125                if (v.pass == 1 && v.passontime == 0) {
8126                    o.actions.Password();
8127                    stop = true
8128                }
8129                if (o.media_error || stop) {
8130                    if (o.media_error) {
8131                        Advertising("preroll") ? datetime(2) : ''
8132                    }
8133                } else {
8134                    o.newfile = false;
8135                    o.newplay = false;
8136                    StopOtherPlayer(!o.start);
8137                    o.alert.close();
8138                    if (!o.start) {
8139                        js("start");
8140                        o.start = true;
8141                        if (v.toolbar.hideuntilstarted == 1) {
8142                            setTimeout(function () {
8143                                o.controls.resizetext()
8144                            }, 100)
8145                        }
8146                        if (v.toolbar.hideleavetimeout > 0 && v.autoplay == 1) {
8147                            o.starttimeout = true;
8148                            setTimeout(StartTimeout, v.toolbar.hideleavetimeout * 1000)
8149                        }
8150                        if (v.water == 1 && v.wid) {
8151                            PluginWater()
8152                        }
8153                        for (var i = 0; i < o.vsts.length; i++) {
8154                            if (v['vast_nofirst' + o.vsts[i]] == 1) {
8155                                localStorage.setItem("pljsfirst" + o.vsts[i], Date.now())
8156                            }
8157                        }
8158                        if (v.pjsstat == 1 && v.pjsstatid) {
8159                            PluginStat("start")
8160                        }
8161                        if (o.sbt) {
8162                            o.sbt.start()
8163                        }
8164                        js("new");
8165                        o.ctxtnk ? o.controls.upText(o.ctxtnk) : '';
8166                        o.controls.startcss();
8167                        o.controls.refresh();
8168                        gaTracker("play", "Play");
8169                        o.system.mobile ? MediaSess() : '';
8170                        o.ab ? gaTracker("adblock", "AdBlock", 1) : ''
8171                    } else {
8172                        gaTracker("resume", "Resume")
8173                    }
8174                    if (v.fullonplay == 1 && !o.fullscreen) {
8175                        var dd = new Date();
8176                        var tt = dd.getTime();
8177                        if (tt - o.clicktime < 300) {
8178                            if (!o.system.ios && (v.fullonplaymobile != 1 || o.system.mobile)) {
8179                                this.Fullscreen()
8180                            }
8181                        }
8182                    }
8183                    if (o.subtitle_on) {
8184                        if (v.subpausehide == 1) {
8185                            show2(o.subtitle)
8186                        }
8187                    }
8188                    if (o.err404v) {
8189                        o.err404v.remove()
8190                    }
8191                    if (noads != 1 && Advertising("preroll") || Advertising("intro")) {
8192                        datetime(2)
8193                    } else {
8194                        if (v.redirect == 1 && exist(v.redirectonplay) && !exist(options.redirect)) {
8195                            redirect(v.redirectonplay);
8196                            stop = true
8197                        }
8198                        if (!stop) {
8199                            log("Play");
8200                            o.media.duration() > 0 ? o.controls.Duration(o.media.time(), o.media.duration()) : '';
8201                            if (!o.start2) {
8202                                o.start2 = true;
8203                                if (v.toolbar.hideleavetimeout > 0 && v.autoplay == 1) {
8204                                    o.starttimeout = true;
8205                                    setTimeout(StartTimeout, v.toolbar.hideleavetimeout * 1000)
8206                                }
8207                            }
8208                            var playroll = false;
8209                            if (o.media.time() > 1 && v.pauserollonplay == 1 && noads != 1 && !isVastBgLoad() && !exist(o.vast) && !exist(o.vastloader)) {
8210                                playroll = Advertising("pauseroll")
8211                            }
8212                            if (playroll) {
8213                                isVastBgLoad() ? onPlay(false) : ''
8214                            } else {
8215                                onPlay(false)
8216                            }
8217                        }
8218                    }
8219                }
8220            } else {
8221                o.media ? o.media.Play() : ''
8222            }
8223        };
8224
8225        function StartTimeout() {
8226            o.starttimeout = false;
8227            o.controls.refresh()
8228        }
8229        this.Pause = function () {
8230            if (o.play) {
8231                o.actplay = false;
8232                log("Pause");
8233                o.media.Pause();
8234                o.controls.Pause();
8235                js("pause");
8236                v.posteronpause == 1 ? ShowPoster() : '';
8237                v.posterhidepause == 1 ? HidePoster2() : '';
8238                v.effects == 1 ? o.effects.api("pause") : '';
8239                if (o.subtitle_on) {
8240                    if (v.subpausehide == 1) {
8241                        hide2(o.subtitle)
8242                    }
8243                }
8244                if (!exist(o.vast) && !exist(o.vastloader) && v.pauserollonplay == 0) {
8245                    if (Advertising("pauseroll")) {} else {
8246                        if (v.nooverlay != 1 && v.overlays == 1) {
8247                            MidrollOverlay("overlay", "pause")
8248                        }
8249                    }
8250                }
8251                if (isVastBgLoad()) {
8252                    o.vstpause = true
8253                }
8254                o.onplay = false
8255            }
8256        };
8257        this.Mute = function () {
8258            o.media.Mute();
8259            o.controls.Mute();
8260            o.muted = true;
8261            js("mute")
8262        };
8263        this.Unmute = function () {
8264            o.media.Unmute();
8265            o.muted = false;
8266            o.controls.Unmute();
8267            o.media.Volume(v.volume);
8268            js("unmute")
8269        };
8270        this.Volume = function (x, y) {
8271            if (o.controls) {
8272                x < 0.01 ? x = 0 : '';
8273                x > 1 ? x = 1 : '';
8274                if (x <= 0) {
8275                    this.Mute();
8276                    v.volume = 0;
8277                    x = 0
8278                } else {
8279                    if (o.muted) {
8280                        this.Unmute()
8281                    }
8282                    v.volume = x
8283                }
8284                js("volume", x);
8285                o.controls.Volume(x, y);
8286                o.media.Volume(x)
8287            }
8288        };
8289        this.Waiting = function () {
8290            o.controls.Waiting()
8291        };
8292        this.StopWaiting = function () {
8293            o.controls ? o.controls.StopWaiting() : ''
8294        };
8295        this.Progress = function () {
8296            this.StopWaiting()
8297        };
8298        this.Seeked = function () {
8299            o.actions.UpdatePlay();
8300            this.StopWaiting()
8301        };
8302        this.Duration = function (time, duration) {
8303            if (o.continue && !o.start) {
8304                var f = o.continue.flag();
8305                if (f.t && f.d) {
8306                    time = f.t
8307                }
8308            }
8309            o.controls ? o.controls.Duration(time, duration) : ''
8310        };
8311        this.LoadedData = function (time, duration) {
8312            if (o.seekto > 0 && o.file_type != "youtube") {
8313                o.actions.Seek(o.seekto, false);
8314                o.seekto = undefined
8315            }
8316        };
8317        this.ScreenClick = function () {
8318            var d = new Date();
8319            o.clicktime = d.getTime();
8320            var x = false;
8321            if (o.controls.SettingsVisible() && v.settings.always != 1) {
8322                o.controls.SettingsClose();
8323                x = true
8324            }
8325            if (o.droplist) {
8326                if (o.droplist.Visible()) {
8327                    o.droplist.Close();
8328                    x = true
8329                }
8330            }
8331            if (v.playlist.always == 0) {
8332                if (o.controls.PlaylistVisible() && v.playlist.autohide == 1) {
8333                    o.controls.Playlist();
8334                    x = true
8335                }
8336            }
8337            if (v.redirect == 1 && exist(v.redirectonclick) && !exist(options.redirect)) {
8338                redirect(v.redirectonclick);
8339                x = true
8340            }
8341            if (o.muted && v.unmuteonclick == 1) {
8342                o.actions.Unmute();
8343                v.unmuteonclick = 0;
8344                x = true
8345            }
8346            if (!x) {
8347                if (v.hotkey.on == 1 && v.hotkey.icons == 1 && v.hotkey.playiconbut == 1) {
8348                    PluginHotIcon('play', (o.play ? 0 : 1))
8349                }
8350                this.Toggle()
8351            }
8352        };
8353        this.ControlsBgClick = function () {
8354            if (o.controls.SettingsVisible()) {
8355                o.controls.Settings()
8356            }
8357        };
8358        this.Toggle = function () {
8359            if (o.media.status() == "playing") {
8360                js("userpause");
8361                v.scrnstp == 1 ? this.StopMedia() : this.Pause()
8362            } else {
8363                js("userplay");
8364                this.Play()
8365            }
8366            Sub()
8367        };
8368        this.Seek = function (sec, hand) {
8369            if (sec < o.media.duration()) {
8370                if (v.control_line.dontseekforward == 1) {
8371                    if (sec > o.media.time()) {
8372                        return
8373                    }
8374                }
8375                if (v.delete > 0) {
8376                    sec < v.delete ? sec = v.delete : ''
8377                }
8378                log("Seek");
8379                o.seeked_time = sec;
8380                o.media.Seek(sec);
8381                if (hand) {
8382                    o.controls.Seek(sec, o.media.duration())
8383                }
8384                o.seeking = true;
8385                o.seeking_time = o.media.time();
8386                Sub(o.seeking_time)
8387            }
8388        };
8389        this.Open = function (url, target, endfull) {
8390            if (o.media.status() == "playing" && o.mode != 'audio') {
8391                Pause();
8392                if (o.fullscreen && endfull) {
8393                    o.actions.Normalscreen()
8394                }
8395            }
8396            window.open(url, target)
8397        };
8398        this.Download = function () {
8399            if (v.vast == 1 && !o.start) {
8400                if (Advertising("preroll")) {
8401                    o.vstdwn = true;
8402                    return
8403                }
8404            }
8405            var x = o.media.currentFile();
8406            if (exist(v.download)) {
8407                x = v.download
8408            }
8409            if (x != '') {
8410                js("download");
8411                var win = window.open(x, (v.downself == 1 ? '_self' : '_blank'));
8412                win.focus()
8413            }
8414        };
8415        this.UpdatePlay = function (x) {
8416            var time = o.media.time();
8417            var duration = o.media.duration();
8418            if (!o.start && o.seekto > 0) {
8419                time = o.seekto
8420            }
8421            o.controls.Played(time, duration, x)
8422        };
8423        this.Playing = function () {
8424            var time = o.media.time();
8425            var duration = o.media.duration();
8426            var delta = duration > 0 ? time / duration : 0;
8427            var prc = Math.ceil(delta * 100);
8428            if (!o.seeking) {
8429                o.controls ? o.controls.Played((o.seekto > 0 ? o.seekto : time), duration) : ''
8430            } else {
8431                time != o.seeking_time && o.seeking_time != -9 ? o.seeking = false : ''
8432            }
8433            if ((v.ga == 1 || v.yamtr == 1) && duration > 0) {
8434                gaTrackPlay("play25", "Play 25%", delta, 0.25);
8435                gaTrackPlay("play50", "Play 50%", delta, 0.50);
8436                gaTrackPlay("play75", "Play 75%", delta, 0.75)
8437            }
8438            for (var i = 0; i < 3; i++) {
8439                if (!o.quartile[i]) {
8440                    if (delta >= i * 0.25 + 0.25) {
8441                        Quartile(i)
8442                    }
8443                }
8444            }
8445            v.reloadlog == 1 ? log(1, time, duration) : '';
8446            if (v.reload == 1 || v.fileorto > 0) {
8447                if (o.play) {
8448                    var z = false;
8449                    var rld = false;
8450                    if (v.reloadlive == 1 && v.reload == 1) {
8451                        if (!o.media.isLive()) {
8452                            z = true
8453                        }
8454                    }
8455                    if (time > 0) {
8456                        if (time == o.time && !z) {
8457                            rld = true
8458                        } else {
8459                            o.reloadTimer = 0
8460                        }
8461                        o.time = time
8462                    } else {
8463                        if (v.reloadstart == 1) {
8464                            var ld = o.media.loaded();
8465                            v.reloadlog == 1 ? log(2, ld, o.timeld) : '';
8466                            if (!z) {
8467                                if (ld == o.timeld) {
8468                                    rld = true
8469                                } else {
8470                                    o.reloadTimer = 0
8471                                }
8472                            }
8473                            o.timeld = ld
8474                        }
8475                    }
8476                    if (rld) {
8477                        o.reloadTimer++;
8478                        if (v.reload == 1) {
8479                            v.reloadlog == 1 ? log(3, o.reloadTimer) : '';
8480                            if (o.reloadTimer == v.reloadtimeout * (1000 / o.timerTime)) {
8481                                o.actions.Reload()
8482                            }
8483                        } else if (v.fileorto > 0 && o.media.urlsl() > 1) {
8484                            if (o.reloadTimer == v.fileorto * (1000 / o.timerTime)) {
8485                                o.media.onError('OR timeout')
8486                            }
8487                        }
8488                    }
8489                }
8490            }
8491            if (v.apiprm) {
8492                if (v.apiprm.pld == 1 && duration > 0) {
8493                    !o.pld ? o.pld = [] : '';
8494                    o.pld[Math.round(time)] = 1
8495                }
8496            }
8497            if (v.vast == 1) {
8498                if (v.nomidroll != 1 && v.midrolls == 1) {
8499                    !exist(o.vast) ? MidrollOverlay("midroll", time, duration) : ''
8500                }
8501                if (v.nooverlay != 1 && v.overlays == 1) {
8502                    !exist(o.vast) ? MidrollOverlay("overlay", time, duration) : ''
8503                }
8504            }
8505            if (v.intros == 1 && v.introstart > 0) {
8506                if (time >= v.introstart) {
8507                    if (!exist(o.vast)) {
8508                        if (Advertising("intro")) {
8509                            o.media.Pause();
8510                            o.controls.Pause()
8511                        }
8512                        v.introstart = 0
8513                    }
8514                }
8515            }
8516            SettingsTimers("play");
8517            if (v.pass == 1 && v.passontime > -1) {
8518                PasswordTime(time, duration)
8519            }
8520            if (o.subtitle_on) {
8521                Sub(time)
8522            }
8523            if (o.storage && v.timestore == 1) {
8524                if (o.continue) {
8525                    !o.seekto ? o.continue.write(time, duration) : ''
8526                }
8527            }
8528            if (o.cutted) {
8529                o.cut ? o.cut.play(time) : ''
8530            }
8531            if (exist(v.end)) {
8532                var ed = v.end;
8533                if (indOf([v.end], '-')) {
8534                    ed = duration
8535                }
8536                if (ed > 0 && time > ed) {
8537                    o.media.Pause();
8538                    o.media.Seek(v.start > 0 ? v.start : 0);
8539                    v.start > 0 ? o.seekto = v.start : '';
8540                    o.actions.Ended()
8541                }
8542            }
8543            if (exist(v.remove)) {
8544                var r1 = v.remove.split(",");
8545                for (var i = 0; i < r1.length; i++) {
8546                    var r2 = r1[i].split("-");
8547                    if (r2.length == 2) {
8548                        if (time > r2[0] && time < r2[1]) {
8549                            o.media.Seek(r2[1] * 1 + (o.system.safari ? 1 : 0))
8550                        }
8551                    }
8552                }
8553            }
8554            if (o.prc != prc && prc > 0) {
8555                if (v.tracking == 1) {
8556                    if (typeof PluginTrack !== "undefined") {
8557                        PluginTrack(time, duration, prc)
8558                    }
8559                }
8560                if (v.heartbeats == 1 && o.dt) {
8561                    if (typeof PluginHeart !== "undefined") {
8562                        PluginHeart()
8563                    }
8564                }
8565            }
8566            o.prc = prc
8567        };
8568
8569        function Quartile(x) {
8570            o.quartile[x] = true;
8571            if (v.timestore == 1 && v.playedstore == 1 && v.playedquartile == x) {
8572                if (o.storage && o.plid) {
8573                    o.continue ? o.continue.writePl(o.plid) : ''
8574                }
8575            }
8576        }
8577
8578        function gaTrackPlay(x, y, t, p) {
8579            if (!exist(o.gatracked[y])) {
8580                if (t > p) {
8581                    gaTracker(x, y, 1)
8582                }
8583            }
8584        };
8585        this.Reload = function () {
8586            o.reloadTimer = 0;
8587            exist(o.reloadto) ? clearTimeout(o.reloadto) : '';
8588            if (v.reloadjustevent == 1) {
8589                js("reload")
8590            } else {
8591                o.seekto > 0 || o.media.isLive() ? '' : o.seekto = o.media.time() + (v.reloadplus > 0 ? 1 : 0);
8592                var openpl = o.controls.PlaylistVisible();
8593                js("reload");
8594                o.media.reload();
8595                openpl && v.playlist.autohide == 1 ? o.controls.PlaylistShow() : ''
8596            }
8597        };
8598        this.Stopped = function () {
8599            o.controls.Played(0, 0);
8600            o.controls.Loaded(0, 0);
8601            o.actions.Duration(0, 0);
8602            o.controls.StopWaiting()
8603        };
8604        this.Loading = function () {
8605            if (o.media) {
8606                var time = o.media.loaded();
8607                if (v.pjsiframed == 1) {
8608                    js("loaded", time)
8609                }
8610                var duration = o.media.duration();
8611                o.controls ? o.controls.Loaded(time, duration) : ''
8612            }
8613        };
8614        this.Ended = function () {
8615            js("fileend");
8616            o.ended = true;
8617            if (v.loop == 1) {
8618                if (o.file_type == "youtube") {
8619                    this.Stop()
8620                }
8621                v.vast == 1 ? o.actions.VastRecover('preroll') : '';
8622                if (v.start > 0) {
8623                    o.actions.Seek(v.start);
8624                    o.seekto = undefined
8625                }
8626                this.Play()
8627            } else {
8628                if (o.media.isLive() || o.file_type == "youtube") {
8629                    this.Stop()
8630                } else {
8631                    if (v.finishrewind == 1) {
8632                        o.actions.Seek((v.start > 0 ? v.start : 0), true);
8633                        if (o.system.ie) {
8634                            o.media.Pause()
8635                        }
8636                    }
8637                }
8638                o.controls.onEnded();
8639                v.intros == 1 ? v.outros = 1 : '';
8640                if (Advertising("postroll") || Advertising("outro")) {} else {
8641                    End()
8642                }
8643            }
8644            js("end")
8645        };
8646        this.Fullscreen = function () {
8647            var stop = false;
8648            var error = false;
8649            o.fs_error = false;
8650            o.fullscreen_process = true;
8651            setTimeout(function () {
8652                o.fullscreen_process = false
8653            }, 3000);
8654            for (var x in o.motions) {
8655                if (o.motions.hasOwnProperty(x)) {
8656                    if (exist(o.motions[x])) {
8657                        try {
8658                            o.motions[x].TheEnd2()
8659                        } catch (e) {}
8660                    }
8661                }
8662            }
8663            try {
8664                o.fullscreen_start = true;
8665                if (((o.system.ios && v.nativefullios == 1) || (o.system.android && v.nativefulldroid == 1)) && o.tagvideo && !o.nativecontrols) {
8666                    var x = o.media.tag();
8667                    if (x) {
8668                        if (x.webkitSupportsFullscreen) {
8669                            NativeEnterFs();
8670                            stop = true
8671                        }
8672                    }
8673                }
8674                if (!stop) {
8675                    var fspr;
8676                    var y = o.frame;
8677                    if ((o.file_type == "dm" || o.file_type == "vimeo") && o.system.iphone && v.nativefullios == 1) {
8678                        o.media.iosfull();
8679                        return
8680                    }
8681                    if (y.requestFullscreen) {
8682                        o.realfullscreen = true;
8683                        fspr = y.requestFullscreen({
8684                            navigationUI: "hide"
8685                        });
8686                        if (fspr !== undefined) {
8687                            fspr.then(function () {}).catch(function (error) {})
8688                        }
8689                    } else if (y.requestFullScreen) {
8690                        y.requestFullScreen({
8691                            navigationUI: "hide"
8692                        });
8693                        o.realfullscreen = true
8694                    } else if (o.frame.mozRequestFullScreen) {
8695                        y.mozRequestFullScreen({
8696                            navigationUI: "hide"
8697                        });
8698                        o.realfullscreen = true
8699                    } else if (y.webkitRequestFullScreen) {
8700                        y.webkitRequestFullScreen({
8701                            navigationUI: "hide"
8702                        });
8703                        o.realfullscreen = true
8704                    } else if (y.msRequestFullscreen) {
8705                        y.msRequestFullscreen();
8706                        o.realfullscreen = true
8707                    }
8708                }
8709            } catch (e) {
8710                error = true;
8711                log(e)
8712            }
8713            if (!o.realfullscreen && !stop) {
8714                if (o.system.webkit && o.iniframe) {
8715                    NativeEnterFs()
8716                } else {
8717                    this.FullscreenUI()
8718                }
8719            }
8720            if (!error) {
8721                setTimeout(PostFullscreen, 200)
8722            }
8723        };
8724
8725        function NativeEnterFs() {
8726            var x = o.media.tag();
8727            if (x) {
8728                if (o.media.time() == 0 && o.system.ios && v.iosplbf != 1) {
8729                    !o.play ? o.actions.Play() : ''
8730                } else {
8731                    o.nativefull = true;
8732                    o.media.nativeSubtitle();
8733                    x.webkitEnterFullScreen();
8734                    x.addEventListener("webkitendfullscreen", iosExitFullscreen)
8735                }
8736            }
8737        }
8738
8739        function NativeExitFs() {
8740            var x = o.media.tag();
8741            if (x) {
8742                x.webkitExitFullscreen()
8743            }
8744        };
8745        this.NativeEnterFs = function () {
8746            NativeEnterFs()
8747        };
8748        this.NativeExitFs = function () {
8749            NativeExitFs()
8750        };
8751
8752        function PostFullscreen() {
8753            if (o.fs_error != true) {
8754                if (o.ispipkit) {
8755                    o.media.PipWebkit()
8756                }
8757                if (v.hotkey.volumewheelfull == 1) {
8758                    VolumeWheelX(true);
8759                    o.volumewheel = true
8760                }
8761                v.effects == 1 ? o.effects.api("full") : '';
8762                js("fullscreen");
8763                gaTracker("full", "Fullscreen", 1)
8764            }
8765        };
8766        var volumewheelin;
8767        var lastwheel = {
8768            x: 0,
8769            y: 0
8770        };
8771
8772        function VolumeWheel(e) {
8773            if (o.droplist) {
8774                if (o.droplist.OpenScroll()) {
8775                    return
8776                }
8777            }
8778            if (e.wheelDelta != 0) {
8779                e.deltaX != 0 ? lastwheel.x++ : lastwheel.x--;
8780                e.deltaY != 0 ? lastwheel.y++ : lastwheel.y--;
8781                if ((v.hotkey.whlskfll == 1 || v.hotkey.scrollwheelfull == 1) && o.fullscreen && lastwheel.y > lastwheel.x) {
8782                    clearInterval(volumewheelin);
8783                    volumewheelin = setInterval(function () {
8784                        lastwheel = {
8785                            x: 0,
8786                            y: 0
8787                        };
8788                        clearInterval(volumewheelin)
8789                    }, 1000)
8790                } else {
8791                    o.hidden_volume_over = true;
8792                    clearInterval(volumewheelin);
8793                    volumewheelin = setInterval(function () {
8794                        o.hidden_volume_over = false;
8795                        o.controls.resize();
8796                        lastwheel = {
8797                            x: 0,
8798                            y: 0
8799                        };
8800                        clearInterval(volumewheelin)
8801                    }, 2000);
8802                    o.controls.resize();
8803                    e.preventDefault()
8804                }
8805                if (lastwheel.x > lastwheel.y) {
8806                    if (e.deltaX > 0) {
8807                        o.actions.Volume(parseFloat(v.volume) - v.hotkey.wheelstep / 10, "no")
8808                    } else {
8809                        o.actions.Volume(parseFloat(v.volume) + v.hotkey.wheelstep / 10, "no")
8810                    }
8811                } else {
8812                    var st = (o.system.win ? -v.hotkey.wheelstep / 10 : v.hotkey.wheelstep / 10);
8813                    if (v.hotkey.scrollwheelfull == 1 && o.fullscreen) {
8814                        o.media.scale((e.deltaY > 0 ? st : -st))
8815                    } else if (v.hotkey.whlskfll == 1 && o.fullscreen) {
8816                        apiProcessor("seek", (e.deltaY > 0 ? "+" + st * 10 : "-" + st * 10))
8817                    } else {
8818                        o.actions.Volume(parseFloat(v.volume) + (e.deltaY > 0 ? st : -st), "no");
8819                        o.controls.volumescroll()
8820                    }
8821                }
8822            }
8823        }
8824
8825        function iosExitFullscreen() {
8826            if (o.system.ios) {
8827                o.media.removeNativeSubtitle();
8828                js("exitfullscreen")
8829            }
8830            o.nativefull = false
8831        }
8832        this.FullscreenUI = function () {
8833            if (o.fullscreen_start) {
8834                o.fullscreen = true;
8835                o.controls.Fullscreen();
8836                if (!o.realfullscreen) {
8837                    if (exist(o.parentIframe)) {
8838                        try {
8839                            css(o.parentIframe, {
8840                                'width': '100%',
8841                                'height': '100%',
8842                                'position': 'fixed',
8843                                'left': 0,
8844                                'top': 0,
8845                                'zIndex': "100000"
8846                            })
8847                        } catch (err) {}
8848                    }
8849                    css(o.frame, {
8850                        'width': '100%',
8851                        'height': '100%',
8852                        'position': 'fixed',
8853                        'left': 0,
8854                        'top': 0,
8855                        'zIndex': "100000"
8856                    });
8857                    o.screen_w = o.frame.offsetWidth;
8858                    o.screen_h = o.frame.offsetHeight;
8859                    try {
8860                        document.body.style.overflow = 'hidden';
8861                        if (!exist(o.playlist)) {
8862                            document.ontouchmove = function (e) {
8863                                e.preventDefault()
8864                            }
8865                        }
8866                    } catch (err) {}
8867                }
8868                if (v.fullblack == 1) {
8869                    css(o.frame, {
8870                        'backgroundColor': '#000000'
8871                    })
8872                }
8873                if (v.fzoom == 1 && o.system.webkit == 1 && !o.system.ff) {
8874                    var sw = window.screen.width;
8875                    var fz = 1;
8876                    for (var i = 1; i < 6; i++) {
8877                        if (sw > 1000 * i) {
8878                            fz = existv(v['fzoom' + (1000 * i)], i)
8879                        }
8880                    }
8881                    if (fz > 1) {
8882                        o.frame.style.zoom = fz;
8883                        o.fzoom = fz;
8884                        MainResize()
8885                    }
8886                }
8887                if (o.droplist) {
8888                    o.droplist.Close()
8889                }
8890                Sub();
8891                o.fullscreen_start = false
8892            }
8893        };
8894        this.Normalscreen = function () {
8895            _fullscreen_end = true;
8896            if (document.cancelFullScreen) {
8897                document.cancelFullScreen()
8898            } else if (document.exitFullscreen) {
8899                document.exitFullscreen()
8900            } else if (document.cancelFullscreen) {
8901                document.cancelFullscreen()
8902            } else if (document.mozCancelFullScreen) {
8903                document.mozCancelFullScreen()
8904            } else if (document.webkitCancelFullScreen) {
8905                document.webkitCancelFullScreen()
8906            } else if (document.msExitFullscreen) {
8907                document.msExitFullscreen()
8908            }
8909            if (!o.realfullscreen) {
8910                this.NormalscreenUI(false)
8911            }
8912        };
8913        this.changeAspect = function (x, y) {
8914            NewAspect(x, y)
8915        };
8916
8917        function NewAspect(x, frmvst) {
8918            if (exist(o.vast) && !frmvst) {
8919                o.resizeonplay = x
8920            } else {
8921                var stop = false;
8922                var coh = o.container_w / x;
8923                var cow = 0;
8924                var nhs = {
8925                    'height': coh
8926                };
8927                if (v.chngwd == 1) {
8928                    if (coh > o.container_h) {
8929                        coh = o.container_h;
8930                        cow = o.container_w / x;
8931                        o.container_w = nhs['width'] = cow
8932                    }
8933                }
8934                if (exist(o.parentIframe) && v.notframe != 1) {
8935                    try {
8936                        css(o.parentIframe, nhs)
8937                    } catch (err) {
8938                        stop = true;
8939                        log("iframe crossdomain issue")
8940                    }
8941                }
8942                if (!stop) {
8943                    o.aspect = x;
8944                    o.container_h = coh;
8945                    if (o.aspect > 0) {
8946                        css(o.container, nhs)
8947                    }
8948                    if (cow > 0) {
8949                        js("width", cow)
8950                    }
8951                    js("height", coh)
8952                }
8953                if (o.vast && !o.fullscreen) {
8954                    o.screen_h = coh;
8955                    if (cow > 0) {
8956                        o.screen_w = cow
8957                    }
8958                    o.vast.Resize()
8959                }
8960            }
8961        };
8962        this.NormalscreenUI = function (x) {
8963            if (_fullscreen_end || x) {
8964                o.fullscreen = false;
8965                o.nativefull = false;
8966                if (!o.realfullscreen) {
8967                    if (exist(o.parentIframe)) {
8968                        try {
8969                            css(o.parentIframe, {
8970                                'position': 'static',
8971                                'left': 0,
8972                                'top': 0,
8973                                'zIndex': 'unset'
8974                            });
8975                            css(o.parentIframe, o.parentIframe_style);
8976                            css(o.parentIframe, {
8977                                'width': o.normal_w,
8978                                'height': o.normal_h
8979                            })
8980                        } catch (err) {}
8981                    }
8982                    css(o.frame, {
8983                        'width': o.normal_w,
8984                        'height': o.normal_h,
8985                        'position': 'absolute',
8986                        'left': 0,
8987                        'top': 0,
8988                        'zIndex': 'unset'
8989                    });
8990                    try {
8991                        document.body.style.overflow = 'auto';
8992                        document.ontouchmove = function (e) {
8993                            return true
8994                        }
8995                    } catch (err) {}
8996                }
8997                o.controls.Normalscreen();
8998                if (v.fullblack == 1) {
8999                    css(o.frame, {
9000                        'backgroundColor': v.screencolor
9001                    });
9002                    if (v.transparent == 1) {
9003                        o.frame.style.backgroundColor = 'transparent'
9004                    } else {
9005                        css(o.frame, {
9006                            'backgroundColor': v.screencolor
9007                        })
9008                    }
9009                }
9010                if (o.fzoom > 1) {
9011                    o.frame.style.zoom = 1;
9012                    o.fzoom = 1;
9013                    MainResize()
9014                }
9015                if (v.hotkey.volumewheelfull == 1) {
9016                    VolumeWheelX(false);
9017                    o.volumewheel = false
9018                }
9019                if (o.droplist) {
9020                    o.droplist.Close()
9021                }
9022                Sub();
9023                o.subdrag ? o.subdrag = false : '';
9024                o.controls.PlaylistHere();
9025                _fullscreen_end = false;
9026                js("exitfullscreen");
9027                o.realfullscreen = false;
9028                o.fullscreen_process = false
9029            }
9030        };
9031        this.volumewheel = function (x) {
9032            v.hotkey.vlscrl != 0 ? VolumeWheelX(x) : ''
9033        };
9034
9035        function VolumeWheelX(x) {
9036            lastwheel = {
9037                x: 0,
9038                y: 0
9039            };
9040            if (x) {
9041                window.addEventListener("wheel", VolumeWheel, {
9042                    passive: false
9043                })
9044            } else {
9045                clearInterval(volumewheelin);
9046                window.removeEventListener("wheel", VolumeWheel)
9047            }
9048        }
9049        this.Stop = function (x) {
9050            v.preload = 0;
9051            if (x != 1) {
9052                o.controls.Pause();
9053                o.actions.Stopped()
9054            } else {}
9055            o.media.Volume(v.volume);
9056            if (o.controls.SettingsVisible()) {
9057                o.controls.Settings()
9058            }
9059            if (o.muted) {
9060                this.Mute()
9061            }
9062            Sub(0);
9063            log("stop");
9064            js("stop")
9065        };
9066        this.StopMedia = function () {
9067            v.preload = 0;
9068            v.autoplay = 0;
9069            v.livewakeup = 0;
9070            v.reload == 1 ? v.reload = 9 : '';
9071            o.media.Recover();
9072            o.actions.Stop()
9073        };
9074        this.SetQuality = function (x) {
9075            if (exist(o.current_quality)) {
9076                if (o.current_quality != x) {
9077                    o.current_quality = x;
9078                    if (v.qualitystore == 1) {
9079                        o.default_quality = o.files_quality[x];
9080                        if (o.storage) {
9081                            localStorage.setItem("pljsquality", o.default_quality)
9082                        }
9083                    }
9084                    o.media.SetQuality(x);
9085                    js("quality", o.files_quality[x]);
9086                    o.controls.QualityChanged(x)
9087                }
9088            }
9089        };
9090        this.AirplayChanged = function () {
9091            o.controls ? o.controls.AirplayChanged() : ''
9092        };
9093        this.SetAudioTrack = function (x) {
9094            if (exist(o.current_audiotrack)) {
9095                if (o.current_audiotrack != x) {
9096                    o.current_audiotrack = x;
9097                    if (v.trackstore == 1) {
9098                        o.default_audio = v.default_audio = o.files_audiotrack[x];
9099                        if (o.storage) {
9100                            localStorage.setItem("pljstrack", o.default_audio)
9101                        }
9102                    }
9103                    o.media.SetAudioTrack(x);
9104                    js("audiotrack", x);
9105                    o.controls.SettingChanged("audiotrack")
9106                }
9107            }
9108        };
9109        this.SetSpeed = function (x, z) {
9110            x == '0.0' ? x = 0.1 : '';
9111            var y = x;
9112            String(y).indexOf('.') > 0 ? z = 1 : '';
9113            y = y * 1;
9114            if (!z) {
9115                y = x == o.speed1 ? 1 : o.files_speed[x];
9116                o.current_speed = x
9117            }
9118            y = parseFloat(y);
9119            if (o.line_speed || z) {
9120                o.custom_speed = y;
9121                for (var i = 0; i < o.files_speed.length; i++) {
9122                    if (y <= o.files_speed[i] * 1) {
9123                        o.current_speed = i;
9124                        break
9125                    }
9126                }
9127            }
9128            if (o.storage && v.speedstore == 1) {
9129                localStorage.setItem("pljsspeed", y)
9130            }
9131            js("speed", y);
9132            o.media.SetSpeed(y);
9133            o.controls.SettingChanged("speed")
9134        };
9135
9136        function Sub(x) {
9137            o.sbt ? o.sbt.show(exist(x) ? x : o.media.time()) : ''
9138        };
9139        this.RenewSubtitle = function () {
9140            if (o.sbt) {
9141                Sub();
9142                o.sbt.style()
9143            }
9144        };
9145        this.Subtitle = function (x) {
9146            if (typeof (PluginSub) == 'function') {
9147                !o.sbt ? o.sbt = new PluginSub() : '';
9148                o.sbt.check(x)
9149            }
9150        };
9151        var vast_and;
9152        var vast_or;
9153        var vast_type;
9154        var vasturl;
9155
9156        function Advertising(x) {
9157            if (v["vast_" + x + "timebreak"] > 0 && o.storage) {
9158                var tb = localStorage.getItem("pljs" + x + "_" + o.d);
9159                if (tb) {
9160                    var ct = new Date();
9161                    o.clicktime = ct.getTime();
9162                    var ct2 = (ct.getTime() - tb) / 3600000;
9163                    if (ct2 < v["vast_" + x + "timebreak"]) {
9164                        return false
9165                    }
9166                }
9167            }
9168            if (v["vast_" + x + "timelimit"] > 0) {
9169                if (o.media.duration() > 0) {
9170                    if (o.media.duration() < v["vast_" + x + "timelimit"] * 60) {
9171                        if (v["vast_" + x + "timelimited"] > 0) {
9172                            v["vast_" + x + "_" + "andlimit"] = v["vast_" + x + "timelimited"]
9173                        } else {
9174                            return false
9175                        }
9176                    }
9177                }
9178            }
9179            if (o.compilations.indexOf("VAST") != -1 && v.vast == 1 && !o.noads && v[x + 's'] == 1) {
9180                if (typeof VastVideo == "undefined") {
9181                    return false
9182                }
9183                if (x == "intro" || x == "outro") {
9184                    if (typeof PluginIntro !== "undefined") {
9185                        vasturl = [];
9186                        return PluginIntro(x)
9187                    }
9188                }
9189                if (exist(o.vast) || exist(o.vastloader)) {
9190                    if (!isVisible(o.vastcontainer) || isVastBgLoad(o.vasttype)) {
9191                        log('ad bg');
9192                        return false
9193                    } else {
9194                        log('ad now');
9195                        return true
9196                    }
9197                } else {
9198                    if (exist(v[x])) {
9199                        if (v[x].toString().indexOf(".") > -1 || v[x].toString().indexOf(":") > -1 || v[x].toString().indexOf("[yandex]") > -1) {
9200                            js("vast_init", x);
9201                            if (!isVastBgLoad(x) && x != "overlay") {
9202                                setTimeout(function () {
9203                                    o.play || (o.vastloader == null && o.vast == null) ? '' : o.actions.Waiting()
9204                                }, 10);
9205                                Curtain()
9206                            }
9207                            vast_and = 0;
9208                            vast_or = 0;
9209                            vast_type = x;
9210                            vasturl = v[x].split(" and ");
9211                            o.vast_loaders = [];
9212                            o.adsinchain = vasturl.length;
9213                            VastAndLimit();
9214                            o.adscounter = 1;
9215                            o.adsfirst = true;
9216                            for (var i = 0; i < vasturl.length; i++) {
9217                                vasturl[i] = vasturl[i].split(" or ")
9218                            }
9219                            v[x.concat("_", "recover")] = v[x];
9220                            v[x] = null;
9221                            o.vasttype = x;
9222                            if (x != 'overlay') {
9223                                o.vast = new VastVideo()
9224                            }
9225                            o.vastloader = new VastLoader();
9226                            for (var i = 0; i < vasturl.length; i++) {
9227                                for (var j = 0; j < vasturl[i].length; j++) {
9228                                    var _url = trim(vasturl[i][j]);
9229                                    if (_url.indexOf("[50%]") > 0) {
9230                                        var tmp = random(1, 2);
9231                                        vasturl[i][j] = vasturl[i][j].replace("[50%]", "");
9232                                        if (tmp == 2) {
9233                                            vasturl[i][j] = ''
9234                                        }
9235                                    }
9236                                }
9237                            }
9238                            if (v.vast_preload == 1) {
9239                                for (var i = 0; i < vasturl.length; i++) {
9240                                    var n = i == 0 ? 1 : 0;
9241                                    if (vasturl[i].length > n) {
9242                                        for (var j = n; j < vasturl[i].length; j++) {
9243                                            var _url = trim(vasturl[i][j]);
9244                                            if (o.system.ie9) {
9245                                                VastAddPreload(_url)
9246                                            } else {
9247                                                setTimeout(VastAddPreload, i * 100, _url)
9248                                            }
9249                                        }
9250                                    }
9251                                }
9252                            }
9253                            if (vasturl[0][0] == '') {
9254                                VastNext()
9255                            } else {
9256                                o.vastloader.Load(trim(vasturl[0][0]), x)
9257                            }
9258                            return true
9259                        } else {
9260                            return false
9261                        }
9262                    } else {
9263                        return false
9264                    }
9265                }
9266            } else {
9267                return false
9268            }
9269        };
9270        this.advertising = function (x) {
9271            Advertising(x)
9272        };
9273
9274        function MidrollOverlay(w, x, d) {
9275            if (exist(o[w + 'o']) && v[w + 's'] == 1) {
9276                var y;
9277                for (var i in o[w + 'o']) {
9278                    if (o[w + 'o'].hasOwnProperty(i)) {
9279                        if (!exist(o[w + 'o'][i].worked) && exist(o[w + 'o'][i].time) && exist(o[w + 'o'][i].vast)) {
9280                            var z = o[w + 'o'][i].time.toString();
9281                            var ok = false;
9282                            if (z) {
9283                                if (x == "metadata") {
9284                                    if (z == x) {
9285                                        ok = true
9286                                    }
9287                                } else {
9288                                    if (z == "pause") {
9289                                        if (z == x) {
9290                                            ok = true
9291                                        }
9292                                    }
9293                                    if (z.indexOf("%") > 0) {
9294                                        if (d > 0) {
9295                                            z = parseInt(z.substr(0, z.indexOf("%"))) * d / 100
9296                                        } else {
9297                                            z = -1
9298                                        }
9299                                    } else {
9300                                        z = parseInt(z)
9301                                    }
9302                                    if (x >= z) {
9303                                        if (v['vast_' + w + 'rest'] > 0 && z > -1) {
9304                                            if (x - z >= v['vast_' + w + 'rest']) {
9305                                                z = -1
9306                                            }
9307                                        }
9308                                        if (z > -1) {
9309                                            ok = true
9310                                        }
9311                                    }
9312                                }
9313                                if (o[w + 'o'][i].minduration && o.media.duration() > 0) {
9314                                    if (o.media.duration() < o[w + 'o'][i].minduration * 1) {
9315                                        o[w + 'o'][i].worked = true;
9316                                        ok = false
9317                                    }
9318                                }
9319                                if (ok) {
9320                                    y = o[w + 'o'][i].vast;
9321                                    v[w] = o[w + 'o'][i].vast;
9322                                    o[w + 'crtm'] = o[w + 'o'][i].time;
9323                                    o[w + 'skipimprsd'] = o[w + 'o'][i].skipimpessed;
9324                                    if (Advertising(w)) {
9325                                        o[w + 'o'][i].worked = true;
9326                                        break
9327                                    }
9328                                }
9329                            }
9330                        }
9331                    }
9332                }
9333            }
9334        };
9335
9336        function VastBgLoad() {
9337            if (isVastBgLoad()) {
9338                if (o.vast_impressions == 0 || v['vast_' + o.vasttype + 'bgload2'] == 1) {
9339                    css(o.vastcontainer, {
9340                        "opacity": 0,
9341                        "visibility": "hidden",
9342                        "top": 2000
9343                    });
9344                    log(o.vasttype + " hide");
9345                    o.vasttype == 'midroll' ? o.media.Play() : ''
9346                }
9347            }
9348        }
9349
9350        function isVastBgLoad(z) {
9351            var y = false;
9352            var x = ['midroll', 'pauseroll'];
9353            for (var i = 0; i < x.length; i++) {
9354                if (o.vasttype == x[i] || z == x[i]) {
9355                    if (v['vast_' + x[i] + 'bgload'] == 1) {
9356                        y = true
9357                    }
9358                }
9359            }
9360            return y
9361        };
9362        this.isVastBgLoad = function (x) {
9363            return isVastBgLoad(x)
9364        };
9365        this.VastImpression = function (x) {
9366            x ? '' : VastVisible();
9367            o.vasttype == "midroll" ? o.midrollimprsd.push(o.current_vast_url) : ''
9368        };
9369        this.VpaidStarted = function () {
9370            VastVisible()
9371        };
9372        this.VastShow = function () {
9373            VastVisible()
9374        };
9375
9376        function VastVisible() {
9377            if (isVastBgLoad()) {
9378                if (o.play) {
9379                    o.media.Pause();
9380                    o.controls.Pause()
9381                }
9382                log(o.vasttype + " show");
9383                css(o.vastcontainer, {
9384                    "opacity": 1,
9385                    "visibility": "visible",
9386                    "top": 0
9387                });
9388                o.vastfrombg = 1
9389            }
9390            if (o.nativefull && !o.realfullscreen) {
9391                NativeExitFs()
9392            } else {
9393                if (v["vast_" + o.vasttype + "normal"] == 1 && o.fullscreen) {
9394                    o.actions.Normalscreen()
9395                }
9396            }
9397        };
9398        this.VastReady = function (x) {
9399            o.vastloader = null;
9400            o.vastfrombg = 0;
9401            log("VAST ready", o.vasttype);
9402            js("vast_ready", o.vasttype);
9403            if (x.type == "overlay") {
9404                var ovr = new VastOverlay(x);
9405                o.overlays.push(ovr)
9406            } else {
9407                if (exist(o.vast)) {
9408                    if (v.preload == 0 && v.vastbgpreload == 1 && o.media.time() == 0 && o.media.duration() == 0) {
9409                        v.preload = 1;
9410                        o.media.Preload()
9411                    }
9412                    if ((!o.vast.tagLive() || x.isVpaid) && o.vastgo > 0) {
9413                        log("VAST renew");
9414                        o.vast.Remove();
9415                        o.vast = null;
9416                        o.vast = new VastVideo()
9417                    }
9418                    if (isVastBgLoad()) {
9419                        VastBgLoad()
9420                    } else {
9421                        if (o.play) {
9422                            o.media.Pause();
9423                            o.controls.Pause()
9424                        }
9425                    }
9426                    o.vastgo++;
9427                    if (o.adsfirst && v.vast_longtimeout > 0) {
9428                        clearTimeout(o.vast_longtimeout);
9429                        o.vast_longtimeout = setTimeout(VastLongTimeout, v.vast_longtimeout * 1000 * 60);
9430                        if (exist(v.vast_longtimemsg)) {
9431                            if (v.vast_longtimemsg != '') {
9432                                o.vast_longtomsg ? o.vast_longtomsg.remove() : '';
9433                                o.vast_longtomsg = new PluginVastTimeMsg()
9434                            }
9435                        }
9436                    }
9437                    o.adsfirst = false;
9438                    if (v.vast_prestarttimeout > 0) {
9439                        log("VAST startdelay");
9440                        js("vast_startdelay");
9441                        setTimeout(VastGo, v.vast_prestarttimeout * 1000, x)
9442                    } else {
9443                        VastGo(x)
9444                    }
9445                } else {
9446                    log("VAST alarm")
9447                }
9448            }
9449        };
9450
9451        function VastGo(x) {
9452            o.vast.Go(x)
9453        }
9454
9455        function VastLongTimeout() {
9456            if (exist(o.vast)) {
9457                if (o.vast.active() && o.vast_impressions == 0) {
9458                    o.vast.RemoveForNextAd();
9459                    log("VAST timeout " + v.vast_longtimeout);
9460                    vasturl = [];
9461                    VastRemoveAndPlay()
9462                }
9463            }
9464        }
9465        this.VastError = function () {
9466            js('vast_error', o.vasttype);
9467            log("VAST error");
9468            VastCheckNext()
9469        };
9470        this.VastNext = function () {
9471            VastCheckNext()
9472        };
9473
9474        function VastCheckNext() {
9475            var n = VastAndLimit();
9476            log("VAST next " + !n);
9477            !n ? VastNext() : VastRemoveAndPlay()
9478        };
9479        this.VastRemoveUrl = function (x) {
9480            if (v[o.vasttype + "_recover"]) {
9481                for (var i = 0; i < 3; i++) {
9482                    v[o.vasttype + "_recover"] = v[o.vasttype + "_recover"].replace(x + (i == 0 ? ' and ' : (i == 1 ? ' or ' : '')), '')
9483                }
9484            }
9485        };
9486
9487        function VastAndLimit() {
9488            var x = false;
9489            if (o.vasttype) {
9490                var val = v['vast_' + o.vasttype + '_' + 'andlimit'];
9491                var va2l = v['vast_' + o.vasttype + '_' + 'and2limit'];
9492                if (va2l || val) {
9493                    if (va2l > 0 && o.vast_starts > 0) {
9494                        o.adsinchain = va2l;
9495                        if (o.vast_impressions >= va2l) {
9496                            x = true
9497                        }
9498                    } else {
9499                        if (val > 0) {
9500                            o.adsinchain = val;
9501                            if (o.vast_impressions >= val) {
9502                                x = true
9503                            }
9504                        }
9505                    }
9506                }
9507            }
9508            return x
9509        }
9510
9511        function VastNext() {
9512            if (vasturl.length > 0 && vasturl[vast_and]) {
9513                if (vast_or < vasturl[vast_and].length - 1) {
9514                    log("VAST Next");
9515                    o.vast ? o.vast.RemoveForNextAd() : '';
9516                    VastBgLoad();
9517                    vast_or++;
9518                    var _url = trim(vasturl[vast_and][vast_or]);
9519                    var _preloaded = VastPreloaded(_url);
9520                    if (_preloaded == 'skip') {
9521                        o.vastloader = new VastLoader();
9522                        o.vastloader.Load(_url, o.vasttype)
9523                    }
9524                    if (_preloaded == 'error') {
9525                        VastNext()
9526                    }
9527                } else {
9528                    VastRemoveAndPlay()
9529                }
9530            } else {
9531                VastRemoveAndPlay()
9532            }
9533        }
9534
9535        function VastPreloaded(_url) {
9536            var x = 'skip';
9537            if (v.vast_preload == 1 && o.vast_loaders) {
9538                var find = false;
9539                var n = 0;
9540                for (var i = 0; i < o.vast_loaders.length; i++) {
9541                    if (o.vast_loaders[i].done == 0) {
9542                        if (o.vast_loaders[i].ldr.preloaded(_url)) {
9543                            o.vast_loaders[i].done = 1;
9544                            var y = o.vast_loaders[i].ldr.Status();
9545                            if (y == 'ready') {
9546                                o.vastloader = o.vast_loaders[i].ldr;
9547                                log("VAST preloaded");
9548                                o.vast_loaders[i].ldr.Ready();
9549                                x = y
9550                            } else {
9551                                if (y == '') {
9552                                    x = 'ok';
9553                                    log("VAST preloading");
9554                                    o.vastloader = o.vast_loaders[i].ldr;
9555                                    o.vast_loaders[i].ldr.disablePreload()
9556                                }
9557                                if (y == 'error') {
9558                                    x = 'error'
9559                                }
9560                            }
9561                            find = true
9562                        }
9563                        if (find && o.vast_loaders[i].load == 0) {
9564                            n++;
9565                            if (n < 6) {
9566                                VastPreloadLoad(o.vast_loaders[i])
9567                            } else {
9568                                break
9569                            }
9570                        }
9571                    }
9572                }
9573            }
9574            return x
9575        }
9576        this.VastInsertAnd = function (x, y) {
9577            if (x != '') {
9578                var z = vast_and;
9579                var moveOr2end = false;
9580                if (y) {
9581                    for (var j = 0; j < vasturl.length; j++) {
9582                        vasturl[j] == y ? z = j : ''
9583                    }
9584                }
9585                if (vasturl.length == 1) {
9586                    if (vasturl[0].length > 1 && vast_or < vasturl[0].length - 1 && vasturl[vast_or]) {
9587                        var last_ors = vasturl[vast_or].slice(1, 99);
9588                        vasturl[0].splice(vast_or + 1, 99);
9589                        moveOr2end = true
9590                    }
9591                }
9592                if (typeof (x) == "object") {
9593                    for (var i = 0; i < x.length; i++) {
9594                        vasturl.splice(z + i + 1, 0, [x[i]]);
9595                        if (o.system.ie9) {
9596                            VastAddPreload(x[i])
9597                        } else {
9598                            setTimeout(VastAddPreload, i * 100, x[i])
9599                        }
9600                    }
9601                } else {
9602                    if (typeof (x) == "string") {
9603                        vasturl.push([x]);
9604                        VastAddPreload(x)
9605                    }
9606                }
9607                if (moveOr2end) {
9608                    vasturl[vasturl.length - 1] = vasturl[vasturl.length - 1].concat(last_ors)
9609                }
9610            }
9611        };
9612        this.VastInsertOr = function (x, y) {
9613            if (x != '') {
9614                var z = vast_and;
9615                if (y) {
9616                    for (var j = 0; j < vasturl.length; j++) {
9617                        vasturl[j] == y ? z = j : ''
9618                    }
9619                }
9620                if (vasturl[z]) {
9621                    if (typeof (x) == "object") {
9622                        for (var i = 0; i < x.length; i++) {
9623                            vasturl[z].push(x[i])
9624                        }
9625                    } else {
9626                        if (typeof (x) == "string") {
9627                            vasturl[z].push(x)
9628                        }
9629                    }
9630                }
9631            }
9632        };
9633        this.VastRemoveAndPlay = function (x) {
9634            VastRemoveAndPlay(x)
9635        };
9636
9637        function VastAddPreload(x) {
9638            if (v.vast_preload == 1 && o.vast_loaders) {
9639                var i = 0;
9640                for (var i = 0; i < vasturl.length; i++) {
9641                    if (vasturl[i] == x) {
9642                        if (vast_and >= i) {
9643                            return
9644                        } else {}
9645                    }
9646                }
9647                if (vasturl.length == 1 && vasturl[0].length > 1) {} else {
9648                    var n = 0;
9649                    for (i = 0; i < o.vast_loaders.length; i++) {
9650                        o.vast_loaders[i].done == 0 ? n++ : ''
9651                    }
9652                    o.vast_loaders.push({
9653                        load: 0,
9654                        done: 0,
9655                        x: trim(x),
9656                        t: o.vasttype,
9657                        ldr: new VastLoader(true)
9658                    });
9659                    n < 5 ? VastPreloadLoad(o.vast_loaders[o.vast_loaders.length - 1]) : ''
9660                }
9661            }
9662        }
9663
9664        function VastPreloadLoad(x) {
9665            if (x) {
9666                x.load = 1;
9667                x.ldr.Load(x.x, x.t)
9668            }
9669        }
9670
9671        function VastRemoveAndPlay(dontplay) {
9672            var stop = VastAndLimit();
9673            log("VAST remove (" + o.vast_impressions + ")");
9674            if (vasturl.length > 0 && vast_and == vasturl.length - 1) {
9675                if (vasturl[0][0].indexOf("js:") == 0) {
9676                    vast_and = -1;
9677                    vasturl = [
9678                        [vasturl[0][0]]
9679                    ]
9680                }
9681            }
9682            if (o.vast_stop == 2) {
9683                stop = true
9684            }
9685            if (vasturl.length > vast_and + 1 && !stop) {
9686                o.vast.RemoveForNextAd();
9687                VastBgLoad();
9688                vast_and++;
9689                o.adscounter++;
9690                vast_or = 0;
9691                var _url = trim(vasturl[vast_and][0]);
9692                var _preloaded = VastPreloaded(_url);
9693                if (_preloaded == 'skip') {
9694                    o.vastloader = new VastLoader();
9695                    o.vastloader.Load(_url, vast_type)
9696                }
9697                if (_preloaded == 'error') {
9698                    VastRemoveAndPlay(dontplay)
9699                }
9700            } else {
9701                RemoveCurtain();
9702                o.controls.StopWaiting();
9703                if (exist(o.vast)) {
9704                    o.vast.Remove();
9705                    o.vast = null
9706                }
9707                o.vastloader = null;
9708                vasturl = [];
9709                vast_or = 0;
9710                vast_and = 0;
9711                o.vastfrombg = 0;
9712                o.shwvstfnsh != 1 ? js("vast_finish", o.vasttype) : '';
9713                o.shwvstfnsh = 0;
9714                if (v.vast_ima == 1) {
9715                    if (o.ima) {
9716                        try {
9717                            o.ima.Destroy()
9718                        } catch (e) {
9719                            log(o.ima, e)
9720                        }
9721                        o.ima = undefined
9722                    }
9723                }
9724                vast_type = '';
9725                o.vast_impressions = 0;
9726                o.vpaid_starts = 0;
9727                clearTimeout(o.vast_longtimeout);
9728                clearInterval(o.vldcntrInterval);
9729                o.vast_longtomsg ? o.vast_longtomsg.remove() : '';
9730                o.vast_loadtxt ? o.vast_loadtxt.hide() : '';
9731                o.vast_starts++;
9732                if (o.vasttype == "preroll" || (o.vasttype == "pauseroll" && v.pauserollonplay == 1 && o.actplay) || o.vasttype == "midroll") {
9733                    if (v.file != '?') {
9734                        o.media.AfterVast();
9735                        var re;
9736                        if (o.vstdwn) {
9737                            o.actions.Download();
9738                            o.vstdwn = false;
9739                            re = true
9740                        }
9741                        if (o.file_type == "youtube" && !o.vastclick && o.system.ios) {
9742                            re = true;
9743                            o.vasttype == "preroll" ? o.media.reYT() : ''
9744                        }
9745                        if (re || dontplay == 'dontplay' || v.vast_dontplay == 1 || o.vstpause) {
9746                            o.vstpause = false
9747                        } else {
9748                            o.actions.Play(1)
9749                        }
9750                    }
9751                }
9752                if (o.resizeonplay > 0) {
9753                    NewAspect(o.resizeonplay);
9754                    o.resizeonplay = 0
9755                }
9756                if (o.vasttype == "postroll") {
9757                    End()
9758                }
9759                o.vastclick = false;
9760                o.vasttype = null
9761            }
9762        };
9763        this.EmptyVastUrl = function () {
9764            vasturl = [
9765                ['']
9766            ]
9767        };
9768        this.VastRecover = function (y) {
9769            var x = ['preroll', 'pauseroll', 'postroll', 'intro', 'outro'];
9770            var z;
9771            for (var i = 0; i < x.length; i++) {
9772                z = false;
9773                if (y) {
9774                    y != x[i] ? z = true : ''
9775                }
9776                if (!z && exist(v[x[i].concat("_", "recover")])) {
9777                    v['vast_' + x[i].concat("_", "limit")]--;
9778                    if (v['vast_' + x[i].concat("_", "limit")] > 0) {
9779                        v[x[i]] = v[x[i].concat("_", "recover")];
9780                        v[x[i].concat("_", "recover")] = null
9781                    }
9782                }
9783            }
9784            if (y == "preroll" || y == "midroll") {
9785                if (v.vast_midroll_limit > 1) {
9786                    if (exist(o.midrollo) && v.midrolls == 1) {
9787                        for (var i in o.midrollo) {
9788                            o.midrollo[i].worked = undefined
9789                        }
9790                        v.vast_midroll_limit--
9791                    }
9792                }
9793            }
9794        };
9795        this.Password = function () {
9796            Curtain();
9797            if (exist(o.pass)) {
9798                o.pass.Remove();
9799                o.pass = null
9800            }
9801            o.pass = new Pass()
9802        };
9803        this.RemovePassword = function () {
9804            RemoveCurtain();
9805            o.pass.Remove();
9806            o.pass = null
9807        };
9808        this.Curtain = function () {
9809            Curtain()
9810        };
9811        this.RemoveCurtain = function () {
9812            RemoveCurtain()
9813        };
9814
9815        function Curtain() {
9816            if (o.curtain) {} else {
9817                o.curtain = createElement("div");
9818                o.frame.appendChild(o.curtain);
9819                Pos0(o.curtain);
9820                css(o.curtain, {
9821                    "background": "#000000",
9822                    "opacity": 0.1
9823                });
9824                o.curtain.style.zIndex = 1001
9825            }
9826        };
9827
9828        function RemoveCurtain() {
9829            if (o.curtain) {
9830                o.frame.removeChild(o.curtain);
9831                o.curtain = null
9832            }
9833        };
9834
9835        function ShowPoster() {
9836            if (exist(o.poster)) {
9837                var p = o.fullscreen ? existv(v.posterfull, v.poster) : v.poster;
9838                if (p != o.currentposter) {
9839                    Poster(p, o.poster, v.poster_scale)
9840                }
9841                show(o.poster);
9842                css(o.poster, {
9843                    "opacity": v.poster_a
9844                });
9845                o.controls.refresh();
9846                o.pstrv ? o.pstrv.play() : ''
9847            }
9848        };
9849        this.HidePoster = function () {
9850            if (exist(o.poster)) {
9851                if (isVisible(o.poster)) {
9852                    clearInterval(o.pstrsin);
9853                    var t = o.media.time();
9854                    if (t == 0 && v.posterhidestart == 1) {} else {
9855                        if (v.posterhidetime > 0) {
9856                            clearTimeout(o.pstr_to);
9857                            o.pstr_to = setTimeout(HidePoster2, v.posterhidetime * 1000)
9858                        } else {
9859                            HidePoster2()
9860                        }
9861                    }
9862                }
9863            }
9864        };
9865
9866        function HidePoster2() {
9867            clearTimeout(o.pstr_to);
9868            if (v.posteronpause == 1 && !o.play) {} else {
9869                css(o.poster, {
9870                    "opacity": 0
9871                });
9872                setTimeout(HidePoster3, 500)
9873            }
9874        }
9875
9876        function HidePoster3() {
9877            if (!o.play && v.posterhide == 1) {} else {
9878                hide(o.poster);
9879                o.pstrv ? o.pstrv.pause() : '';
9880                o.controls.refresh()
9881            }
9882        }
9883        this.ShowPoster = function () {
9884            ShowPoster()
9885        };
9886
9887        function StopOtherPlayer(x) {
9888            if (v.stopotherplayers == 1) {
9889                for (var i = 0; i < window.pljssglobal.length; i++) {
9890                    if (window.pljssglobal[i]) {
9891                        if (window.pljssglobal[i].api("id") != v.id) {
9892                            window.pljssglobal[i].api('pause')
9893                        }
9894                    }
9895                }
9896            }
9897            window.pljssglobalid = v.id
9898        }
9899
9900        function IndexPlaylist(x) {
9901            var y = Object.keys(x).length;
9902            o.pldur = 0;
9903            if (y > 0) {
9904                x = IndexPlaylistProcessor(x, y, '', -1)
9905            }
9906            return x
9907        }
9908
9909        function IndexPlaylistProcessor(x, y, p, j) {
9910            var x2 = [];
9911            var stop;
9912            if (exist(x['playlist'])) {
9913                x = x['playlist'];
9914                y = x.length
9915            }
9916            var ii = 0;
9917            for (var i = 0; i < y; i++) {
9918                stop = false;
9919                if (exist(x[i]['id'])) {
9920                    x[i]['pjs_id'] = x[i]['id']
9921                }
9922                x[i]['id'] = "x" + p + '-' + i + (exist(x[i]['id']) ? '-' + x[i]['id'] : '');
9923                j == -1 && i == 0 && !exist(x[i]['folder']) ? o.pl_first_id = x[i]['id'] : '';
9924                if (!exist(o.pl_first_id)) {
9925                    j == 0 && !exist(x[i]['folder']) ? o.pl_first_id = x[i]['id'] : ''
9926                }
9927                x[i]['pjs_parent'] = p;
9928                x[i]['pjs_parent_i'] = j;
9929                x[i]['pjs_i'] = ii;
9930                if (exist(x[i]['duration'])) {
9931                    o.pldur += x[i]['duration']
9932                }
9933                if (exist(x[i]['comment'])) {
9934                    x[i]['title'] = x[i]['comment'];
9935                    var q1 = x[i]['file'] ? x[i]['file'].indexOf('[') : 0;
9936                    var q2 = x[i]['file'] ? x[i]['file'].indexOf(']') : 0;
9937                    if (q1 > 0 && q2 > 0) {
9938                        var s1 = x[i]['file'].substr(q1 + 1, q2 - q1 - 1);
9939                        var s2 = s1.split(",");
9940                        var s3 = '';
9941                        for (var k = 0; k < s2.length; k++) {
9942                            s3 += "[" + s2[k] + "]" + x[i]['file'].replace("[" + s1 + "]", s2[k]) + (k < s2.length - 1 ? "," : '')
9943                        }
9944                        x[i]['file'] = s3
9945                    }
9946                }
9947                if (exist(x[i]['playlist'])) {
9948                    x[i]['folder'] = x[i]['playlist']
9949                }
9950                if (!exist(x[i]['folder'])) {
9951                    if (exist(x[i]['file'])) {
9952                        if (x[i]['file'] == '' && !exist(x[i]['redirect'])) {
9953                            stop = true
9954                        }
9955                    } else {
9956                        stop = true
9957                    }
9958                }
9959                if (!stop) {
9960                    o.playlist_dic[x[i]['id']] = x[i];
9961                    ii += 1
9962                }
9963                if (exist(x[i]['folder'])) {
9964                    var z = Object.keys(x[i]['folder']).length;
9965                    if (z > 0) {
9966                        x[i]['folder'] = IndexPlaylistProcessor(x[i]['folder'], z, x[i]['id'], i)
9967                    }
9968                }
9969                if (!stop) {
9970                    x2.push(x[i])
9971                }
9972            }
9973            return x2
9974        }
9975
9976        function FindFileInPlaylist() {
9977            var x = [];
9978            if (exist(v.plstart)) {
9979                if (v.plstart.indexOf("x-") != 0) {
9980                    for (var y in o.playlist_dic) {
9981                        if (o.playlist_dic.hasOwnProperty(y)) {
9982                            if (o.playlist_dic[y].pjs_id == v.plstart) {
9983                                v.plstart = y
9984                            }
9985                        }
9986                    }
9987                }
9988                if (exist(o.playlist_dic[v.plstart])) {
9989                    v.playlist.norootplstart == 1 ? v.playlist.openplaylistroot = 0 : '';
9990                    x = o.playlist_dic[v.plstart]
9991                } else {
9992                    x = o.playlist[0];
9993                    if (v.plstart == o.plcontinue) {
9994                        o.seekto = undefined
9995                    }
9996                }
9997            } else {
9998                x = o.playlist[0]
9999            }
10000            if (x) {
10001                for (var i = 0; i < 10; i++) {
10002                    if (exist(x['folder'])) {
10003                        x = x['folder'][0]
10004                    } else {
10005                        break
10006                    }
10007                }
10008                v.plstart = x.id;
10009                if (v.plstart == o.plcontinue && x.start != 'continue') {
10010                    x.start = undefined
10011                }
10012            }
10013            return x
10014        }
10015        this.plNxtExst = function () {
10016            return plNxtExst()
10017        };
10018
10019        function plNxtExst() {
10020            var x = false;
10021            if (o.controls) {
10022                if (o.controls.PlaylistExist()) {
10023                    if ((v.playlist.autoplaylist == 1 || v.autonext == 1) && o.controls.PlaylistNextExist()) {
10024                        x = true
10025                    }
10026                }
10027            }
10028            return x
10029        };
10030
10031        function End() {
10032            gaTracker("end", "End", 1);
10033            o.actions.VastRecover();
10034            if (o.storage && v.timestore == 1) {
10035                o.continue.write(0, o.media.duration())
10036            }
10037            if (o.controls.PlaylistExist()) {
10038                if (plNxtExst()) {
10039                    if (exist(v.playlist.apto)) {
10040                        o.plapto = setTimeout(function () {
10041                            o.controls.PlaylistNext()
10042                        }, v.playlist.apto * 1000)
10043                    } else {
10044                        o.controls.PlaylistNext()
10045                    }
10046                } else {
10047                    End2()
10048                }
10049            } else {
10050                if (v.finishnormal == 1 && o.fullscreen) {
10051                    o.actions.Normalscreen()
10052                }
10053                End3()
10054            }
10055        }
10056        this.ShuffleEnd = function () {
10057            End2()
10058        };
10059
10060        function End2() {
10061            if (v.playlist.playlistrewind == 1 && !o.controls.PlaylistNextExist()) {
10062                o.controls.PlaylistRewind();
10063                return
10064            }
10065            if (v.playlist.openplaylistafter == 1) {
10066                !o.controls.PlaylistVisible() ? o.controls.Playlist() : ''
10067            }
10068            End3()
10069        }
10070
10071        function End3() {
10072            v.effects == 1 ? o.effects.api("end") : '';
10073            js("finish");
10074            if (v.redirect == 1 && v.redirectafter == 1 && exist2(v.after)) {
10075                redirect(v.after)
10076            }
10077            if (v.rel) {
10078                if (typeof PluginRel !== "undefined") {
10079                    !o.rel ? o.rel = new PluginRel() : o.rel.Open()
10080                }
10081            }!o.rel ? ShowPoster() : ''
10082        }
10083
10084        function fjs(x) {
10085            if (x.indexOf('js:') == 0) {
10086                try {
10087                    x = eval(x.substr(3))
10088                } catch (e) {
10089                    console.log(e.message)
10090                }
10091            }
10092            return x ? x : ''
10093        }
10094    };
10095    var Media = function (url) {
10096        var url;
10097        var urls;
10098        var urls_and;
10099        var current_url;
10100        var _status = "";
10101        var _lastime = 0;
10102        var _ended = false;
10103        var _stopped = false;
10104        var _tags;
10105        var media;
10106        var media2;
10107        o.mediascale = {
10108            x: 1,
10109            y: 1,
10110            x0: 1,
10111            y0: 1
10112        };
10113        var wait;
10114        var plurls;
10115        var current_plurl = 0;
10116        var rldcnt = 0;
10117        var hlsend_to;
10118        if (typeof (url) == 'string') {
10119            url = trim(url);
10120            if (url.indexOf("[{") == 0) {
10121                try {
10122                    url = url.replace(/pjs'qt/ig, '"');
10123                    url = JSON.parse(url);
10124                    wait ? url = o.actions.File(url) : ''
10125                } catch (e) {
10126                    console.log(e);
10127                    url = "incorrect JSON"
10128                }
10129            }
10130            if (url.indexOf("#" + v.enc2) == 0) {
10131                url = o[o.fd[0]](url)
10132            }
10133            if (url) {
10134                if (url.indexOf("#" + v.enc3) == 0 && url.indexOf(v.file3_separator) > 0) {
10135                    wait = true;
10136                    o[o.fd[1]](url, Start)
10137                }
10138            }
10139            if (url) {
10140                if (url.indexOf("#0") == 0) {
10141                    if (url.indexOf(o.pltxt) > 0) {
10142                        url = fd0(url.replace(o.pltxt, '')) + o.pltxt
10143                    } else {
10144                        url = fd0(url)
10145                    }
10146                }
10147            }
10148            if (v.fplace == 1) {
10149                url = fplace(url)
10150            }
10151            if (typeof (url) == 'string') {
10152                if (url.indexOf(".m3u") == url.length - 4 || url.indexOf(".txt") > 0) {
10153                    plurls = url.split(" or ");
10154                    PlaylistLoad()
10155                }
10156            }
10157        }
10158        o.mediacontainer = createElement("div");
10159        Pos0(o.mediacontainer);
10160        css(o.mediacontainer, {
10161            "transition": "transform 0.2s linear",
10162            "text-align": "center"
10163        });
10164        o.frame.appendChild(o.mediacontainer);
10165        if (v.hotkey.swiping == 1) {
10166            if (!o.mdswp) {
10167                PluginMovable(o.mediacontainer, 'o.swiping', v.hotkey.swipev != 1, v.hotkey.swipev == 1, Swiping);
10168                o.mdswp = true
10169            }
10170        }
10171        if (!wait) {
10172            Start()
10173        }
10174
10175        function Swiping() {
10176            var p = o.mediacontainer.offsetLeft;
10177            var p2 = o.screen_w;
10178            if (v.hotkey.swipev == 1) {
10179                p = o.mediacontainer.offsetTop;
10180                p2 = o.screen_h
10181            }
10182            var x;
10183            if (p > p2 * existv(v.hotkey.swipep, 0.5)) {
10184                if (o.controls.PlaylistPrevExist()) {
10185                    x = true;
10186                    o.controls.PlaylistPrev()
10187                }
10188            } else {
10189                if (p < -p2 * existv(v.hotkey.swipep, 0.5)) {
10190                    if (o.controls.PlaylistNextExist()) {
10191                        x = true;
10192                        o.controls.PlaylistNext()
10193                    }
10194                }
10195            }
10196            if (x) {
10197                if (v.hotkey.swipev == 1) {
10198                    css(o.mediacontainer, {
10199                        "top": 0
10200                    })
10201                } else {
10202                    css(o.mediacontainer, {
10203                        "left": 0
10204                    })
10205                }
10206            } else {
10207                new Motion({
10208                    mc: o.mediacontainer,
10209                    type: (v.hotkey.swipev == 1 ? "top" : "left"),
10210                    to: 0,
10211                    time: 0.1,
10212                    ease: "back",
10213                    me: "mdswp"
10214                })
10215            }
10216        }
10217
10218        function PlaylistLoad() {
10219            url = plurls[current_plurl];
10220            if (url.indexOf(o.pltxt) > 0) {
10221                url = url.replace(o.pltxt, '');
10222                v.file = url
10223            }
10224            var xhr = XHR(url);
10225            xhr.onload = function () {
10226                if (this.readyState == 4 && this.status == 200) {
10227                    Playlist(this);
10228                    o.controls.NewPl()
10229                } else {
10230                    PlaylistError(1)
10231                }
10232            };
10233            xhr.onerror = function (e) {
10234                PlaylistError(1)
10235            };
10236            xhr.send();
10237            wait = true
10238        }
10239
10240        function PlaylistError(x) {
10241            if (current_plurl + 1 < plurls.length) {
10242                current_plurl++;
10243                PlaylistLoad();
10244                x = 0
10245            }
10246            if (x == 1) {
10247                onError("playlist not found or access denied")
10248            }
10249            if (x == 2) {
10250                onError("playlists JSON")
10251            }
10252        }
10253
10254        function Playlist(x) {
10255            if (x.responseText) {
10256                var y = x.responseText;
10257                if (y.indexOf("#" + v.enc2) == 0) {
10258                    y = o[o.fd[0]](y)
10259                }
10260                if (y.indexOf("#" + v.enc3) == 0 && y.indexOf(v.file3_separator) > 0) {
10261                    y = o[o.fd[1]](y)
10262                }
10263                if (url.indexOf(".m3u") == url.length - 4) {
10264                    var m3u = y.split(/(\r\n\t|\n|\r\t)/gm);
10265                    url = [];
10266                    var m3ui = 1;
10267                    var m3ut = '';
10268                    for (var i = 0; i < m3u.length; i++) {
10269                        if (m3u[i].indexOf("#EXTINF") > -1) {
10270                            if (m3u[i].indexOf(" - ") > -1) {
10271                                var tmp = m3u[i].split(" - ");
10272                                m3ut = tmp[tmp.length - 1]
10273                            }
10274                        }
10275                        if (m3u[i].indexOf("http") > -1) {
10276                            url.push({
10277                                title: "" + (m3ut != '' ? m3ut : m3ui),
10278                                file: m3u[i]
10279                            });
10280                            m3ui++;
10281                            m3ut = ''
10282                        }
10283                    }
10284                } else {
10285                    y = y.replace(/(\r\n\t|\n|\r\t)/gm, "");
10286                    try {
10287                        url = JSON.parse(y)
10288                    } catch (e) {
10289                        PlaylistError(2)
10290                    }
10291                }
10292                if (o.controls) {
10293                    if (v.playlist.openplaylistbefore == 1) {
10294                        o.controls.PlaylistShow(2)
10295                    }
10296                }
10297                Start();
10298                MainResize();
10299                setTimeout(function () {
10300                    js("playlist")
10301                }, 1)
10302            }
10303        }
10304
10305        function Start(x) {
10306            url = o.actions.File(x ? x : url);
10307            url && url != '?' ? File(url) : '';
10308            o.play && x && !o.vast ? o.media.Play() : ''
10309        }
10310
10311        function onError(x, norld) {
10312            var y = true;
10313            var yy = true;
10314            js("loaderror", x);
10315            if (o.destroyed) {
10316                return
10317            }
10318            if (norld != 1 && v.reload == 1 && v.reloadfirst == 1) {
10319                ErrorReload();
10320                return
10321            }
10322            if (urls) {
10323                if (o.play || o.actplay || (v.autoplay == 1 && !o.start)) {
10324                    if (urls.length > 0) {
10325                        current_url++;
10326                        y = current_url > urls.length - 1;
10327                        if (y && urls.length > 1 && v.or0 > 0) {
10328                            if (o.or0 < v.or0) {
10329                                current_url = 0;
10330                                y = false
10331                            }
10332                            o.or0++
10333                        }
10334                        if (y && v.tryotherquality == 1) {
10335                            if (o.files.length > 1) {
10336                                if (o.files_quality[o.current_quality].indexOf(Lang("loading_error")) == -1) {
10337                                    o.files_quality[o.current_quality] = o.files_quality[o.current_quality] + ' (' + Lang("loading_error") + ')'
10338                                }
10339                                if (o.current_quality > 0) {
10340                                    yy = false;
10341                                    o.actions.SetQuality(o.current_quality - 1);
10342                                    FileTo()
10343                                } else {
10344                                    if (o.files_quality[o.current_quality + 1].indexOf(Lang("loading_error")) == -1) {
10345                                        yy = false;
10346                                        o.actions.SetQuality(o.current_quality + 1);
10347                                        FileTo()
10348                                    }
10349                                }
10350                            }
10351                        }
10352                        if (!y) {
10353                            var z = false;
10354                            o.seekto > 0 || !o.start || media.isLive() ? '' : o.seekto = Time();
10355                            if (o.file_type != FileType(urls[current_url]) || o.file_type != 'native') {
10356                                if (o.play) {
10357                                    o.actions.Stop(1);
10358                                    z = true
10359                                }
10360                            }
10361                            if (v.filerorto > 0) {
10362                                clearTimeout(o.errorto);
10363                                o.errorto = setTimeout(ErrorOr, v.filerorto * 1000)
10364                            } else {
10365                                ErrorOr()
10366                            }
10367                        } else {
10368                            if (v.reload == 1 && yy && v.reloadfirst != 1) {
10369                                y = false;
10370                                ErrorReload()
10371                            }
10372                        }
10373                    }
10374                } else {
10375                    y = false;
10376                    if (!o.start) {
10377                        ErrorOr()
10378                    }
10379                }
10380            }
10381            if (y && yy && x) {
10382                ErrorMsg(x, true)
10383            }
10384        };
10385
10386        function ErrorOr() {
10387            if (o.destroyed) {
10388                return
10389            }
10390            if (o.play || o.actplay || (v.autoplay == 1 && !o.start)) {
10391                log("Alternative source", o.seekto);
10392                File('or');
10393                o.start && !o.vast ? media.Play() : '';
10394                FileTo()
10395            } else {
10396                if (!o.start) {
10397                    if (urls.length > 0) {
10398                        if (current_url + 1 < urls.length) {
10399                            current_url++;
10400                            o.or0++;
10401                            File('or')
10402                        }
10403                    }
10404                } else {
10405                    clearTimeout(o.errorto);
10406                    o.errorto = setTimeout(ErrorOr, exist2(v.filerorto, 5) * 1000)
10407                }
10408            }
10409        }
10410
10411        function ErrorMsg(x, mr) {
10412            gaTracker("error", "Error", true);
10413            o.newplay = false;
10414            if (v.alerts == 1 && !o.media_error) {
10415                if (v.alert404 == 1) {
10416                    o.alert.txt(v.alert404text)
10417                } else {
10418                    o.alert.txt(x)
10419                }
10420                if (v.alert404v == 1 && exist(v.alert404video)) {
10421                    o.err404v = new PluginErrorVideo();
10422                    o.actions.HidePoster()
10423                }
10424            }
10425            mr ? o.media_error = true : '';
10426            if (o.play) {
10427                o.actions.StopWaiting();
10428                o.controls.Pause()
10429            }
10430            exist(o.poster) && !exist(o.err404v) ? o.actions.ShowPoster() : '';
10431            js("error", x)
10432        }
10433
10434        function ErrorReload() {
10435            rldcnt++;
10436            log("Error Reload Timeout " + rldcnt);
10437            o.play ? o.rldplay = 1 : '';
10438            exist(o.reloadto) ? clearTimeout(o.reloadto) : '';
10439            o.reloadto = setTimeout(ReloadTimeout, v.reloadtimeout * 1000)
10440        }
10441
10442        function ReloadTimeout() {
10443            var x = existv(v.reloadtimes, 10);
10444            if (o.play || o.rldplay == 1) {
10445                o.rldplay = 0;
10446                if (rldcnt < x) {
10447                    o.actions.Reload()
10448                } else {
10449                    if (v.reloadfirst == 1) {
10450                        onError(media.errorMessage(), 1)
10451                    } else {
10452                        ErrorMsg('Reload Error ' + media.errorMessage())
10453                    }
10454                }
10455            }
10456        }
10457        this.onError = function (x) {
10458            onError(x ? x : media.errorMessage())
10459        };
10460        this.onEnded = function (y) {
10461            log("Ended");
10462            _ended = true;
10463            clearTimeout(hlsend_to);
10464            var x = false;
10465            if (Duration() > 0 && !o.casting && !y) {
10466                var time = o.current_time;
10467                if (time + 10 < Duration()) {
10468                    log('Break (recovery)');
10469                    js("recovery");
10470                    media.Play();
10471                    media.Seek(time);
10472                    x = true
10473                }
10474            }
10475            if (!x) {
10476                o.actions.Ended()
10477            }
10478        };
10479        this.onPlay = function () {
10480            if (v.posterhidepause == 1) {
10481                exist(o.poster) ? o.actions.ShowPoster() : ''
10482            }
10483            v.posterhide == 1 ? o.actions.HidePoster() : '';
10484            o.controls.Play();
10485            o.actions.onPlayTag();
10486            if (v.tags == 1 && exist(v.tagsurl)) {
10487                if (v.tagsurl.length > 5) {
10488                    RadioTags();
10489                    clearInterval(_tags);
10490                    _tags = setInterval(RadioTags, v.tagsinterval * 1000)
10491                }
10492            }
10493            js("play")
10494        };
10495        this.NativeControls = function () {
10496            if (v.nativecontrolsmobile == 1 && o.tagvideo) {
10497                if (o.actions.NativeControls()) {
10498                    o.nativecontrols = media.nativeControls();
10499                    o.controls.refresh();
10500                    NativeSubtitle()
10501                }
10502            }
10503            o.checknative = true
10504        };
10505        this.onPause = function () {
10506            Time() > 0 && Time() == Duration() && o.actions.plNxtExst() ? '' : o.actions.Pause()
10507        };
10508        this.onSeeking = function () {
10509            log("Seeking")
10510        };
10511        this.onSeeked = function () {
10512            log("Seeked");
10513            o.actions.Seeked();
10514            exist(o.seeking_time) ? js("seek", o.seeking_time) : ''
10515        };
10516        this.onMeta = function () {
10517            log("Metadata");
10518            rldcnt = 0;
10519            o.actions.Metadata();
10520            o.file_type == "hls" ? StartSpeed(1) : ''
10521        };
10522        this.onDuration = function () {
10523            if (media) {
10524                log("Duration", Duration());
10525                o.actions.Duration(Time(), Duration());
10526                js("duration", Duration());
10527                rldcnt = 0;
10528                clearTimeout(o.reloadto);
10529                if (exist(o.restart_audio)) {
10530                    o.actions.SetAudioTrack(o.restart_audio);
10531                    o.restart_audio = null
10532                }
10533            }
10534        };
10535
10536        function Time() {
10537            var x = media.time();
10538            return x
10539        }
10540
10541        function Duration() {
10542            var x = media.duration();
10543            return x
10544        }
10545        this.onVolume = function () {};
10546        this.onWaiting = function () {
10547            log("Waiting");
10548            o.actions.Waiting();
10549            js("waiting")
10550        };
10551        this.onTimeupdate = function () {
10552            if (_lastime != Time()) {
10553                if (!o.curtain) {
10554                    o.actions.StopWaiting();
10555                    if (_lastime == 0) {
10556                        if (v.posterhide == 1 && v.posterhidestart == 1) {
10557                            o.actions.HidePoster()
10558                        }
10559                    }
10560                }
10561            }
10562            _lastime = Time();
10563            var dur = Duration();
10564            js("time", _lastime);
10565            if (v.pip.on == 1) {
10566                if (typeof (PluginPip) == 'function') {
10567                    !v.file2 && v.pip.file2 ? v.file2 = v.pip.file2 : '';
10568                    if (!media2 && v.pip.custom != 1 && v.file2 && v.file2 != '' && _lastime > 0) {
10569                        o.mediapip = new PluginPip();
10570                        media2 = o.mediapip.create()
10571                    }
10572                }
10573            }
10574            if (o.file_type == "hls" && o.system.safari && dur > 0) {
10575                if (o.play && _lastime > dur - 1) {
10576                    clearTimeout(hlsend_to);
10577                    hlsend_to = setTimeout(ChkHlsEnd, 2000)
10578                }
10579            }
10580        };
10581
10582        function ChkHlsEnd() {
10583            if (!_ended) {
10584                o.actions.Pause();
10585                o.media.onEnded()
10586            }
10587        }
10588        this.onYoutubeReady = function () {
10589            if (o.file_type == "youtube") {
10590                media ? media.YoutubeReady() : ''
10591            }
10592        };
10593        this.playByYoutubeId = function (x) {
10594            o.actions.Stop();
10595            media.playId(x)
10596        };
10597        this.pipVol = function (x) {
10598            if (exist(x)) {
10599                if (media2) {
10600                    media2.Volume(x)
10601                }
10602                v.pip.volume = x
10603            }
10604        };
10605        this.pipSrc = function (x) {
10606            if (exist(x)) {
10607                if (media2) {
10608                    media2.src(x);
10609                    media2.Play()
10610                }
10611            }
10612        };
10613        this.YoutubeReady = function () {
10614            if (o.file_type == "youtube" && media) {
10615                return media.ready()
10616            } else {
10617                return true
10618            }
10619        };
10620        this.getHLS = function () {
10621            return o.file_type == "hls" ? media.getHLS() : undefined
10622        };
10623        this.getDASH = function () {
10624            return media.getDASH()
10625        };
10626        this.SetQuality = function (x) {
10627            log("Quality", x);
10628            if ((o.file_type == "native" || o.file_type == o.ws || (o.file_type == "hls" && (v.hlsquality == 0 || HlsLevelsLength() < 2)) || (o.file_type == "dash" && (v.dashquality == 0 || DashLevelsLength() < 2))) && exist(o.files[x])) {
10629                var time = this.time();
10630                o.seekto > 0 ? '' : o.seekto = time;
10631                o.actions.Seek(time, false);
10632                File(o.files[x], true);
10633                var y = true;
10634                if (v.settings) {
10635                    if ((v.settings.qualitypause == 1 && !o.play) || !o.start) {
10636                        y = false
10637                    }
10638                }
10639                if (o.ncrtat > 0) {
10640                    media.nativeAudioTrack(o.ncrtat)
10641                }
10642                if (y) {
10643                    o.actions.Play()
10644                }
10645            }
10646            if (o.file_type == "hls" && v.hlsquality == 1 && HlsLevelsLength() > 1) {
10647                media.setHlsQuality(x)
10648            } else if (o.file_type == "dash" && v.dashquality == 1 && DashLevelsLength() > 1) {
10649                media.setDashQuality(x)
10650            } else if (o.file_type == "youtube" || o.file_type == "dm") {
10651                media.setQuality(x)
10652            }
10653        };
10654        this.renameQualities = function (x, y) {
10655            return RenameQualities(x, y)
10656        };
10657        this.renameTracks = function (x, y) {
10658            return RenameTracks(x, y)
10659        };
10660
10661        function RenameQualities(x, y) {
10662            var r = x.height + 'p';
10663            if (x.height < 200) {
10664                r = '160p'
10665            } else if (x.height >= 200 && x.height <= 300) {
10666                r = '240p'
10667            } else if (x.height > 300 && x.height <= 400) {
10668                r = '360p'
10669            } else if (x.height > 400 && x.height <= 500) {
10670                r = '480p'
10671            } else if (x.height > 500 && x.height <= 600) {
10672                r = '540p'
10673            } else if (x.height > 600 && x.height <= 900) {
10674                r = '720p'
10675            } else if (x.height > 900 && x.height <= 1150) {
10676                r = '1080p'
10677            } else if (x.height > 1150 && x.height <= 1550) {
10678                r = '1440p'
10679            } else if (x.height > 1550 && x.height <= 1800) {
10680                r = '1600p'
10681            } else if (x.height > 1800) {
10682                r = '2160p'
10683            }
10684            if (x.width == 426 && x.height <= 240) {
10685                r = '240p'
10686            } else if (x.width == 640 && x.height <= 360) {
10687                r = '360p'
10688            } else if (x.width == 854 && x.height <= 480) {
10689                r = '480p'
10690            } else if (x.width == 1280 && x.height <= 720) {
10691                r = '720p'
10692            } else if (x.width == 1920 && x.height <= 1080) {
10693                r = '1080p'
10694            } else if (x.width == 2560 && x.height <= 1440) {
10695                r = '1440p'
10696            } else if (x.width == 3840 && x.height <= 2160) {
10697                r = '2160p'
10698            }
10699            if (v.settings.customqualities == 1 && exist(v.settings['name' + r])) {
10700                r = v.settings['name' + r]
10701            } else {
10702                if (y == 1) {
10703                    r = Lang(r)
10704                }
10705                if (y == 2 && exist(x.bitrate)) {
10706                    r = parseInt(x.bitrate / 1000) + ' ' + Lang('kbps')
10707                }
10708            }
10709            return r
10710        };
10711
10712        function RenameTracks(x, y) {
10713            var r = x.toLowerCase();
10714            if (r == "eng" || r == "en") {
10715                x = "English"
10716            } else if (r == "rus" || r == "ru") {
10717                x = "Русский"
10718            }
10719            if (typeof (v.rename_audio) == "object") {
10720                if (exist(v.rename_audio[x])) {
10721                    x = v.rename_audio[x]
10722                } else {
10723                    x = existv(v.rename_audio[y.toString()], x)
10724                }
10725            }
10726            return x
10727        };
10728
10729        function NativeSubtitle() {
10730            if (o.tagvideo && o.subs && !o.nativesub) {
10731                media.removeTracks();
10732                for (var i = 0; i < o.subs.length; i++) {
10733                    if (o.subs[i] != 'all') {
10734                        media.addTrack(o.subs[i], o.files_subtitle[i], (i == o.current_subtitle))
10735                    }
10736                }
10737                o.nativesub = true
10738            }
10739        }
10740        this.SetSpeed = function (x) {
10741            log("Speed", x);
10742            x = parseFloat(x);
10743            media ? media.setSpeed(x) : '';
10744            if (v.pip.on == 1) {
10745                if (media2) {
10746                    media2.setSpeed(x)
10747                }
10748            }
10749        };
10750        this.nativeSubtitle = function () {
10751            NativeSubtitle()
10752        };
10753        this.removeNativeSubtitle = function () {
10754            media.removeTracks()
10755        };
10756        this.SetAudioTrack = function (x) {
10757            log("Audiotrack", x);
10758            if (o.audiotracks.length > 0) {
10759                if (o.audiotracks[x]) {
10760                    var time = this.time();
10761                    o.seekto > 0 ? '' : o.seekto = time;
10762                    o.actions.Seek(time, false);
10763                    File(o.audiotracks[x], true);
10764                    o.actions.Play()
10765                }
10766            } else {
10767                if (o.file_type == "hls" && v.hlsaudio == 1) {
10768                    media.setHlsAudioTrack(x)
10769                } else if (o.file_type == "dash" && v.dashaudio == 1) {
10770                    media.setDashAudioTrack(x)
10771                } else if (o.tagvideo) {
10772                    media.nativeAudioTrack(x)
10773                }
10774            }
10775        };
10776        this.getQuality = function () {
10777            var x = o.files_quality[o.current_quality];
10778            x == undefined ? x = '' : '';
10779            var y = autoQuality() && v.hlsautoquality == 1 && v.hlsquality == 1 && x != Lang("auto");
10780            return (y ? '' + Lang("auto") + ' ' : '') + x
10781        };
10782        this.getAudioTrack = function () {
10783            var x = o.files_audiotrack[o.current_audiotrack];
10784            x == undefined ? x = '' : '';
10785            return x
10786        };
10787        this.autoQuality = function () {
10788            return autoQuality()
10789        };
10790
10791        function autoQuality() {
10792            var x = false;
10793            if (media) {
10794                if (o.file_type == "youtube") {
10795                    x = media.auto()
10796                }
10797                if (o.file_type == "hls" && v.hlsquality == 1 && HlsLevelsLength() > 1 && v.hlsautoquality == 1) {
10798                    x = media.auto()
10799                }
10800                if (o.file_type == "dash" && v.dashquality == 1 && DashLevelsLength() > 1) {
10801                    x = media.auto()
10802                }
10803            }
10804            return x
10805        }
10806
10807        function HlsLevelsLength() {
10808            if (o.file_type == "hls") {
10809                return media.HlsLevelsLength()
10810            } else {
10811                return 0
10812            }
10813        }
10814
10815        function DashLevelsLength() {
10816            if (o.file_type == "dash") {
10817                return media.DashLevelsLength()
10818            } else {
10819                return 0
10820            }
10821        };
10822        this.ratio = function () {
10823            return o.tagvideo ? media.ratio() : o.aspect
10824        };
10825        this.resize = function (x) {
10826            if (media && (o.file_yv || exist(v.ratio))) {
10827                media.resize()
10828            }
10829            if (v.screenmarginbottom > 0) {
10830                css(o.mediacontainer, {
10831                    "height": (o.fullscreen ? "100%" : o.normal_h - v.screenmarginbottom)
10832                })
10833            }
10834            if (o.media2 && v.pip.movable == 1) {
10835                o.mediapip.resize()
10836            }
10837            if (v.poster_float == 1) {
10838                FloatPosterScale()
10839            }
10840            if (o.v360) {
10841                o.v360.resize()
10842            }
10843        };
10844        this.size = function () {
10845            return media ? media.size() : {}
10846        };
10847        this.iosfull = function () {
10848            media.iosfull()
10849        };
10850        this.reload = function () {
10851            log('reload');
10852            o.reloadTimer = 0;
10853            o.start ? v.autoplay = 1 : '';
10854            o.actions.Waiting();
10855            if (url && v.rldnornd != 1) {
10856                if (url.indexOf('(random)') == -1) {
10857                    url = url + (url.indexOf('?') == -1 ? '?' : '&') + 'rand=(random)'
10858                }
10859            }
10860            if (url) {
10861                if (o.tagvideo) {
10862                    media.src(url);
10863                    this.Play()
10864                } else {
10865                    File(url)
10866                }
10867            }
10868        };
10869        if (!exist(o.poster)) {
10870            CreatePoster()
10871        }
10872        if (exist(v.poster)) {
10873            if (v.poster != '') {
10874                Poster(v.poster, o.poster, v.poster_scale);
10875                if (v.posterhidepause == 1 && !o.start) {
10876                    hide(o.poster)
10877                }
10878            } else {
10879                v.poster = null
10880            }
10881        }
10882
10883        function Status() {
10884            _status = media ? media.status() : ''
10885        }
10886
10887        function ParseUrl(url) {
10888            urls = url.split(" or ");
10889            for (var i = 0; i < urls.length; i++) {
10890                if (urls[i].indexOf(" and ") > -1) {
10891                    urls_and = urls[i].split(" and ");
10892                    urls[i] = urls_and[random(0, urls_and.length - 1)]
10893                }
10894                if (exist(v.prefile) && urls[i].indexOf("//") == -1) {
10895                    urls[i] = v.prefile + urls[i]
10896                }
10897            }
10898            current_url = 0
10899        }
10900
10901        function Timer() {
10902            Status();
10903            if (_status == "playing" || o.casting) {
10904                o.actions.Playing()
10905            }
10906            if (_status != "") {
10907                o.actions.Loading()
10908            }
10909        }
10910
10911        function CreatePoster() {
10912            if (o.poster) {
10913                o.frame.removeChild(o.poster)
10914            }
10915            o.poster = createElement("div");
10916            css(o.poster, {
10917                "pointer-events": "none",
10918                "opacity": v.poster_a,
10919                transition: "opacity 0.5s"
10920            });
10921            if (v.poster_float == 1) {
10922                PluginFloatPoster()
10923            } else {
10924                css(o.poster, {
10925                    'position': 'absolute',
10926                    'left': 0,
10927                    'top': 0,
10928                    'width': '100%',
10929                    'height': '100%'
10930                })
10931            }
10932            o.frame.appendChild(o.poster)
10933        }
10934
10935        function File(x, y, crt) {
10936            clearTimeout(hlsend_to);
10937            v.file2_separator == '' ? v.file2_separator = ';' : '';
10938            if (x.indexOf('{') > -1 && x.indexOf('}') > -1 && x.indexOf(v.file2_separator) > -1) {
10939                var z = x.split(v.file2_separator);
10940                o.audiotracks = [];
10941                for (var i = 0; i < z.length; i++) {
10942                    o.files_audiotrack[i] = z[i].substr(z[i].indexOf("{") + 1, z[i].indexOf("}") - 1);
10943                    o.audiotracks[i] = z[i].substr(z[i].indexOf("}") + 1);
10944                    if (exist(v.default_audio)) {
10945                        if (v.default_audio == o.files_audiotrack[i]) {
10946                            o.current_audiotrack = i
10947                        }
10948                    }
10949                }
10950                x = o.audiotracks[o.current_audiotrack]
10951            }!exist(urls) ? urls = [] : '';
10952            o.fileTimeout ? clearTimeout(o.fileTimeout) : '';
10953            x && x != 'or' && x != 'x' ? ParseUrl(x) : '';
10954            var ft = o.file_type;
10955            if (urls.length > 0) {
10956                var fu = urls[current_url];
10957                if (fu) {
10958                    if (fu.indexOf('js:') == 0) {
10959                        try {
10960                            fu = eval(fu.substr(3))
10961                        } catch (e) {
10962                            console.log(e.message)
10963                        }
10964                    }
10965                }
10966                if (fu) {
10967                    o.file_type = FileType(fu);
10968                    var create = false;
10969                    if (crt) {
10970                        create = true
10971                    }
10972                    url = fu;
10973                    if (url) {
10974                        url = url.replace(/\(random\)/g, Math.random())
10975                    } else {
10976                        url = urls[0]
10977                    }
10978                    if (!create && x != 'x' && media && o.file_type == ft && (ft == "native" || (ft == "vimeo" && !o.system.mobile) || (ft == "youtube" && o.start && !_stopped) || ft == "dm" || ft == "hls" || ft == "dash")) {
10979                        media.src(url);
10980                        log("src")
10981                    } else {
10982                        log("New");
10983                        RemoveMedia();
10984                        CreateMedia(url)
10985                    }
10986                    StartSpeed()
10987                }
10988            }
10989            if (!y) {
10990                clearInterval(o.timerInterval);
10991                o.timerInterval = setInterval(Timer, o.timerTime);
10992                if (!exist(v.subtitle) && v.sub_upload == 1 && v.sub_upload0 == 1) {
10993                    v.subtitle = ''
10994                }
10995                if (exist(v.subtitle)) {
10996                    o.actions.Subtitle(v.subtitle)
10997                }
10998                if (v.hidevideo == 1) {
10999                    if (v.nativecontrolsmobile == 1 && o.system.mobile) {} else {
11000                        if (o.file_type == "youtube") {
11001                            css(o.mediacontainer, {
11002                                "top": -3000,
11003                                "left": -3000
11004                            })
11005                        } else {
11006                            hide2(o.mediacontainer)
11007                        }
11008                        v.toolbar.hide = 0
11009                    }
11010                }
11011            }
11012        }
11013
11014        function StartSpeed(x) {
11015            if (o.speed1 || x) {
11016                if (o.line_speed) {
11017                    media.setSpeed(o.custom_speed)
11018                } else {
11019                    if (o.current_speed != o.speed1) {
11020                        media.setSpeed(o.files_speed[o.current_speed])
11021                    }
11022                }
11023            }
11024        }
11025
11026        function FileType(x) {
11027            var type = "native";
11028            if (x) {
11029                if (x.indexOf(".m3u8") > 0) {
11030                    type = "hls"
11031                } else if (x.indexOf(".mpd") > 0) {
11032                    type = "dash"
11033                } else if (x.indexOf("w") == 0 && x.indexOf("s") == 1) {
11034                    type = o.ws
11035                } else if (x.indexOf('youtube.com/') > -1 || x.indexOf('youtu.be/') > -1) {
11036                    if (typeof (MediaYoutube) == 'function') {
11037                        type = "youtube";
11038                        if (v.youtubeposter == 1) {
11039                            var y = 'https://img.youtube.com/vi/' + YoutubeID(x) + '/';
11040                            imageExists(y + 'maxresdefault.jpg', function (z) {
11041                                z > 100 ? v.poster = y + 'maxresdefault.jpg' : v.poster = y + 'hqdefault.jpg';
11042                                if (o.playlist_dic) {
11043                                    o.playlist_dic[o.plid]['poster'] = v.poster
11044                                }
11045                                v.autoplay == 1 || o.start ? '' : Poster(v.poster, o.poster, v.poster_scale)
11046                            })
11047                        }
11048                    } else {
11049                        log("No YouTube")
11050                    }
11051                } else if (v.vimeo == 1 && x.indexOf('vimeo.com/') > -1) {
11052                    type = "vimeo"
11053                } else if (v.dm == 1 && x.indexOf('dailymotion.com') > -1) {
11054                    type = "dm"
11055                } else if (v.pjsframe == 1) {
11056                    if (typeof (PjsFramed) == 'function') {
11057                        PjsFramed(x) ? type = "pjs" : ''
11058                    }
11059                }
11060            }
11061            o.file_yv = type == "youtube" || type == "vimeo" || type == "dm";
11062            o.tagvideo = type == "native" || type == "hls" || type == "dash" || type == o.ws;
11063            return type
11064        }
11065
11066        function imageExists(url, callback) {
11067            var img = new Image();
11068            img.onload = function () {
11069                callback(this.height)
11070            };
11071            img.src = url
11072        }
11073
11074        function CreateMedia(x) {
11075            o.file_type = FileType(x);
11076            if (o.tagvideo) {
11077                media = new MediaVideo(x, o.mediacontainer, false)
11078            }
11079            if (o.file_yv) {
11080                media = eval("new Media" + o.file_type[0].toUpperCase() + o.file_type.slice(1) + "(x,o.mediacontainer);")
11081            }
11082            if (o.file_type == "pjs") {
11083                media = new MediaPjs(x)
11084            }
11085            o.controls ? o.controls.UpdateSettings() : '';
11086            var t = 0;
11087            if (exist(v.duration)) {
11088                if (o.continue && v.timestore == 1 && !o.start) {
11089                    t = o.continue.flag().t
11090                }
11091                setTimeout(function () {
11092                    o.actions.Duration(t, v.duration)
11093                }, 100)
11094            }
11095        }
11096
11097        function RemoveMedia() {
11098            if (media) {
11099                media.Remove();
11100                media = null;
11101                _status = "ended"
11102            }
11103            if (media2) {
11104                media2.Remove();
11105                media2 = null;
11106                media2 = undefined;
11107                o.mediapip.remove();
11108                o.media2 = null;
11109                o.mediapip = null
11110            }
11111        };
11112        this.Remove = function () {
11113            RemoveMedia()
11114        };
11115        this.RemoveAll = function () {
11116            urls = [];
11117            RemoveMedia()
11118        };
11119        this.File = function (x, y, z) {
11120            File(x, y, z)
11121        };
11122        this.Poster = function (x) {
11123            Poster(x, o.poster, v.poster_scale)
11124        };
11125        this.Play = function () {
11126            if (media) {
11127                _ended = false;
11128                _stopped = false;
11129                if (o.casting) {
11130                    o.chromecast.Play()
11131                } else {
11132                    media.Play();
11133                    v.posterhide == 1 ? o.actions.HidePoster() : ''
11134                }
11135                if (exist(media2)) {
11136                    media2.Play()
11137                }
11138                if (o.channels) {
11139                    if (o.tagvideo) {
11140                        if (o.clicktime > 0 && !o.channels.Created()) {
11141                            o.channels.Update()
11142                        }
11143                    } else {
11144                        o.files_channel = [];
11145                        o.controls.SettingChanged("channel")
11146                    }
11147                }
11148                if (o.tagvideo && v.volumegain > -1 && !o.gained && !o.system.ios) {
11149                    if (o.clicktime > 0) {
11150                        media.Gain()
11151                    }
11152                }
11153                FileTo()
11154            } else {
11155                setTimeout(this.Play, 500)
11156            }
11157        };
11158
11159        function FileTo() {
11160            if (v.fileto > 0 && urls.length > 1) {
11161                if (Duration() == 0 || v.filetod == 1) {
11162                    clearTimeout(o.fileTimeout);
11163                    o.fileTimeout = setTimeout(FileTimeout, v.fileto * 1000)
11164                }
11165            }
11166        }
11167
11168        function FileTimeout() {
11169            if (o.play && (Duration() == 0 || v.filetod == 1) && Time() == 0 && !o.errorto) {
11170                if (media) {
11171                    if (media.loaded() == 0 && current_url != urls.length - 1) {
11172                        onError('File Timeout')
11173                    }
11174                }
11175            }
11176        }
11177        this.PipSwitch = function (event) {
11178            if (o.media2) {
11179                if (v.pip.movable == 1) {
11180                    if (o.moving[o.media2] > 2) {
11181                        return
11182                    }
11183                }
11184                if (event) {
11185                    event.stopPropagation();
11186                    window.event ? window.event.cancelBubble = true : ''
11187                }
11188                var tmp = media;
11189                media.ChangePip(true, o.media2);
11190                media2.ChangePip(false, o.mediacontainer);
11191                media = media2;
11192                media2 = tmp;
11193                media.Play();
11194                media2.Play();
11195                js("pip")
11196            }
11197        };
11198        this.reYT = function () {
11199            media.src(url)
11200        };
11201        this.ToolbarHide = function () {
11202            v.effects == 1 ? o.effects.api("hide") : '';
11203            o.toolbarhidden = true
11204        };
11205        this.ToolbarShow = function () {
11206            if (v.toolbar.resizeme) {
11207                v.toolbar.resizeme = false;
11208                if (o.controls) {
11209                    o.controls.resizeFromText(1);
11210                    o.controls.resizetext()
11211                }
11212            }
11213            o.toolbarhidden = false
11214        };
11215        this.PipToggle = function () {
11216            if (o.media2 && o.mediapip) {
11217                o.mediapip.toggle()
11218            }
11219        };
11220        this.Airplay = function () {
11221            if (o.tagvideo && o.airplay) {
11222                o.airplayed = true;
11223                media.airplay()
11224            }
11225        };
11226        this.PipWebkit = function () {
11227            if (o.tagvideo && o.pipwebkit) {
11228                media.pipwebkit()
11229            }
11230        };
11231        this.BeforeVast = function () {
11232            if (v.vast_poster == 1 && exist(v.vast_posterurl)) {
11233                if (exist(o.vast_poster)) {
11234                    o.vast_poster.show()
11235                } else {
11236                    if (typeof (PlgnVstPstr) == 'function') {
11237                        o.vast_poster = new PlgnVstPstr()
11238                    }
11239                }
11240            }
11241            VstLdTxt();
11242            if (media) {
11243                datetime(0);
11244                media.BeforeVast()
11245            }
11246        };
11247        this.AfterVast = function () {
11248            o.vast_poster ? o.vast_poster.hide() : '';
11249            media ? media.AfterVast() : ''
11250        };
11251        this.VstLdTxt = function (x) {
11252            VstLdTxt(x)
11253        };
11254
11255        function VstLdTxt(x) {
11256            if (v.vast_loadtxtd == 1 && exist2(v.vast_loadtxt)) {
11257                if (exist(o.vast_loadtxt)) {
11258                    o.vast_loadtxt.show(x)
11259                } else {
11260                    if (typeof (PlgnVstLdtx) == 'function') {
11261                        o.vast_loadtxt = new PlgnVstLdtx()
11262                    }
11263                }
11264            }
11265        }
11266        this.Pause = function () {
11267            if (o.casting) {
11268                o.chromecast.Pause()
11269            } else {
11270                media ? media.Pause() : log("nomedia")
11271            }
11272            if (exist(o.media2)) {
11273                media2.Pause()
11274            }
11275        };
11276        this.Recover = function () {
11277            _stopped = true;
11278            o.actions.Seek(0, false);
11279            exist(o.poster) ? o.actions.ShowPoster() : '';
11280            File('x')
11281        };
11282        this.Toggle = function () {
11283            media ? media.Toggle() : ''
11284        };
11285        this.Seek = function (x) {
11286            if (media) {
11287                if (o.casting) {
11288                    o.chromecast.Seek(x)
11289                } else {
11290                    media.Seek(x);
11291                    if (v.pip.on == 1) {
11292                        if (media2) {
11293                            media2.Seek(x)
11294                        }
11295                    }
11296                }
11297            }
11298        };
11299        this.Mute = function () {
11300            if (media) {
11301                media.Mute();
11302                o.casting ? o.chromecast.Mute() : '';
11303                log("mute")
11304            }
11305            if (v.pip.on == 1 && v.pip.nomute == 1) {
11306                if (media2) {
11307                    media2.Mute()
11308                }
11309            }
11310        };
11311        this.Unmute = function () {
11312            if (media) {
11313                media.Unmute();
11314                o.casting ? o.chromecast.Unmute() : '';
11315                log("unmute")
11316            }
11317            if (v.pip.on == 1 && v.pip.nomute == 1) {
11318                if (media2) {
11319                    media2.Unmute()
11320                }
11321            }
11322        };
11323        this.Volume = function (x) {
11324            media ? media.Volume(x) : '';
11325            if (v.pip.on == 1) {
11326                if (v.pip.nomute == 1 && media2 && !o.line_volume2) {
11327                    media2.Volume(x)
11328                }
11329            }
11330            if (o.casting) {
11331                o.chromecast.Volume(x)
11332            }
11333        };
11334        this.isPlaying = function () {
11335            return media ? media.isPlaying() : false
11336        };
11337        this.isLive = function () {
11338            return media ? media.isLive() : false
11339        };
11340        this.status = function () {
11341            return _status
11342        };
11343        this.ended = function () {
11344            return _ended
11345        };
11346        this.time = function () {
11347            var x = 0;
11348            if (media) {
11349                x = Time();
11350                if (o.casting) {
11351                    var y = o.chromecast.Time();
11352                    y ? x = y : ''
11353                } else {
11354                    if (Duration() > 0 && x != Duration()) {
11355                        o.current_time = x + 0.0001
11356                    }
11357                }
11358                return x
11359            } else {
11360                return 0
11361            }
11362        };
11363        this.duration = function () {
11364            var x = 0;
11365            if (media) {
11366                x = Duration();
11367                x == 0 && exist(v.duration) ? x = v.duration * 1 : '';
11368                if (o.casting) {
11369                    var y = o.chromecast.Duration();
11370                    y ? x = y : ''
11371                }
11372            }
11373            return x
11374        };
11375        this.loaded = function () {
11376            return media ? media.loaded() : 0
11377        };
11378        this.flip = function () {
11379            o.mediascale.flip = o.mediascale.flip ? false : true;
11380            css(o.mediacontainer, {
11381                "transform": (o.mediascale.flip ? "scaleX(-1)" : "scaleX(1)")
11382            })
11383        };
11384        this.createposter = function () {
11385            CreatePoster()
11386        };
11387        this.Preload = function () {
11388            if (o.tagvideo) {
11389                media.preload()
11390            }
11391        };
11392        this.menufltr = function (x, y) {
11393            if (x == 'scale') {
11394                if (y == 1) {
11395                    Scale(v.settings.scale / 100)
11396                }
11397                if (y == 2) {
11398                    Scale(-v.settings.scale / 100)
11399                }
11400                if (y == 3) {
11401                    o.media.normalscale()
11402                }
11403            } else {
11404                if (o.tagvideo) {
11405                    if (!o.fltrs[x]) {
11406                        if (x == 'sepia') {
11407                            o.fltrs[x] = 0
11408                        } else {
11409                            o.fltrs[x] = 1
11410                        }
11411                    }
11412                    if (y == 1) {
11413                        o.fltrs[x] += v.settings[x] / 100
11414                    }
11415                    if (y == 2) {
11416                        o.fltrs[x] -= v.settings[x] / 100
11417                    }
11418                    if (y == 3) {
11419                        if (x == 'sepia') {
11420                            o.fltrs[x] = 0
11421                        } else {
11422                            o.fltrs[x] = 1
11423                        }
11424                    }!o.cftlr ? o.cftlr = [] : '';
11425                    o.cftlr[x] = x + '(' + parseInt(o.fltrs[x] * 100) + '%) ';
11426                    var cf = '';
11427                    for (var i in o.cftlr) {
11428                        cf += o.cftlr[i]
11429                    }
11430                    css(media.tag(), {
11431                        'filter': cf
11432                    });
11433                    o.controls.MenuProc(x)
11434                }
11435            }
11436        };
11437        this.scale = function (x) {
11438            Scale(x)
11439        };
11440
11441        function Scale(x) {
11442            if (String(x).indexOf(":") > 0) {
11443                var y = x.split(":");
11444                var z0 = o.screen_w / o.screen_h;
11445                var z1 = o.media.size();
11446                if (z1.width > 0) {
11447                    z0 = z1.width / z1.height
11448                }
11449                var z = y[0] / y[1];
11450                if (z0 != z) {
11451                    if (o.tagvideo) {
11452                        media.ObjectFit()
11453                    }
11454                    var w2 = o.screen_h * z;
11455                    var x2 = w2 / o.screen_w;
11456                    var h2 = o.screen_w / z;
11457                    var y2 = h2 / o.screen_h;
11458                    if (x2 < 1) {
11459                        o.mediascale.x0 = o.mediascale.x = parseFloat(x2);
11460                        o.mediascale.y = 1
11461                    } else {
11462                        o.mediascale.x = 1;
11463                        o.mediascale.y0 = o.mediascale.y = parseFloat(y2)
11464                    }
11465                    css(o.mediacontainer, {
11466                        "transform": "scaleX(" + o.mediascale.x + ") scaleY(" + o.mediascale.y + ")"
11467                    });
11468                    o.custom_aspect = x
11469                }
11470            } else {
11471                o.mediascale.x += parseFloat(x);
11472                o.mediascale.y += parseFloat(x);
11473                css(o.mediacontainer, {
11474                    "transform": "scaleX(" + o.mediascale.x + ") scaleY(" + o.mediascale.y + ")"
11475                })
11476            }
11477            if (v.hotkey.scaledrag == 1) {
11478                if (!o.mediadrag) {
11479                    if (o.mediascale.x > 0 || o.mediascale.y > 1) {
11480                        PluginMovable(o.mediacontainer, 'o.dragging');
11481                        o.mediadrag = true
11482                    }
11483                }
11484                xy00()
11485            }
11486            o.controls.MenuProc('scale')
11487        };
11488        this.normalscale = function () {
11489            if (o.tagvideo) {
11490                media.ObjectFit()
11491            }
11492            o.mediascale.x = o.mediascale.x0;
11493            o.mediascale.y = o.mediascale.y0;
11494            css(o.mediacontainer, {
11495                "transform": "scaleX(" + o.mediascale.x + ") scaleY(" + o.mediascale.y + ")"
11496            });
11497            o.controls.MenuProc('scale');
11498            o.custom_aspect = null;
11499            xy00()
11500        };
11501
11502        function xy00() {
11503            if (o.mediadrag && v.hotkey.scaledrag0 != 1) {
11504                if (o.mediascale.x == 1 && o.mediascale.y == 1) {
11505                    css(o.mediacontainer, {
11506                        "top": 0,
11507                        "left": 0
11508                    })
11509                }
11510            }
11511        };
11512        this.hlsDashSub = function (x, y) {
11513            media.hlsDashSub(x, y)
11514        };
11515        this.currentFile = function () {
11516            return currentFile()
11517        };
11518
11519        function currentFile() {
11520            return urls ? (urls.length > 0 ? (urls[current_url] ? urls[current_url] : '') : '') : ''
11521        };
11522        this.urlsl = function () {
11523            return urls.length
11524        };
11525        this.tag = function () {
11526            return media ? media.tag() : false
11527        };
11528        this.captions = function () {
11529            if (o.tagvideo) {
11530                media.captions()
11531            }
11532        };
11533        this.onDash = function () {
11534            media.onDash()
11535        };
11536
11537        function RadioTags() {
11538            var xhr = XHR(v.tagsurl + '?url=' + urls[current_url]);
11539            xhr.onload = function () {
11540                if (this.readyState == 4 && this.status == 200) {
11541                    if (this.responseText) {
11542                        v.title = this.responseText;
11543                        o.actions.Title('title')
11544                    }
11545                }
11546            };
11547            xhr.send()
11548        }
11549    };
11550    var MediaVideo = function (url, container, pip) {
11551        var pjstg = createElement(v.hidevideo == 1 ? "audio" : "video");
11552        var hls_config;
11553        var pipto = 0;
11554        var hls;
11555        var is_hls = false;
11556        var is_hls2 = false;
11557        var hls_started = false;
11558        var hls_created = false;
11559        var hls_force = -1;
11560        var hlscq = -1;
11561        var dash;
11562        var dash_created = false;
11563        var ws;
11564        var ws_created = false;
11565        var is_dash = false;
11566        o.live = false;
11567        var is_sleep = 0;
11568        var is_ws = false;
11569        var error;
11570        var error_time;
11571        var unmuteplease = false;
11572        var pip_quality = -1;
11573        var pause_before_vast = -1;
11574        var sleep_timeout;
11575        var _hlssubtracks;
11576        var hls_subs;
11577        var _seekaftervast;
11578        var urlmse;
11579        var mimeCodec = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"';
11580        var nops = false;
11581        css(pjstg, {
11582            'position': 'static',
11583            'width': '100%',
11584            'height': '100%',
11585            'object-fit': 'contain',
11586            'transition': "filter 0.2s linear",
11587            'min-height': 'auto',
11588            'max-height': 'none',
11589            'min-width': 'auto',
11590            'max-width': 'none'
11591        });
11592        ObjectFit();
11593        if (o.system.iphone && v.autoplay == 1 && v.autoplaymute == 1) {
11594            if (!o.start && v.preroll) {
11595                attr(pjstg, {
11596                    'playsinline': 1
11597                })
11598            } else {
11599                o.muted = true;
11600                o.controls ? o.controls.Mute() : '';
11601                attr(pjstg, {
11602                    'muted': 1,
11603                    'playsinline': 1,
11604                    'autoplay': 1
11605                })
11606            }
11607        } else {
11608            if (v.playsinlineonmobile == 1 && o.system.mobile) {
11609                if (v.playsinlineonmobileiphone != 1 && o.system.iphone && v.vast != 1) {} else {
11610                    attr(pjstg, {
11611                        'playsinline': 1
11612                    })
11613                }
11614            }
11615            if (!o.system.tv) {
11616                attr(pjstg, {
11617                    'preload': (v.preload == 1 ? 'metadata' : 'none')
11618                })
11619            }
11620        }
11621        if (v.tagcors == 1) {
11622            attr(pjstg, {
11623                "crossorigin": "anonymous",
11624                "crossOrigin": "anonymous"
11625            })
11626        }
11627        url = casturl(url);
11628        attr(pjstg, {
11629            'src': url,
11630            'x-webkit-airplay': 'allow',
11631            'disableRemotePlayback': 'true'
11632        });
11633        if (v.drunchr != 1) {
11634            attr(pjstg, {
11635                'disableRemotePlayback': 'true'
11636            })
11637        }
11638        if (v.ynxnopip == 1) {
11639            attr(pjstg, {
11640                'pip': 'false'
11641            })
11642        }
11643        if (pip) {
11644            pjstg.autoplay = true;
11645            if (v.pip.nomute != 1 || v.autoplay == 1) {
11646                pjstg.muted = true
11647            } else {
11648                pjstg.volume = exist2(v.pip.volume) ? v.pip.volume : v.volume
11649            }
11650        }
11651        if (v.nativenodownload == 1) {
11652            attr(pjstg, {
11653                'controlsList': 'nodownload'
11654            })
11655        }
11656        tagSrc();
11657        if (v.taginframe == 1) {
11658            var tagframe = createElement("iframe");
11659            attr(tagframe, {
11660                "scrolling": "no",
11661                "allowfullscreen": "true",
11662                "allowtransparency": "true",
11663                "src": ""
11664            });
11665            css(tagframe, {
11666                "position": "absolute",
11667                "width": "100%",
11668                "height": "100%",
11669                "border": 0
11670            });
11671            container.appendChild(tagframe);
11672            var framei = window.setInterval(function () {
11673                if (tagframe.contentWindow.document.readyState === "complete") {
11674                    window.clearInterval(framei);
11675                    css(tagframe.contentDocument.body, {
11676                        "padding": 0,
11677                        "margin": 0
11678                    });
11679                    tagframe.contentDocument.body.appendChild(pjstg)
11680                }
11681            }, 100)
11682        } else {
11683            container.appendChild(pjstg)
11684        }
11685        if (!exist(url)) {
11686            url = ''
11687        }
11688        var nohls = false;
11689        if (o.system.tv) {
11690            if (url.indexOf("nativehlstv") > 0) {
11691                nohls = true
11692            }
11693        }
11694        if (o.system.safari) {
11695            if (url.indexOf("nativehlssafari") > 0 || (v.hlsdrmfp == 1 && v.hlsdrm == 1)) {
11696                nohls = true
11697            }
11698        }
11699        if (url.indexOf(".mpd") > 0) {
11700            is_dash = true;
11701            if (!o.dash) {
11702                if (typeof PluginDash !== "undefined") {
11703                    o.dash = new PluginDash()
11704                } else {
11705                    is_dash = false
11706                }
11707            }
11708            if (exist(o.dash)) {
11709                if (!exist(window.dashjs)) {
11710                    o.dash.script()
11711                } else {
11712                    CheckDash()
11713                }
11714            }
11715        } else if (((options.hls == 1 && v.playerjscom != 1) || url.indexOf(".m3u8") > 0) && !nohls && (o.compilation.indexOf("HLS") != -1 || exist(window.Hls))) {
11716            is_hls = true;
11717            is_hls2 = true;
11718            try {
11719                if (exist(window.Hls)) {
11720                    if (!Hls.isSupported() || (o.system.safari && v.nativehlsinsafari == 1 && !o.system.ios) || (o.system.safari && o.system.ios && v.nativehlsios == 1) || (o.system.edge && v.nativehlsinedge == 1)) {
11721                        log('HLS support ', Hls.isSupported());
11722                        is_hls = false
11723                    } else {
11724                        if (v.preload == 1 || v.autoplay == 1 || v.preloadhls == 1 || pip) {
11725                            CreateHLS(false)
11726                        }
11727                    }
11728                } else {
11729                    is_hls = false
11730                }
11731            } catch (error) {
11732                is_hls = false
11733            }
11734        } else if (url.indexOf("w") == 0 && url.indexOf("s") == 1 && v.flussonic == 1) {
11735            is_ws = true;
11736            CreateWS()
11737        }
11738        if (o.system.tv && v.autoplay == 1 && !is_hls && !is_dash && !is_ws) {
11739            setTimeout(function () {
11740                o.actions.MediaReady()
11741            }, 100)
11742        }
11743        if (v.channels == 1) {
11744            exist(o.channels) ? o.channels.Close() : '';
11745            o.channels = new PlugMediaChannels()
11746        };
11747        this.onDash = function () {
11748            CheckDash()
11749        };
11750
11751        function CheckDash() {
11752            is_dash = true;
11753            if (MseIsSupported()) {
11754                if (v.preload == 1 || v.autoplay == 1 || v.preloaddash == 1) {
11755                    CreateDASH(false)
11756                }
11757            } else {
11758                is_dash = false;
11759                log("DASH not supported")
11760            }
11761        }
11762
11763        function CreateDASH(x) {
11764            if (o.dash && !dash_created) {
11765                o.dash.create(x, pjstg, url, pip);
11766                exist(window.dashjs) ? dash_created = true : ''
11767            }
11768        }
11769
11770        function CreateHLS(x) {
11771            log("HLS");
11772            if (o.files.length > 1) {
11773                v.hlsquality = 0;
11774                v.hlsquality_off = true
11775            } else {
11776                v.hlsquality_off ? v.hlsquality = 1 : ''
11777            }
11778            if (o.audiotracks.length > 1) {
11779                v.hlsaudio = 0;
11780                v.hlsaudio_off = true
11781            } else {
11782                v.hlsaudio_off ? v.hlsaudio = 1 : ''
11783            }
11784            o.hls_subs = false;
11785            hls_force = -1;
11786            hls_subs = [];
11787            o.sbt ? o.sbt.reHls() : '';
11788            var dontload = false;
11789            if (v.preroll && v.hlsvastwait == 1) {
11790                dontload = true;
11791                v.hlsvastwait = 0
11792            }
11793            hls_config = {
11794                debug: (v.hlsdebug == 1 && !pip),
11795                autoStartLoad: (v.preload == 1 || v.autoplay == 1 || pip || x) && !dontload,
11796                maxBufferLength: 60,
11797                maxMaxBufferLength: 60,
11798                enableWorker: false
11799            };
11800            if (v.hlsmto > 0) {
11801                hls_config.manifestLoadPolicy = {
11802                    default: {
11803                        maxLoadTimeMs: v.hlsmto * 1000
11804                    }
11805                }
11806            }
11807            if (v.hlsfto > 0) {
11808                hls_config.fragLoadPolicy = {
11809                    default: {
11810                        maxLoadTimeMs: v.hlsfto * 1000
11811                    }
11812                }
11813            }
11814            if (v.hlscltps == 1) {
11815                hls_config.capLevelToPlayerSize = true
11816            }
11817            if (v.hlsdrm == 1) {
11818                var ks = ['wv', 'pr', 'ck'];
11819                var ksu = ['com.widevine.alpha', 'com.microsoft.playready', 'org.w3.clearkey'];
11820                var dj = {};
11821                for (var i = 0; i < ks.length; i++) {
11822                    if (v['hlsdrm' + ks[i]] == 1) {
11823                        dj[ksu[i]] = {};
11824                        if (exist2(v['hlsdrm' + ks[i] + 'l'])) {
11825                            dj[ksu[i]].licenseUrl = DrmVars(v['hlsdrm' + ks[i] + 'l'])
11826                        }
11827                        if (exist2(v['hlsdrm' + ks[i] + 's'])) {
11828                            dj[ksu[i]].serverCertificateUrl = DrmVars(v['hlsdrm' + ks[i] + 's'])
11829                        }
11830                    }
11831                }
11832                hls_config.emeEnabled = true;
11833                hls_config.drmSystems = dj
11834            }
11835            if (v.hlscookies == 1) {
11836                hls_config['xhrSetup'] = function (xhr, url) {
11837                    xhr.withCredentials = true
11838                }
11839            }
11840            if (exist(v.hlsconfig)) {
11841                if (exist(v.hlsconfig.maxBufferLength)) {
11842                    if (v.hlsconfig.maxBufferLength > 600) {
11843                        v.hlsconfig.maxBufferLength = 600
11844                    }
11845                    v.hlsconfig.maxMaxBufferLength = v.hlsconfig.maxBufferLength
11846                }
11847                if (exist(v.hlsconfig.customBuffer)) {
11848                    v.hlsconfig.maxMaxBufferLength = v.hlsconfig.maxBufferLength = v.hlsconfig.customBuffer
11849                }
11850                if (typeof v.hlsconfig == "object") {
11851                    for (var key in v.hlsconfig) {
11852                        if (v.hlsconfig[key].toString().indexOf('eval:') == 0) {
11853                            v.hlsconfig[key] = eval(v.hlsconfig[key].substr(5))
11854                        }
11855                        hls_config[key] = v.hlsconfig[key]
11856                    }
11857                }
11858            }
11859            js("prehls", hls);
11860            hls = new Hls(hls_config);
11861            js("hls", hls, 1);
11862            hls.loadSource(url);
11863            hls.attachMedia(pjstg);
11864            hls.on(Hls.Events.MEDIA_ATTACHED, function () {
11865                log("HLS attached")
11866            });
11867            hls.on(Hls.Events.MANIFEST_LOADED, function (event, data) {
11868                !pip ? o.actions.MediaReady() : ''
11869            });
11870            hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
11871                if (!pip && v.hlsquality == 1 && HlsLevelsLength() > 1) {
11872                    HlsQualityLevels();
11873                    HlsLevel();
11874                    o.controls ? o.controls.QualityChangedNoHand(o.current_quality) : ''
11875                }
11876            });
11877            hls.on(Hls.Events.LEVEL_SWITCH, function (event, data) {
11878                HlsLevel()
11879            });
11880            hls.on(Hls.Events.LEVEL_SWITCHED, function (event, data) {
11881                HlsLevel()
11882            });
11883            hls.on(Hls.Events.LEVEL_LOADED, function (event, data) {
11884                if (!pip) {
11885                    if (data.details.live != o.live) {
11886                        o.live = data.details.live;
11887                        o.controls.refresh()
11888                    }
11889                    o.live = data.details.live;
11890                    if (o.live) {
11891                        log("Live");
11892                        o.dvr = url.indexOf("?DVR") > -1;
11893                        if (pjstg.duration > 0 && pjstg.currentTime > 0) {
11894                            if (pjstg.duration - pjstg.currentTime < 10) {
11895                                if (o.hls_stuck_time > 0) {
11896                                    if (o.hls_stuck_time == pjstg.currentTime && o.hls_stuck_duration == pjstg.duration) {
11897                                        o.stuck++;
11898                                        if (o.stuck > 2) {
11899                                            o.stuck = 0;
11900                                            o.hls_stuck_time = -1;
11901                                            hls.destroy();
11902                                            CreateHLS(true);
11903                                            onEnded()
11904                                        }
11905                                    } else {
11906                                        o.hls_stuck_time = -1
11907                                    }
11908                                } else {
11909                                    o.hls_stuck_time = pjstg.currentTime;
11910                                    o.hls_stuck_duration = pjstg.duration
11911                                }
11912                            }
11913                        }
11914                    }
11915                }
11916                if (v.hlsquality == 1) {
11917                    o.current_quality = hls.loadLevel;
11918                    o.controls ? o.controls.QualityChangedNoHand(o.current_quality) : ''
11919                }
11920                HlsUpdateAudio()
11921            });
11922            hls.on(Hls.Events.FRAG_CHANGED, function (event, data) {
11923                if (exist(data.frag)) {
11924                    !pip ? js("fragment", data.frag.relurl) : '';
11925                    if (v.hlsfdt == 1) {
11926                        typeof PlgHlsFdt !== "undefined" ? PlgHlsFdt(data.frag) : ''
11927                    }
11928                }
11929                if (hls_force > -1) {
11930                    hls.nextAutoLevel = hls_force;
11931                    hls_force = -1
11932                }
11933                hls_started = true;
11934                hlsTextTracks()
11935            });
11936            hls.on(Hls.Events.FRAG_PARSING_METADATA, function (event, data) {
11937                js("fragdata", data, 1)
11938            });
11939            hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, function (event, data) {
11940                if (!pip && v.hlsaudio == 1) {
11941                    setTimeout(HlsAudioTracks, 500)
11942                }
11943            });
11944            hls.on(Hls.Events.AUDIO_TRACK_SWITCHING, function (event, data) {
11945                if (!pip && v.hlsaudio == 1) {
11946                    HlsAudioTrack()
11947                }
11948            });
11949            hls.subtitleDisplay = false;
11950            if (v.hlssubtracks == 1) {
11951                hls.on(Hls.Events.FRAG_LOADED, function (event, data) {
11952                    if (typeof (data) == "object") {
11953                        if (data.frag.type == 'subtitle') {
11954                            var fu = data.frag.url;
11955                            if (fu) {
11956                                var st = hls.subtitleTrack;
11957                                if (o.subtitle_on) {
11958                                    o.sbt.hlsSub(st + 'id_' + fu)
11959                                } else {
11960                                    !hls_subs[st] ? hls_subs[st] = [] : '';
11961                                    hls_subs[st].push(fu)
11962                                }
11963                            }
11964                        }
11965                    }
11966                });
11967                hls.on(Hls.Events.SUBTITLE_TRACKS_UPDATED, function (event, data) {
11968                    var x = hls.subtitleTracks;
11969                    var y = '';
11970                    for (var i = 0; i < x.length; i++) {
11971                        y += (y != '' ? ',' : '') + '[' + x[i].name + ']hls' + i;
11972                        x[i].default ? o.remember_sub = x[i].name : ''
11973                    }
11974                    apiProcessor("subtitle", y)
11975                })
11976            }
11977            hls.on(Hls.Events.ERROR, function (event, data) {
11978                v.log == 1 ? console.log(data) : '';
11979                js(data.type + 'Hls', data, 0, true);
11980                o.hlserror = data;
11981                if (data.fatal) {
11982                    if (data.type == "networkError") {
11983                        log("HLS fatal network error");
11984                        if (v.livewakeup == 1 && Time() == 0) {
11985                            HlsSleep0()
11986                        } else {
11987                            error = data.details + ' (' + data.type + ')';
11988                            o.seekto > 0 || pip || v.live == 1 || is_ws ? '' : o.seekto = Time();
11989                            hls.destroy();
11990                            if (!pip) {
11991                                o.media.onError()
11992                            }
11993                        }
11994                    } else {
11995                        var nx = false;
11996                        if (data.type == "mediaError") {
11997                            if (v.hlsermd == 1 && o.media.urlsl() > 0) {
11998                                nx = true
11999                            } else {
12000                                log("HLS fatal media error, recover");
12001                                hls.recoverMediaError()
12002                            }
12003                        } else {
12004                            nx = true
12005                        }
12006                        if (nx) {
12007                            error = "HLS fatal error, destroy";
12008                            hls.destroy();
12009                            !pip ? o.media.onError() : ''
12010                        }
12011                    }
12012                } else {
12013                    log("HLS ", data.type, data.details, (data.response ? data.response.code : ''));
12014                    js("hls_error", (data.response ? data.response.code : ''));
12015                    if (is_sleep > 0) {
12016                        is_sleep = 2;
12017                        HlsSleep()
12018                    }
12019                }
12020            });
12021            hls_created = true
12022        }
12023
12024        function DrmVars(x) {
12025            if (x) {
12026                for (var j = 1; j < 11; j++) {
12027                    if (v["drm" + j]) {
12028                        x = x.replace("{" + j + "}", v["drm" + j])
12029                    }
12030                }
12031            }
12032            return x
12033        }
12034
12035        function HlsLevel() {
12036            if (!pip && v.hlsquality == 1 && HlsLevelsLength() > 1) {
12037                if (o.current_quality != hls.loadLevel) {
12038                    o.current_quality = hls.loadLevel;
12039                    o.controls ? o.controls.QualityChangedNoHand(o.current_quality) : '';
12040                    log("HLS Level " + o.current_quality)
12041                }
12042                if (exist2(v.forbidden_quality) && o.current_quality > 0) {
12043                    var fq = v.forbidden_quality.split(",");
12044                    for (var k = 0; k < fq.length; k++) {
12045                        if (o.files_quality[o.current_quality].indexOf(fq[k]) > -1) {
12046                            log('regress quality');
12047                            hls.currentLevel = o.current_quality - 1;
12048                            o.current_quality--;
12049                            break
12050                        }
12051                    }
12052                }
12053                if (v.hlsautoquality != 1 && isAuto() && hlscq > -1) {
12054                    SetHlsQuality(hlscq)
12055                }
12056            }
12057        }
12058
12059        function CreateWS() {
12060            if (exist(window.FlussonicMsePlayer)) {
12061                if (MseIsSupported()) {
12062                    if (!exist(o.ws)) {
12063                        o.ws = new PluginWS()
12064                    }
12065                    ws = new FlussonicMsePlayer(pjstg, url, existv(v.wsconfig, {
12066                        debug: true
12067                    }));
12068                    ws_created = true
12069                } else {
12070                    is_ws = false;
12071                    log("not supported")
12072                }
12073            }
12074        }
12075
12076        function hlsTextTracks() {
12077            Captions()
12078        };
12079        this.captions = function () {
12080            Captions()
12081        };
12082
12083        function Captions() {
12084            if (v.hlscaptions && o.controls) {
12085                if (pjstg.textTracks.length > 0) {
12086                    if (v.captions == 1) {
12087                        pjstg.textTracks[pjstg.textTracks.length - 1].mode = "showing"
12088                    } else {
12089                        pjstg.textTracks[pjstg.textTracks.length - 1].mode = "hidden"
12090                    }
12091                    if (!o.captions) {
12092                        o.captions = true;
12093                        o.controls.refresh()
12094                    }
12095                } else {
12096                    if (o.captions) {
12097                        o.captions = false;
12098                        o.controls.refresh()
12099                    }
12100                }
12101            }
12102        }
12103
12104        function HlsSleep0() {
12105            log("sleep");
12106            !pip && o.play ? o.actions.Pause() : '';
12107            o.actions.ShowPoster();
12108            is_sleep = 1;
12109            HlsSleep(o.play)
12110        }
12111
12112        function HlsSleep(x) {
12113            if (is_sleep > 0) {
12114                clearTimeout(sleep_timeout);
12115                sleep_timeout = setTimeout(HlsLiveWaiting, v.livewakeuptime * 1000)
12116            }
12117        }
12118
12119        function HlsLiveWaiting() {
12120            if (is_sleep > 0) {
12121                log("watching");
12122                if (is_hls) {
12123                    if (is_sleep == 1) {
12124                        hls.loadSource(url)
12125                    }
12126                    if (is_sleep == 2) {
12127                        hls.destroy();
12128                        CreateHLS(true);
12129                        pjstg.play()
12130                    }
12131                } else {
12132                    attr(pjstg, {
12133                        'src': url
12134                    })
12135                }
12136            }
12137        }
12138        pjstg.addEventListener('loadstart', onLoadStart);
12139        pjstg.addEventListener('error', onTagError);
12140        pjstg.addEventListener('ended', onEnded);
12141        pjstg.addEventListener('play', onPlay);
12142        pjstg.addEventListener('pause', onPause);
12143        pjstg.addEventListener('timeupdate', onTimeupdate);
12144        pjstg.addEventListener('seeking', onSeeking);
12145        pjstg.addEventListener('seeked', onSeeked);
12146        pjstg.addEventListener('loadedmetadata', onMeta);
12147        pjstg.addEventListener('volumechange', onVolume);
12148        pjstg.addEventListener('waiting', onWaiting);
12149        pjstg.addEventListener('durationchange', onDuration);
12150        pjstg.addEventListener('loadeddata', onLoadedData);
12151        pjstg.addEventListener('enterpictureinpicture', onPipEnter);
12152        pjstg.addEventListener('leavepictureinpicture', onPipLeave);
12153        if (v.hlsdrmfp == 1 && o.system.safari) {
12154            if (exist2(v.hlsdrmfpl)) {
12155                if (exist2(v.hlsdrmfps)) {
12156                    pjstg.addEventListener('webkitneedkey', onWkitKey)
12157                } else {
12158                    if (typeof PluginHlsFps2 !== "undefined") {
12159                        o.hlsfps = PluginHlsFps2(url, pjstg)
12160                    }
12161                }
12162            }
12163        }
12164        if (o.system.iphone) {
12165            pjstg.addEventListener('webkitendfullscreen', iosexfull)
12166        }
12167
12168        function iosexfull() {
12169            pjstg.removeAttribute("controls")
12170        }
12171
12172        function onLoadStart() {
12173            if (!is_hls && !is_dash) {
12174                !pip ? o.actions.MediaReady() : ''
12175            }
12176        }
12177
12178        function onTagError() {
12179            if (!is_hls && !is_dash) {
12180                if (pjstg.error) {
12181                    log(pjstg.error, pjstg.error.code, pjstg.error.message);
12182                    var x = pjstg.error.code;
12183                    error = pjstg.error.message;
12184                    if (error == '') {
12185                        if (x == 1) {
12186                            error = "aborted"
12187                        }
12188                        if (x == 2) {
12189                            error = "network"
12190                        }
12191                        if (x == 3) {
12192                            error = "decode"
12193                        }
12194                        if (x == 4) {
12195                            error = "not found"
12196                        }
12197                    }
12198                    log("Error: ", error)
12199                }
12200                if (is_hls2 && v.livewakeup == 1 && Time() == 0) {
12201                    error = undefined;
12202                    HlsSleep0()
12203                }
12204                if (error != undefined || o.system.ios) {
12205                    onError()
12206                }
12207            }
12208        }
12209
12210        function onError() {
12211            !pip ? o.media.onError() : ''
12212        }
12213
12214        function onEnded() {
12215            if (!pip) {
12216                o.media.onEnded()
12217            } else {
12218                if (v.pip.loop == 1) {
12219                    pjstg.currentTime = 0;
12220                    pjstg.play()
12221                }
12222            }
12223        }
12224
12225        function onPlay() {
12226            if (!o.start && v.preroll) {
12227                log('wrong play');
12228                pause();
12229                o.actions.Play();
12230                return
12231            }
12232            if (is_hls && is_sleep > 0) {} else {
12233                if (!pip) {
12234                    var bgl = o.actions.isVastBgLoad() && o.vastfrombg != 1;
12235                    if (bgl || pause_before_vast == -1) {
12236                        var x = false;
12237                        if (is_hls) {
12238                            if (exist(o.vast) || exist(o.vastloader)) {
12239                                if (bgl) {} else {
12240                                    log('pause onplay');
12241                                    pause();
12242                                    x = true
12243                                }
12244                            }
12245                        }
12246                        if (!x) {
12247                            o.media.onPlay()
12248                        }
12249                    }
12250                }
12251            }
12252        }
12253
12254        function onPause() {
12255            if (!nops) {
12256                log("onpause");
12257                if (o.play && o.actplay && !pjstg.ended && v.unpause == 1 && !o.nativecontrols) {
12258                    log("unpause");
12259                    TagPlay()
12260                } else {
12261                    !pip && !o.nopause && pjstg.paused ? o.media.onPause() : ''
12262                }
12263            }
12264        }
12265
12266        function onTimeupdate() {
12267            !pip ? o.media.onTimeupdate() : '';
12268            if (pause_before_vast > -1) {
12269                if (Time() > pause_before_vast) {
12270                    pause();
12271                    pause_before_vast = -1
12272                }
12273            }
12274        }
12275
12276        function onSeeking() {
12277            !pip ? o.media.onSeeking() : ''
12278        }
12279
12280        function onSeeked() {
12281            !pip ? o.media.onSeeked() : ''
12282        }
12283
12284        function onMeta() {
12285            if (pip) {
12286                PipSize()
12287            } else {
12288                o.media.onMeta();
12289                PlayerSize();
12290                if (is_hls && is_sleep > 0) {
12291                    is_sleep = 0;
12292                    log("wake up");
12293                    hls.startLoad();
12294                    TagPlay();
12295                    o.controls.Play()
12296                }
12297                if (exist(v.ratio)) {
12298                    Resize()
12299                }
12300                setTimeout(MetaAudio, 500)
12301            }
12302        }
12303
12304        function CheckTop() {
12305            if (pjstg.style.top == "-2000px" || pjstg.offsetTop < -1000) {
12306                AfterVast()
12307            }
12308        }
12309
12310        function MetaAudio() {
12311            if (pjstg.audioTracks && o.files_audiotrack.length == 0 && v.nativeaudio != 0) {
12312                var at = pjstg.audioTracks;
12313                for (i = 0; i < at.length; i++) {
12314                    var x = o.media.renameTracks((at[i].label ? at[i].label + ' (' : '') + at[i].language + (at[i].label ? ')' : ''), i);
12315                    if (x == v.default_audio) {
12316                        o.current_audiotrack = o.ncrtat = i
12317                    }
12318                    o.files_audiotrack[i] = x
12319                }
12320                o.controls.AudioTrackChangedNoHand(o.ncrtat)
12321            }
12322            if (o.ncrtat > 0) {
12323                nativeAudioTrack(o.ncrtat, 1)
12324            }
12325        };
12326        this.ratio = function () {
12327            return (pjstg.videoWidth / pjstg.videoHeight)
12328        };
12329
12330        function PipSize() {
12331            if (pjstg.videoHeight > 0) {
12332                css(container, {
12333                    "height": container.offsetWidth / (pjstg.videoWidth / pjstg.videoHeight) - parseInt(v.pip.border)
12334                })
12335            } else {
12336                if (pipto < 20) {
12337                    setTimeout(PipSize, 100);
12338                    pipto++
12339                }
12340            }
12341        }
12342
12343        function PlayerSize() {
12344            if (v.changeheight == 1) {
12345                clearInterval(o.heightInterval);
12346                o.heightInterval = setInterval(WaitSize, 100);
12347                WaitSize()
12348            }
12349        }
12350
12351        function WaitSize() {
12352            if (pjstg) {
12353                if (pjstg.videoHeight > 0) {
12354                    o.actions.changeAspect(pjstg.videoWidth / pjstg.videoHeight);
12355                    clearInterval(o.heightInterval)
12356                }
12357            }
12358        }
12359
12360        function onDuration() {
12361            !pip && !is_ws ? o.media.onDuration() : ''
12362        }
12363
12364        function onVolume() {
12365            !pip ? o.media.onVolume() : ''
12366        }
12367
12368        function onWaiting() {
12369            if (is_hls && is_sleep > 0) {} else {
12370                !pip ? o.media.onWaiting() : ''
12371            }
12372        }
12373
12374        function onLoadedData() {
12375            o.actions.LoadedData()
12376        }
12377
12378        function MseIsSupported() {
12379            var mediaSource = window.MediaSource = window.MediaSource || window.WebKitMediaSource;
12380            var sourceBuffer = window.SourceBuffer = window.SourceBuffer || window.WebKitSourceBuffer;
12381            var isTypeSupported = mediaSource && typeof mediaSource.isTypeSupported === 'function' && mediaSource.isTypeSupported(mimeCodec);
12382            var sourceBufferValidAPI = !sourceBuffer || sourceBuffer.prototype && typeof sourceBuffer.prototype.appendBuffer === 'function' && typeof sourceBuffer.prototype.remove === 'function';
12383            return isTypeSupported && sourceBufferValidAPI
12384        }
12385        var span05 = "<span style='opacity:0.5'>";
12386
12387        function HlsQualityLevels() {
12388            if (!pip && v.hlsquality == 1) {
12389                var x = hls.levels;
12390                var q = -1;
12391                o.files_quality = [];
12392                if (x.length > 1) {
12393                    if (v.default_quality == 'max') {
12394                        q = x.length - 1
12395                    }
12396                    for (var i = 0; i < x.length; i++) {
12397                        if (exist(x[i].height)) {
12398                            var y = o.media.renameQualities(x[i], v.nameofhlsquality);
12399                            if (o.files_quality.indexOf(y) > -1 || v.hlsaddbitrate == 1) {
12400                                if (exist(x[i].bitrate)) {
12401                                    var yi = o.files_quality.indexOf(y);
12402                                    yi > -1 ? o.files_quality[yi] += " " + span05 + " &nbsp;" + parseInt(x[yi].bitrate / 1000) + ' ' + Lang('kbps') + '</span>' : '';
12403                                    o.files_quality[i] = y + " " + span05 + " &nbsp;
12403" + parseInt(x[i].bitrate / 1000) + ' ' + Lang('kbps') + '</span>'
12404                                }
12405                            } else {
12406                                o.files_quality[i] = y
12407                            }
12408                            if (exist(x[i].audioGroupIds)) {
12409                                o.files_quality_ag[i] = x[i].audioGroupIds[0]
12410                            }
12411                        } else if (exist(x[i].name)) {
12412                            o.files_quality[i] = x[i].name
12413                        } else {
12414                            o.files_quality[i] = i
12415                        }
12416                        if (exist(v.default_quality) && q == -1) {
12417                            if (v.default_quality == o.files_quality[i]) {
12418                                q = i
12419                            }
12420                        }
12421                        if (exist(o.default_quality)) {
12422                            if (o.default_quality == o.files_quality[i]) {
12423                                q = i
12424                            }
12425                        }
12426                    }
12427                    if (v.hlsautoquality == 1) {
12428                        o.files_quality[x.length] = Lang("auto")
12429                    } else {
12430                        q == -1 ? q = x.length - 1 : ''
12431                    }
12432                    if (v.hlslowquality == 1 || q > -1) {
12433                        if (v.hlschangequality == "next" || (!o.start && v.preload == 0)) {
12434                            hls.nextLevel = q
12435                        } else {
12436                            if (v.hlschangequality == "current") {
12437                                hls.currentLevel = q
12438                            }
12439                        }
12440                        o.current_quality = q
12441                    } else {
12442                        if (v.hlsautoquality == 1) {
12443                            o.current_quality = hls.levels.length - 1
12444                        } else {
12445                            o.current_quality = hls.firstLevel
12446                        }
12447                    }
12448                    if (v.hlsmaxlvl > 0) {
12449                        hls.autoLevelCapping = x.length - v.hlsmaxlvl * 1 - 1
12450                    }
12451                    HlsUpdateAudio()
12452                }
12453                if (hls.levels[o.current_quality]) {
12454                    o.bitrate = existv(hls.levels[o.current_quality].bitrate, 0)
12455                }
12456                o.controls ? o.controls.refresh() : ''
12457            }
12458        }
12459
12460        function HlsUpdateAudio() {
12461            if (v.hlsaudio == 1) {
12462                HlsAudioTracks();
12463                HlsAudioTrack()
12464            }
12465        }
12466
12467        function HlsAudioTracks() {
12468            if (!pip && v.hlsaudio == 1) {
12469                var x = hls.audioTracks;
12470                o.files_audiotrack = [];
12471                var stop;
12472                var set = -1;
12473                if (x.length > 1) {
12474                    for (var i = 0; i < x.length; i++) {
12475                        stop = false;
12476                        if (exist(x[i].groupId) && o.files_quality_ag.length > 0) {
12477                            if (x[i].groupId != o.files_quality_ag[o.current_quality]) {
12478                                for (var j = 0; j < o.files_quality_ag.length; j++) {
12479                                    if (o.files_quality_ag[j] == x[i].groupId) {
12480                                        stop = true
12481                                    }
12482                                }
12483                            }
12484                        }
12485                        if (!stop) {
12486                            o.files_audiotrack[i] = (exist(x[i].name) ? o.media.renameTracks(x[i].name, i) : i) + (v.hlsaudiolang == 1 && exist(x[i].lang) ? ' (' + x[i].lang + ')' : '');
12487                            if (exist(v.default_audio)) {
12488                                if (v.default_audio == o.files_audiotrack[i]) {
12489                                    set = i
12490                                }
12491                            }
12492                        }
12493                    }
12494                }
12495            }
12496            if (set > -1) {
12497                o.current_audiotrack = set;
12498                hls.audioTrack = set
12499            }
12500        }
12501
12502        function HlsAudioTrack() {
12503            if (!pip) {
12504                var x = hls.audioTracks;
12505                var y = hls.audioTrack;
12506                if (y > -1) {
12507                    if (exist(x[y].groupId)) {
12508                        if (o.files_quality_ag.length > 0) {
12509                            if (o.files_quality_ag[o.current_quality] != x[y].groupId) {
12510                                for (var i = 0; i < x.length; i++) {
12511                                    if (x[i].name == x[y].name && x[i].groupId == o.files_quality_ag[o.current_quality]) {
12512                                        hls.audioTrack = i;
12513                                        y = i;
12514                                        break
12515                                    }
12516                                }
12517                            }
12518                        }
12519                    }
12520                    o.current_audiotrack = y;
12521                    log("HLS AudioTrack", o.current_audiotrack);
12522                    o.controls.AudioTrackChangedNoHand(o.current_audiotrack)
12523                }
12524            }
12525        };
12526        this.nativeAudioTrack = function (x, y) {
12527            nativeAudioTrack(x, y)
12528        };
12529
12530        function nativeAudioTrack(x, y) {
12531            if (pjstg.audioTracks.length > 1) {
12532                pjstg.audioTracks[x].enabled = true;
12533                pjstg.audioTracks[y == 1 ? 0 : o.ncrtat].enabled = false;
12534                o.ncrtat = x;
12535                y != 1 ? pjstg.currentTime = o.media.time() : ''
12536            }
12537        }
12538
12539        function Time() {
12540            if (is_dash) {
12541                return dash_created ? o.dash.time() : 0
12542            } else {
12543                return pjstg.currentTime
12544            }
12545        };
12546
12547        function Duration() {
12548            var x = pjstg.duration;
12549            if (x == Infinity) {
12550                v.live = 1;
12551                x = Time() + 10;
12552                if (o.dur) {
12553                    x < o.dur ? x = o.dur : ''
12554                }
12555                o.dur = x
12556            }
12557            if (is_dash && dash_created) {
12558                x = o.dash.duration()
12559            }
12560            if (exist(v.end)) {
12561                if (indOf([v.end], '-')) {
12562                    x = x + v.end * 1
12563                } else {
12564                    x = v.end
12565                }
12566            }
12567            return !isNaN(x) ? x : 0
12568        }
12569        this.Play = function () {
12570            var p = true;
12571            if (is_hls && !hls_started) {
12572                if (!hls_created) {
12573                    CreateHLS(true)
12574                }
12575                hls.startLoad()
12576            }
12577            if (is_dash && !dash_created) {
12578                CreateDASH(true);
12579                p = false
12580            }
12581            if (is_ws) {
12582                if (!ws_created) {
12583                    CreateWS()
12584                }
12585                ws.play();
12586                p = false
12587            }
12588            CheckTop();
12589            p ? TagPlay() : ''
12590        };
12591        var playtry;
12592
12593        function TagPlay() {
12594            if (url != "none" && pjstg) {
12595                var pp = pjstg.play();
12596                if (pp !== undefined) {
12597                    pp.then(function () {}).catch(function (error) {
12598                        var em = error.message;
12599                        log("playError", em);
12600                        if (em.indexOf('source') == -1 && em.indexOf('interrupted by') == -1) {
12601                            if (v.autoplaymute == 1 && exist(pjstg) && o.play) {
12602                                log('automute', o.play);
12603                                o.actions.Mute();
12604                                try {
12605                                    pjstg.volume = 0
12606                                } catch (e) {};
12607                                var pp2 = pjstg.play();
12608                                if (pp2) {
12609                                    pp2.then(function () {}).catch(function (e) {
12610                                        log("playError2", e.message);
12611                                        if (o.system.tv && (is_hls || is_dash)) {} else {
12612                                            o.controls.Pause();
12613                                            o.actions.ShowPoster();
12614                                            js("autoplay_denied")
12615                                        }
12616                                    })
12617                                }
12618                            } else {
12619                                if (!o.acted) {
12620                                    o.controls.Pause();
12621                                    o.actions.ShowPoster()
12622                                }
12623                            }
12624                        } else {
12625                            if (em.indexOf('load request') > 0) {
12626                                var pp3 = pjstg.play();
12627                                if (pp3) {
12628                                    pp3.then(function () {}).catch(function (e) {
12629                                        log("playError3", e.message)
12630                                    })
12631                                }
12632                            }
12633                        }
12634                    })
12635                }
12636            }
12637        }
12638        this.BeforeVast = function () {
12639            if (o.vastloader || o.vast) {
12640                if (o.ispipkit) {
12641                    PipWebkit()
12642                }
12643                if (!o.airplayed && o.system.mobile && o.system.webkit) {
12644                    if (!pjstg.muted) {
12645                        pjstg.muted = true;
12646                        unmuteplease = true
12647                    }
12648                    css(pjstg, {
12649                        "position": "absolute",
12650                        "left": -2000,
12651                        "top": -2000
12652                    });
12653                    pause_before_vast = Time();
12654                    if (!is_ws) {
12655                        pjstg.play()
12656                    }
12657                    if (pause_before_vast == 0 && o.seekto > 0) {
12658                        _seekaftervast = o.seekto
12659                    }
12660                }
12661            }
12662        };
12663        this.AfterVast = function () {
12664            AfterVast()
12665        };
12666
12667        function AfterVast() {
12668            if (!o.airplayed && (o.system.mobile || o.system.webkit)) {
12669                css(pjstg, {
12670                    "position": "static",
12671                    "left": 0,
12672                    "top": 0
12673                });
12674                if (exist(v.ratio)) {
12675                    Resize()
12676                }
12677                if (unmuteplease) {
12678                    !o.muted ? pjstg.muted = false : '';
12679                    unmuteplease = false
12680                }
12681                if (_seekaftervast > 0) {
12682                    o.seekto = _seekaftervast;
12683                    _seekaftervast = 0
12684                }
12685                pause_before_vast = -1
12686            }
12687        };
12688        this.Pause = function () {
12689            log('paused');
12690            pause()
12691        };
12692
12693        function pause() {
12694            if (is_ws) {
12695                ws.pause()
12696            } else {
12697                pjstg.pause()
12698            }
12699        };
12700        this.Toggle = function () {
12701            !pjstg.paused ? Pause() : TagPlay()
12702        };
12703        this.Seek = function (x) {
12704            if (is_dash && dash_created) {
12705                o.dash.seek(x)
12706            } else {
12707                if (is_hls) {
12708                    if (v.hlsforce == 1 && x > 0 && isAuto() && v.hlsautoquality == 1) {
12709                        hls_force = hls.currentLevel;
12710                        hls.nextAutoLevel = 0
12711                    }
12712                }
12713                pjstg.currentTime = x
12714            }
12715        };
12716        this.Mute = function () {
12717            pjstg.muted = true
12718        };
12719        this.Unmute = function () {
12720            pjstg.muted = false;
12721            if (o.file_type == "hls" && o.system.ios && v.vast == 1) {
12722                if (!exist(o.um1)) {
12723                    nops = true;
12724                    log("ios unmute");
12725                    pjstg.pause();
12726                    setTimeout(function () {
12727                        pjstg.play();
12728                        nops = false
12729                    }, 10);
12730                    o.um1 = true
12731                }
12732            }
12733        };
12734        this.Volume = function (x) {
12735            pjstg.volume = x
12736        };
12737        this.Gain = function () {
12738            if (o.gainedsource != pjstg) {
12739                var source;
12740                var ctx;
12741                if (o.audiosrc[pjstg]) {
12742                    source = o.audiosrc[pjstg];
12743                    ctx = o.audioctx[pjstg]
12744                } else {
12745                    window.AudioContext = window.AudioContext || window.webkitAudioContext;
12746                    if (exist(window.AudioContext)) {
12747                        try {
12748                            ctx = new AudioContext();
12749                            source = ctx.createMediaElementSource(pjstg);
12750                            o.audiosrc[pjstg] = source;
12751                            o.audioctx[pjstg] = ctx
12752                        } catch (e) {
12753                            log(e)
12754                        }
12755                    }
12756                }
12757                if (ctx) {
12758                    var gain = ctx.createGain();
12759                    gain.gain.value = v.volumegain;
12760                    source.connect(gain);
12761                    gain.connect(ctx.destination);
12762                    o.gained = true;
12763                    o.gainedsource = pjstg
12764                }
12765            }
12766        };
12767        this.isPlaying = function () {
12768            return !pjstg.paused
12769        };
12770        this.isLive = function () {
12771            return v.live == 1 || is_ws ? true : o.live
12772        };
12773        this.tag = function () {
12774            return pjstg
12775        };
12776        this.nativeControls = function () {
12777            attr(pjstg, {
12778                'controls': '1'
12779            });
12780            return true
12781        };
12782        this.preload = function () {
12783            attr(pjstg, {
12784                'preload': 'metadata'
12785            });
12786            if (is_hls && !hls_created) {
12787                CreateHLS(false)
12788            }
12789            if (is_dash && !dash_created) {
12790                CreateDASH(false)
12791            }
12792        };
12793        this.status = function () {
12794            var state = "playing";
12795            if (pjstg.paused) {
12796                state = "paused"
12797            }
12798            if (pjstg.ended) {
12799                state = "ended"
12800            }
12801            return state
12802        };
12803        this.ChangePip = function (x, y) {
12804            pip = x;
12805            y.appendChild(pjstg);
12806            container = y;
12807            if (x) {
12808                if (v.pip.nomute != 1) {
12809                    pjstg.muted = true
12810                } else {
12811                    if (!o.muted) {
12812                        pjstg.muted = false
12813                    }
12814                }
12815                PipSize();
12816                if (o.files_quality.length > 0 && v.hlsautoquality == 1) {
12817                    if (is_hls) {
12818                        pip_quality = o.current_quality;
12819                        hls.autoLevelCapping = 0;
12820                        hls.currentLevel = 0
12821                    }
12822                }
12823            } else {
12824                if (!o.muted && v.pip.nomute != 1) {
12825                    pjstg.muted = false
12826                }
12827                pjstg.volume = exist2(v.pip.volume) ? v.pip.volume : v.volume;
12828                PlayerSize();
12829                if (o.files_quality.length > 0 && v.hlsautoquality == 1) {
12830                    if (is_hls) {
12831                        hls.autoLevelCapping = -1;
12832                        if (pip_quality > -1) {
12833                            pip_quality < hls.levels.length ? hls.nextLevel = pip_quality : ''
12834                        }
12835                    }
12836                }
12837            }
12838        };
12839        this.time = function () {
12840            return Time()
12841        };
12842        this.duration = function () {
12843            return Duration()
12844        };
12845        this.loaded = function () {
12846            var x = 0;
12847            if (pjstg.buffered) {
12848                if (pjstg.buffered.length > 0) {
12849                    var y = Time();
12850                    for (var i = 0; i < pjstg.buffered.length; i++) {
12851                        if ((y >= pjstg.buffered.start(i) || y >= pjstg.buffered.start(i) - 100) && y <= pjstg.buffered.end(i)) {
12852                            x = pjstg.buffered.end(i)
12853                        }
12854                    }
12855                    x == 0 ? x = pjstg.buffered.end(pjstg.buffered.length - 1) : ''
12856                }
12857            }
12858            if (exist(v.end)) {
12859                var ed = v.end;
12860                if (indOf([ed], '-')) {
12861                    ed = Duration()
12862                }
12863                x > ed ? x = ed : ''
12864            }
12865            return x
12866        };
12867        this.auto = function () {
12868            return isAuto()
12869        };
12870
12871        function isAuto() {
12872            var x = false;
12873            if (is_hls) {
12874                if (hls_created) {
12875                    x = hls.autoLevelEnabled
12876                }
12877            } else if (is_dash) {
12878                if (dash_created) {
12879                    x = o.dash.auto()
12880                }
12881            }
12882            return x
12883        }
12884        this.size = function () {
12885            return {
12886                "width": pjstg.videoWidth,
12887                "height": pjstg.videoHeight
12888            }
12889        };
12890        this.src = function (x) {
12891            if (x) {
12892                x = x.replace(/\(random\)/g, Math.random());
12893                x = casturl(x);
12894                url = x;
12895                o.media_error != 2 ? o.media_error = false : '';
12896                if (is_dash) {
12897                    if (dash_created) {
12898                        o.dash.source(x)
12899                    }
12900                } else if (is_hls) {
12901                    is_hls && hls ? hls.destroy() : '';
12902                    CreateHLS(o.start || o.autoplay);
12903                    CheckPip()
12904                } else {
12905                    attr(pjstg, {
12906                        'src': x,
12907                        'autoplay': 0
12908                    });
12909                    tagSrc();
12910                    pause()
12911                }
12912            }
12913        };
12914
12915        function casturl(x) {
12916            if (x) {
12917                var y = x.indexOf(':cast:');
12918                if (y > 0) {
12919                    o.casturl = x.substr(y + 6);
12920                    x = x.substr(0, y)
12921                }
12922            }
12923            return x
12924        }
12925
12926        function tagSrc() {
12927            if (o.system.safari && pjstg) {
12928                var y = pjstg.textTracks;
12929                if (y) {
12930                    for (var i = 0; i < y.length; i++) {
12931                        y[i].mode = "disabled"
12932                    }
12933                }
12934                y = pjstg.audioTracks;
12935                if (y) {
12936                    for (i = 0; i < y.length; i++) {
12937                        y[i].enabled = (i == 0 ? 1 : 0)
12938                    }
12939                }
12940                if (window.WebKitPlaybackTargetAvailabilityEvent) {
12941                    pjstg.addEventListener('webkitplaybacktargetavailabilitychanged', function (event) {
12942                        o.airplay = event.availability == "available";
12943                        !pip ? o.actions.AirplayChanged() : ''
12944                    })
12945                }
12946                o.hlsfps ? o.hlsfps.cert(url) : ''
12947            }
12948            CheckPip();
12949            if (v.v360 == 1) {
12950                typeof PjsCheck360 !== "undefined" ? PjsCheck360(url, pjstg, container) : ''
12951            }
12952        }
12953        this.airplay = function () {
12954            pjstg.webkitShowPlaybackTargetPicker()
12955        };
12956        this.pipwebkit = function () {
12957            PipWebkit()
12958        };
12959
12960        function CheckPip() {
12961            if (o.system.webkit) {
12962                if (exist(pjstg.webkitSupportsPresentationMode) && !o.system.iphone) {
12963                    o.pipwebkit = true
12964                }
12965                if (document.pictureInPictureEnabled && !pjstg.disablePictureInPicture) {
12966                    o.pipwebkit = true
12967                }
12968            }
12969        }
12970
12971        function PipWebkit() {
12972            if (o.system.safari) {
12973                if (pjstg.webkitPresentationMode === "picture-in-picture") {
12974                    pjstg.webkitSetPresentationMode("inline");
12975                    o.ispipkit = false
12976                } else {
12977                    pjstg.webkitSetPresentationMode("picture-in-picture");
12978                    o.ispipkit = true
12979                }
12980            } else {
12981                if (!document.pictureInPictureElement) {
12982                    eval('pjstg.requestPictureInPicture().then(p => {o.ispipkit = true;}).catch(error => {o.ispipkit = false;});')
12983                } else {
12984                    eval('document.exitPictureInPicture().then(ok =>{o.ispipkit = false;}).catch(error => {});')
12985                }
12986            }
12987        };
12988
12989        function onPipEnter() {
12990            o.ispipkit = true
12991        };
12992
12993        function onPipLeave() {
12994            o.ispipkit = false
12995        };
12996
12997        function onWkitKey(e) {
12998            if (typeof PluginHlsFps !== "undefined") {
12999                o.hlsfps = PluginHlsFps(e)
13000            }
13001        }
13002        this.setDashQuality = function (x) {
13003            if (dash_created) {
13004                o.dash.setQuality(x)
13005            }
13006        };
13007        this.setDashAudioTrack = function (x) {
13008            if (dash_created) {
13009                if (pjstg.buffered.length > 0) {
13010                    o.dash.setAudio(x)
13011                }
13012            }
13013        };
13014        this.setWsQuality = function (x) {
13015            if (o.ws) {
13016                o.ws.setTracks(ws, x, -1)
13017            }
13018        };
13019        this.setWsAudioTrack = function (x) {
13020            if (o.ws) {
13021                o.ws.setTracks(ws, -1, x)
13022            }
13023        };
13024        this.setHlsQuality = function (x) {
13025            hlscq = x * 1;
13026            SetHlsQuality(x)
13027        };
13028
13029        function SetHlsQuality(x) {
13030            if (hls_created) {
13031                var y = parseInt(x);
13032                if (y >= hls.levels.length) {
13033                    if (v.hlsautoquality == 1) {
13034                        y = -1;
13035                        hls.autoLevelCapping = -1
13036                    } else {
13037                        y = hls.levels.length - 1
13038                    }
13039                }
13040                if (v.hlschangequality == "current") {
13041                    setTimeout(onWaiting, 500);
13042                    hls.currentLevel = y
13043                }
13044                if (v.hlschangequality == "next") {
13045                    log("HLS next level " + y);
13046                    hls.nextLevel = y
13047                }
13048                if (y == -1) {
13049                    o.current_quality = hls.loadLevel
13050                }
13051                HlsUpdateAudio()
13052            }
13053        };
13054        this.getHLS = function () {
13055            return hls
13056        };
13057        this.getDASH = function () {
13058            return dash_created ? o.dash.getDash() : false
13059        };
13060        this.HlsLevelsLength = function () {
13061            return HlsLevelsLength()
13062        };
13063
13064        function HlsLevelsLength() {
13065            var x = 0;
13066            if (hls_created) {
13067                if (hls.levels) {
13068                    x = hls.levels.length
13069                }
13070            }
13071            return x
13072        }
13073        this.DashLevelsLength = function () {
13074            return DashLevelsLength()
13075        };
13076        this.ObjectFit = function () {
13077            ObjectFit()
13078        };
13079
13080        function ObjectFit() {
13081            if (pjstg) {
13082                if (v.covervideo == 1 || v.fill == 1) {
13083                    if (v.fillvideo == 1 || v.fill == 1) {
13084                        css(pjstg, {
13085                            'object-fit': 'fill'
13086                        })
13087                    } else {
13088                        css(pjstg, {
13089                            'object-fit': 'cover'
13090                        })
13091                    }
13092                } else {
13093                    css(pjstg, {
13094                        'object-fit': 'contain'
13095                    })
13096                }
13097            }
13098        }
13099        this.resize = function () {
13100            Resize()
13101        };
13102
13103        function Resize() {
13104            if (v.ratio) {
13105                apiProcessor('scale', String(v.ratio).replace('/', ':'))
13106            }
13107        }
13108
13109        function DashLevelsLength() {
13110            var x = 0;
13111            if (dash_created) {
13112                x = o.dash.levels()
13113            }
13114            return x
13115        }
13116        this.setHlsAudioTrack = function (x) {
13117            if (hls_created) {
13118                hls.audioTrack = parseInt(x)
13119            }
13120        };
13121        this.hlsDashSub = function (x, y) {
13122            if (y == "hls" && hls_created && _hlssubtracks) {
13123                _hlssubtracks.HlsSubTrack(x)
13124            }
13125            if (y == "hls2" && hls_created) {
13126                if (hls_subs[x] && o.sbt) {
13127                    for (var i = 0; i < hls_subs[x].length; i++) {
13128                        o.sbt.hlsSub(hls_subs[x][i])
13129                    }
13130                }
13131                setTimeout(function () {
13132                    hls.subtitleTrack = x * 1
13133                }, 500)
13134            }
13135            if (y == "dash" && dash_created) {
13136                o.dash.subtrack(x)
13137            }
13138        };
13139        this.setSpeed = function (x) {
13140            if (x) {
13141                pjstg.playbackRate = x
13142            }
13143        };
13144        this.removeTracks = function () {
13145            var x = pjstg.childNodes;
13146            var y = [];
13147            for (var i = 0; i < x.length; i++) {
13148                if (x[i].tagName.toLowerCase() == 'track') {
13149                    x[i].removeEventListener("load", iOSTrackLoaded);
13150                    y.push(x[i])
13151                }
13152            }
13153            for (var i = 0; i < y.length; i++) {
13154                pjstg.removeChild(y[i])
13155            }
13156            for (var i = 0; i < pjstg.textTracks.length; i++) {
13157                pjstg.textTracks[i].mode = 'hidden'
13158            }
13159            o.nativesub = false
13160        };
13161        this.addTrack = function (x, y, z) {
13162            if (x != '') {
13163                if (x.indexOf(' or ') > 0) {
13164                    var xx = x.split(' or ');
13165                    x = xx[0]
13166                }
13167                var track = document.createElement('track');
13168                track.setAttribute('src', x);
13169                track.setAttribute('label', y);
13170                track.setAttribute('kind', 'subtitles');
13171                track.setAttribute('mode', 'showing');
13172                if (z) {
13173                    track.setAttribute('default', '')
13174                }
13175                pjstg.appendChild(track);
13176                track.addEventListener("load", iOSTrackLoaded)
13177            }
13178        };
13179
13180        function iOSTrackLoaded(e) {
13181            if (e.target.label && o.sbt) {
13182                for (var i = 0;
13182 i < o.files_subtitle.length; i++) {
13183                    if (o.files_subtitle[i] == e.target.label) {
13184                        o.sbt.SetSubtitle(i)
13185                    }
13186                }
13187            }
13188        };
13189        this.errorMessage = function () {
13190            return error ? error : ''
13191        };
13192        this.Remove = function () {
13193            clearInterval(o.dashInterval);
13194            is_hls && hls ? hls.destroy() : '';
13195            is_dash && dash_created ? o.dash.reset() : '';
13196            is_ws && ws ? ws.stop() : '';
13197            pjstg.removeEventListener('error', onTagError);
13198            pjstg.removeEventListener('ended', onEnded);
13199            pjstg.removeEventListener('play', onPlay);
13200            pjstg.removeEventListener('pause', onPause);
13201            pjstg.removeEventListener('timeupdate', onTimeupdate);
13202            pjstg.removeEventListener('seeking', onSeeking);
13203            pjstg.removeEventListener('seeked', onSeeked);
13204            pjstg.removeEventListener('loadedmetadata', onMeta);
13205            pjstg.removeEventListener('volumechange', onVolume);
13206            pjstg.removeEventListener('waiting', onWaiting);
13207            pjstg.removeEventListener('durationchange', onDuration);
13208            pjstg.removeEventListener('enterpictureinpicture', onPipEnter);
13209            pjstg.removeEventListener('leavepictureinpicture', onPipLeave);
13210            pjstg.removeEventListener('webkitneedkey', onWkitKey);
13211            pjstg.src = '';
13212            if (container.tagName == "IFRAME") {
13213                container.contentDocument.body.removeChild(pjstg)
13214            } else {
13215                container.removeChild(pjstg)
13216            }
13217            pjstg = null
13218        }
13219    };
13220    var Controls = function () {
13221        var b = [];
13222        var butNames = [];
13223        var butPosition = [];
13224        var waiting = false;
13225        var wait_to;
13226        var toolbarHidden = false;
13227        var settings;
13228        var playlist;
13229        if (o.settings2) {
13230            o.settings2.hide();
13231            o.settings2 = null
13232        }
13233        var _lastactbut;
13234        o.files_speed = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
13235        if (v.settings.customspeeds == 1 && exist(v.settings.speeds)) {
13236            v.settings.speeds = v.settings.speeds.replace(/\n/ig, '');
13237            o.files_speed = v.settings.speeds.split(",")
13238        }
13239        o.speed1 = indOf(o.files_speed, 1, true);
13240        o.current_speed == 3 ? o.current_speed = o.speed1 : '';
13241        for (var i in o.menuproc) {
13242            if (o.menuproc.hasOwnProperty(i)) {
13243                !exist(v.settings[i]) ? v.settings[i] = 5 : '';
13244                o['files_' + i] = ['+ ' + v.settings[i] + '%', '&ndash; ' + v.settings[i] + '%', (o.menuproc[i] * 100 + '%')]
13245            }
13246        }
13247        if (v.toolbar.hidejustfull == 1 && o.system.ios && v.nativefullios == 1) {
13248            v.toolbar.hide = 0
13249        }
13250        var resizeonwidth = false;
13251        var stretch_width = 0;
13252        var stretch_width_last = 0;
13253        var stretch_with_volume = false;
13254        var firstly = true;
13255        var uijs;
13256        var bg = new ControlsBg();
13257        var settings;
13258        var order = [];
13259        var _rights = false;
13260        var _move_rights = false;
13261        var _max_order = 0;
13262        var _rb = [];
13263        if (v.control_line.position == "controls-right") {
13264            v.control_line.position = "controls"
13265        }
13266        for (var y in v) {
13267            if (v.hasOwnProperty(y)) {
13268                if (y.indexOf("control_") == 0 && v[y]) {
13269                    !exist(v[y].order0) ? v[y].order0 = v[y].order : v[y].order = v[y].order0;
13270                    if (order[v[y].order]) {
13271                        v[y].order += v[y].order
13272                    }
13273                    order[v[y].order] = y;
13274                    if (v.control_line.position != "controls") {
13275                        if (v[y].position == "controls-right") {
13276                            _rb.push([y, v[y].order]);
13277                            _rights = true
13278                        } else {
13279                            if (v[y].position == "controls" || v[y].position == undefined) {
13280                                _rights ? _move_rights = true : ''
13281                            }
13282                        }
13283                    }
13284                    _max_order < v[y].order ? _max_order = v[y].order : ''
13285                }
13286            }
13287        }
13288        if (_move_rights) {
13289            _rb.sort(function (a, b) {
13290                return a[1] - b[1]
13291            });
13292            for (var i = 0; i < _rb.length; i++) {
13293                order[v[_rb[i][0]].order] = null;
13294                v[_rb[i][0]].order = _max_order + 1;
13295                _max_order++;
13296                order[v[_rb[i][0]].order] = _rb[i][0]
13297            }
13298        }
13299        o.tlbrhd = v.toolbar.hide == 1 && v.toolbar.hidedown == 1;
13300        if (o.tlbrhd) {
13301            o.toolbar = createElement("div");
13302            o.frame.appendChild(o.toolbar);
13303            css(o.toolbar, {
13304                'position': 'absolute',
13305                'left': 0,
13306                'top': 0,
13307                'width': '100%',
13308                'height': '100%',
13309                'transition': 'top 0.3s ease-out',
13310                'pointer-events': 'none'
13311            })
13312        }
13313        var bg2 = createElement("div");
13314        if (o.tlbrhd) {
13315            o.toolbar.appendChild(bg2)
13316        } else {
13317            o.frame.appendChild(bg2)
13318        }
13319        var bgtop;
13320        if (v.toolbar.grdt == 1) {
13321            bgtop = new ControlsBg(true)
13322        }
13323        css(bg2, {
13324            'position': 'absolute',
13325            'left': 0,
13326            'bottom': 0,
13327            'width': '100%',
13328            'height': v.toolbar.h
13329        });
13330        bg2.onclick = function () {
13331            !o.system.mobile ? o.actions.ControlsBgClick() : ''
13332        };
13333        if (v.nocontrols == 1) {
13334            hide2(bg.c());
13335            hide2(bg2)
13336        }
13337        for (var i = 1; i < order.length; i++) {
13338            if (order[i]) {
13339                var y = order[i];
13340                if (y) {
13341                    var action = v[y].action;
13342                    var hdn = v[y].hide;
13343                    if (o.system.mobile) {
13344                        if (action == "volume" && v[y].customline == "speed") {} else {
13345                            if (action == "volume" && v.showvolmobile == 1 && o.system.mobile) {
13346                                v[y].hideoutmute = 0
13347                            } else {
13348                                if (action == "volume" || (action == "fullscreen" && v.nativemobile)) {
13349                                    v[y].on = 0
13350                                }
13351                            }
13352                        }
13353                        if (action == "buffer") {
13354                            v[y].hdbfmb == 1 ? v[y].on = 0 : ''
13355                        }
13356                    } else {
13357                        if (action == "buffer") {
13358                            v[y].hdbfdt == 1 ? v[y].on = 0 : ''
13359                        }
13360                    }
13361                    if (v[y].hide == 1) {
13362                        if (v[y].hideonvar == 1 && exist(v[y].hidevar)) {
13363                            options[v[y].hidevar] ? v[y].on = 0 : ''
13364                        }
13365                        if (v[y].hidewovar == 1 && exist(v[y].hidevar2)) {
13366                            !options[v[y].hidevar2] ? v[y].on = 0 : ''
13367                        }
13368                    }
13369                    if (v.nocontrols == 1) {
13370                        v[y].on = 0
13371                    }
13372                    if (v[y].on == 1) {
13373                        if (action == "line" || action == "volume") {
13374                            b[y] = new ControlLine(y, action);
13375                            b[y].Resize(b[y].s("w"))
13376                        } else {
13377                            b[y] = new Control(y)
13378                        }
13379                        butNames.push(y);
13380                        if (b[y].g("action") == "title") {
13381                            if (b[y].s("text") == '') {
13382                                if (b[y].s("var") != '') {
13383                                    if (!exist(v[b[y].s("var")])) {
13384                                        b[y].set("display", false)
13385                                    }
13386                                } else {
13387                                    b[y].set("display", false)
13388                                }
13389                            }
13390                        }
13391                        if (b[y].g("action") == "custom") {
13392                            var lu = b[y].s("linkurl");
13393                            if (lu) {
13394                                if (lu.indexOf("api:") == 0 && lu.indexOf(",0/1") > 0) {
13395                                    var z = lu.split(",");
13396                                    apiProcessor(z[0].substr(4)) == 0 ? b[y].CustomSwitch(0) : ''
13397                                }
13398                                if (indOf([lu], "share")) {
13399                                    o.shareme = true
13400                                }
13401                            }
13402                        }
13403                        b[y].set("scale", b[y].s("scale"))
13404                    }
13405                }
13406            }
13407        }
13408        if (exist(v.settings)) {
13409            if (typeof (Settings) == 'function') {
13410                settings = new Settings("settings");
13411                v.settings.always == 1 ? settings.show() : settings.hide()
13412            } else {
13413                o.noset = true
13414            }
13415        }
13416        if (exist(v.playlist)) {
13417            if (typeof (Settings) == 'function') {
13418                playlist = new Settings("playlist");
13419                if (exist(o.playlist)) {
13420                    playlist.updatePlaylist(o.playlist);
13421                    if (v.playlist.openplaylistbefore == 0 || !exist(v.playlist.openplaylistbefore)) {
13422                        v.playlist.always == 0 ? playlist.hide() : ''
13423                    } else {
13424                        playlist.show()
13425                    }
13426                    if (v.playlist.always2 == 1) {
13427                        playlist.show()
13428                    }
13429                } else {
13430                    playlist.hide(1)
13431                }
13432                PlaylistControls()
13433            }
13434        }
13435        CreateShare();
13436        CustomTextButs();
13437        Resize(true);
13438        ShowOrHide();
13439        SpeedChanged();
13440        firstly = false;
13441
13442        function ControlX(but) {
13443            var x = 0;
13444            var to_right = false;
13445            if (but) {
13446                if (but.g("action") == 'line') {
13447                    x = butPosition.left + but.s("marginleft") + but.g("width") / 2;
13448                    if (butPosition.rightbs != null) {} else {
13449                        butPosition.rightbs = []
13450                    }
13451                } else {
13452                    if (butPosition.rightbs != null) {
13453                        var but_space = but.g("width") + but.s("marginright") + but.s("marginleft");
13454                        if (HideProof(but)) {
13455                            but_space = 0
13456                        }
13457                        if (but.s("hidden") == 1 && !but.g("show")) {
13458                            but_space = 0
13459                        }
13460                        if (but.s("vertical") > 0) {
13461                            but_space = 0
13462                        }
13463                        x = bg.g("w") - v.toolbar.lrpd * 1 - but_space + but.g("width") / 2 + but.s("marginleft");
13464                        var i = 0;
13465                        butPosition.right -= but_space;
13466                        for (i = 0; i < butPosition.rightbs.length; i++) {
13467                            var but2 = b[butPosition.rightbs[i]];
13468                            if (but2.s("vertical") > 0) {
13469                                css(but2.c(), {
13470                                    "left": (but2.g("x0") - but_space)
13471                                })
13472                            } else {
13473                                css(but2.c(), {
13474                                    "left": (but2.g("x") - but_space)
13475                                })
13476                            }
13477                            but2.set("x0", but2.g("x"))
13478                        }
13479                        butPosition.rightbs.push(but.g("key"));
13480                        but.set('rightside', 1)
13481                    } else {
13482                        if (but.s("hidden") == 1 && !but.g("show") && !but.g("cul")) {
13483                            if (but.g("action") == "volume") {
13484                                if (but.s("hide") == 1 && but.s("hideoutmute") == 1 && stretch_with_volume) {
13485                                    stretch_width += but.g("width") + but.s("marginleft") + but.s("marginright");
13486                                    stretch_with_volume = false
13487                                }
13488                            }
13489                        } else {
13490                            if (but.s("vertical") > 0) {
13491                                x = butPosition.left + but.s("marginleft") + but.s("marginright")
13492                            } else {
13493                                var stop = false;
13494                                if (but.g("action") == "volume") {
13495                                    if (but.s("hide") == 1 && but.s("hideoutmute") == 1 && !but.g("cul")) {
13496                                        if (!o.hidden_volume_over_process && !o.hidden_volume_over) {
13497                                            stop = true;
13498                                            stretch_with_volume = false
13499                                        } else {
13500                                            if (!stretch_with_volume) {
13501                                                stretch_width -= but.g("width") + but.s("marginleft") + but.s("marginright");
13502                                                stretch_with_volume = true
13503                                            }
13504                                        }
13505                                    }
13506                                }
13507                                if (HideProof(but)) {
13508                                    stop = true
13509                                }
13510                                if (!stop) {
13511                                    butPosition.left += but.g("width") / 2 + but.s("marginleft");
13512                                    x = butPosition.left;
13513                                    butPosition.left += but.g("width") / 2 + but.s("marginright")
13514                                } else {
13515                                    x = butPosition.left
13516                                }
13517                            }
13518                        }
13519                    }
13520                }
13521            }
13522            return x
13523        };
13524        this.NewPl = function () {
13525            CreateShare();
13526            if (playlist && v.playlist.always && !o.start) {
13527                playlist.show()
13528            }
13529        };
13530        this.CrShr = function () {
13531            CreateShare()
13532        };
13533
13534        function CreateShare() {
13535            if (o.shareme) {
13536                typeof PluginShare == 'function' ? o.share = new PluginShare() : ''
13537            }
13538        }
13539
13540        function ControlCoordinate(but) {
13541            var width = o.fullscreen && v.toolbar.stretchonfullscreen == 0 ? o.normal_w : o.screen_w;
13542            var height = o.screen_h;
13543            var but_x = 0;
13544            if (but != bg) {
13545                but_x = width / 2 + but.s("marginleft") - but.s("marginright")
13546            }
13547            var but_y = height / 2;
13548            var but_w = but.g("width");
13549            var but_h = but.g("height");
13550            var p = but.s("position");
13551            if (p.indexOf("center") > -1) {
13552                but_x = o.screen_w / 2 + but.s("marginleft") - but.s("marginright")
13553            }
13554            if (p.indexOf("top") == 0) {
13555                but_y = but_h / 2 + (but.s("marginproctop") * o.screen_h / 100)
13556            }
13557            if (p.indexOf("bottom") == 0) {
13558                but_y = o.screen_h - (but == bg ? but_h : but_h / 2) - (but.s("marginprocbottom") * o.screen_h / 100)
13559            }
13560            if (p.indexOf("right") > -1) {
13561                but_x = o.screen_w - but_w / 2 + but.s("marginleft") - but.s("marginright") - (but.s("marginprocright") * o.screen_w / 100)
13562            }
13563            if (p.indexOf("left") > -1) {
13564                but_x = but_w / 2 + but.s("marginleft") - but.s("marginright") + (but.s("marginprocleft") * o.screen_w / 100)
13565            }
13566            if (p.indexOf("timeline") > -1) {
13567                but_y = -o.timeline_h / 2 - (but.s("marginprocbottom") * o.timeline_h / 100) + (but.s("marginproctop") * o.timeline_h / 100);
13568                but_x = (p == "timeline" ? -1 : 1) * o.timeline_w / 2 + (but.s("marginprocleft") * o.timeline_w / 100) + but.s("marginleft") - but.s("marginright")
13569            }
13570            if (p.indexOf("controls") > -1) {
13571                var cx = ControlX(but);
13572                but_x = (bg ? (bg.c() ? int(bg.c().offsetLeft) : 0) : 0) + cx;
13573                if (p == "controls-right") {
13574                    but_x += stretch_width
13575                }
13576                if (v.toolbar.position == "top") {
13577                    but_y = v.toolbar.h / 2 - (v.toolbar_margintop < 0 ? v.toolbar_margintop : 0)
13578                } else {
13579                    but_y = height - v.toolbar.h / 2
13580                }
13581            }
13582            return {
13583                x: but_x,
13584                y: but_y + but.s("margintop") - but.s("marginbottom")
13585            }
13586        }
13587
13588        function Resize(all) {
13589            var w = o.fullscreen && v.toolbar.stretchonfullscreen == 0 ? o.normal_w : o.screen_w;
13590            var h = o.screen_h;
13591            if (v.toolbar.lrpp == 1) {
13592                v.toolbar.lrppp = exist2(v.toolbar.lrpps) && o.small ? v.toolbar.lrpps : v.toolbar.leftandrightpadding;
13593                v.toolbar.lrpd = o.screen_w * v.toolbar.lrppp / 100
13594            } else {
13595                v.toolbar.lrpd = v.toolbar.leftandrightpadding
13596            }
13597            css(bg.c(), {
13598                'top': (v.toolbar.position == "top" ? 0 : o.screen_h - v.toolbar.h) - v.toolbar_margintop
13599            });
13600            bg.set("y0", (o.screen_h - v.toolbar.h - v.toolbar_margintop));
13601            if (v.toolbar.stretchonfullscreen == 0 && bg) {
13602                css(bg.c(), {
13603                    'width': w,
13604                    'left': 0,
13605                    'margin-left': 0
13606                });
13607                bg.set("w", w);
13608                if (o.fullscreen) {
13609                    css(bg.c(), {
13610                        'left': '50%',
13611                        'margin-left': -w / 2
13612                    })
13613                }
13614            }
13615            butPosition = {
13616                "left": v.toolbar.lrpd * 1,
13617                "right": (bg.g("w") - v.toolbar.lrpd * 1)
13618            };
13619            var bg_hide = false;
13620            if (!bg.g("show")) {
13621                bg.set("display", true);
13622                bg_hide = true
13623            }
13624            var key;
13625            for (var i = 0; i < butNames.length; i++) {
13626                key = butNames[i];
13627                if (b[key]) {
13628                    var cc = ControlCoordinate(b[key]);
13629                    if (cc) {
13630                        if (b[key].s("animation") == "position") {
13631                            if (exist(o.motions[key])) {
13632                                if (b[key].g("x0") == cc.x && b[key].g("y0") == cc.y) {
13633                                    continue
13634                                } else {
13635                                    o.motions[key].XY(b[key].g("x0"), cc.x, b[key].g("y0"), cc.y)
13636                                }
13637                            }
13638                        }
13639                        b[key].set("x0", cc.x);
13640                        b[key].set("y0", cc.y);
13641                        if (b[key].s("hidden") == 1 && !b[key].g("show") && !all) {
13642                            HidePositionControl(b[key])
13643                        } else {
13644                            css(b[key].c(), {
13645                                "position": "absolute",
13646                                "left": b[key].g("x0"),
13647                                "top": b[key].g("y0")
13648                            })
13649                        }
13650                    }
13651                }
13652            }
13653            if (bg_hide) {
13654                bg.set("display", false)
13655            }
13656            stretch_width = 0;
13657            for (key in b) {
13658                if (b.hasOwnProperty(key)) {
13659                    if (b[key].s("position") == "controls-right" && b[key].g("action") != "line" && stretch_width > -1) {
13660                        stretch_width = butPosition.right - butPosition.left
13661                    }
13662                    if (b[key].g("action") == "line" && bg) {
13663                        var line_width;
13664                        var ml = b[key].s("marginleft") + b[key].s("marginprocleft") * o.screen_w / 100;
13665                        var mr = b[key].s("marginright") + b[key].s("marginprocright") * o.screen_w / 100;
13666                        if (b[key].s("customwidth") == 1) {
13667                            if (b[key].s("wproc") == 1) {
13668                                line_width = (o.screen_w * b[key].s("w") / 100) - ml - mr
13669                            } else {
13670                                line_width = b[key].s("w")
13671                            }
13672                        } else {
13673                            if (b[key].s("position").indexOf("controls") > -1) {
13674                                line_width = butPosition.right - butPosition.left - ml - mr;
13675                                css(b[key].c(), {
13676                                    "left": (int(bg.c().offsetLeft) + butPosition.left + ml + line_width / 2)
13677                                });
13678                                stretch_width = -1
13679                            } else {
13680                                line_width = bg.g("w") - ml - mr;
13681                                if (bg.c()) {
13682                                    css(b[key].c(), {
13683                                        "left": (int(bg.c().offsetLeft) + ml + line_width / 2)
13684                                    })
13685                                }
13686                            }
13687                        }
13688                        b[key].set("x0", b[key].g("x"));
13689                        b[key].Resize(line_width)
13690                    }
13691                }
13692            }
13693            if (settings) {
13694                ResizeSettings(settings)
13695            }
13696            if (playlist) {
13697                ResizeSettings(playlist)
13698            }
13699            if (resizeonwidth || o.fullscreen || stretch_width_last != stretch_width) {
13700                ShowOrHide()
13701            }
13702        }
13703
13704        function HidePositionControl(b) {
13705            var left = 0;
13706            var top = 0;
13707            if (b.s("position").indexOf("right") > -1 && b.s("position").indexOf("controls") == -1) {
13708                left = o.screen_w + b.g("width") + 10
13709            }
13710            if (b.s("position").indexOf("left") > -1) {
13711                left = -b.g("width") - 10
13712            }
13713            if (b.s("position").indexOf("top") > -1) {
13714                top = -b.g("height") * 2
13715            }
13716            if (b.s("position").indexOf("bottom") > -1 || b.s("position").indexOf("controls") > -1) {
13717                top = o.screen_h + b.g("height") + b.g("width") + 10
13718            }
13719            if (left > 0) {
13720                css(b.c(), {
13721                    "left": left
13722                })
13723            }
13724            if (top > 0) {
13725                css(b.c(), {
13726                    "top": top
13727                })
13728            }
13729        }
13730
13731        function ResizeSettings(x) {
13732            var top = -2000;
13733            x.resizePlaylist();
13734            var y = o.screen_h - v.toolbar.h * (x.s("position").indexOf("top") > -1 ? 1 : 2);
13735            if (x == playlist && v.change2playlist == 1) {
13736                y = o.screen_h
13737            }
13738            var hmx = (o.system.mobile && o.screen_h < 450 && exist(x.s("hmaxk2")) ? x.s("hmaxk2") : x.s("hmaxk")) * 1;
13739            var ymax = y - (o.fullscreen && !o.system.mobile ? 100 + hmx : hmx) - (x == playlist && hmx == 0 ? x.s("margintop") : 0);
13740            ymax < 100 ? ymax = 100 : '';
13741            css(x.c(), {
13742                'max-height': ymax
13743            });
13744            x.co() ? css(x.co(), {
13745                'max-height': ymax
13746            }) : '';
13747            if (x.g("show")) {
13748                top = o.screen_h / 2 - x.g("height") / 2 + x.s("margintop") - x.s("marginbottom");
13749                if (x.s("position").indexOf("top") > -1) {
13750                    top = x.s("margintop") - x.s("marginbottom")
13751                }
13752                if (x.s("position").indexOf("bottom") > -1) {
13753                    top = o.screen_h - (v.toolbar.position != 'top' ? v.toolbar.h : 0) - x.g("height") + x.s("margintop") - x.s("marginbottom")
13754                }
13755                top < 0 ? top = 0 : ''
13756            }
13757            if (x.g("key") == "settings" && o.sttx) {
13758                var sttr = o.screen_w - x.g("width") - x.s("marginright");
13759                if (o.sttx > sttr) {
13760                    css(x.c(), {
13761                        "position": "absolute",
13762                        "right": x.s("marginright"),
13763                        "left": "auto",
13764                        "top": top
13765                    })
13766                } else {
13767                    css(x.c(), {
13768                        "position": "absolute",
13769                        "left": o.sttx,
13770                        "right": "auto",
13771                        "top": (o.stty < top ? o.stty : top)
13772                    })
13773                }
13774            } else {
13775                if (x.s("position").indexOf("right") > -1) {
13776                    css(x.c(), {
13777                        "position": "absolute",
13778                        "right": x.s("marginright") - x.s("scrollwidth"),
13779                        "left": "auto",
13780                        "top": top
13781                    })
13782                } else if (x.s("position").indexOf("left") > -1) {
13783                    css(x.c(), {
13784                        "position": "absolute",
13785                        "left": x.s("marginleft"),
13786                        "right": "auto",
13787                        "top": top
13788                    })
13789                } else {
13790                    if (x.g("key") == "playlist" && x.s("floatleft") == 1) {
13791                        css(x.c(), {
13792                            "position": "absolute",
13793                            "left": o.screen_w / 2 - x.g("width") / 2 + x.s("marginleft") / 2 - x.s("marginright") / 2,
13794                            "top": top
13795                        })
13796                    } else {
13797                        var l = o.screen_w / 2 - x.g("width") / 2 + x.s("marginleft") - x.s("marginright");
13798                        css(x.c(), {
13799                            "position": "absolute",
13800                            "left": (l > 0 ? l : 0),
13801                            "top": top
13802                        })
13803                    }
13804                }
13805            }
13806            x.Arrows()
13807        };
13808        this.ControlClick = function (key) {
13809            var but = b[key];
13810            var a = but.g("action");
13811            if (a) {
13812                var d = new Date();
13813                o.clicktime = d.getTime();
13814                if (a && a != "") {
13815                    Action(but);
13816                    a == "pause" ? o.actpause = 1 : '';
13817                    a == "play" ? o.actpause = 0 : ''
13818                }
13819            }
13820            JsClk()
13821        };
13822        this.toggleControl = function (z, x, y) {
13823            for (var key in b) {
13824                if (b.hasOwnProperty(key)) {
13825                    if (b[key].s(z) == x) {
13826                        b[key].set(y ? "show2" : "hide2")
13827                    }
13828                }
13829            }
13830        };
13831        this.butByS = function (x, s) {
13832            var y = FindBut(s, x);
13833            return y
13834        };
13835
13836        function Action(but, type) {
13837            o.acted = true;
13838            _lastactbut = but;
13839            var a = but.g("action");
13840            if (a == "play") {
13841                o.actions.Play();
13842                if (o.muted && v.unmuteonplay == 1) {
13843                    o.actions.Unmute();
13844                    v.unmuteonplay = 0
13845                }
13846                if (v.hotkey.on == 1 && v.hotkey.icons == 1 && v.hotkey.playiconbut == 1) {
13847                    PluginHotIcon('play', 1)
13848                }
13849                js("userplay")
13850            } else {
13851                if (a == "pause") {
13852                    o.rldplay = 0;
13853                    o.actions.Pause();
13854                    if (v.hotkey.on == 1 && v.hotkey.icons == 1 && v.hotkey.playiconbut == 1) {
13855                        PluginHotIcon('play', 0)
13856                    }
13857                    js("userpause")
13858                }
13859                if (a == "stop") {
13860                    o.actions.StopMedia()
13861                }
13862            }
13863            if (a == "back") {
13864                o.actions.Seek(0, false)
13865            }
13866            if (a == "fullscreen") {
13867                !o.casting ? o.actions.Fullscreen() : ''
13868            } else {
13869                if (a == "normalscreen") {
13870                    o.actions.Normalscreen()
13871                }
13872            }
13873            if (a == "line") {
13874                var ld = o.media.duration();
13875                var lt = but.g("click") * ld;
13876                if (v.delete > 0) {
13877                    ld -= v.delete * 1;
13878                    lt = but.g("click") * ld + v.delete * 1
13879                }
13880                if (v.seekwindow > 0) {
13881                    if (v.seekwindow / ld <= 1 - but.g("click")) {
13882                        return
13883                    }
13884                }
13885                js(a, lt);
13886                o.actions.Seek(lt, true);
13887                if (o.continue) {
13888                    o.continue.write(lt, ld);
13889                    o.seekto > 0 ? o.seekto = undefined : ''
13890                }
13891                js("userseek", lt)
13892            }
13893            if (a == "volume") {
13894                var x = but.g("click");
13895                x < 0.02 ? x = 0 : '';
13896                x > 1 ? x = 1 : '';
13897                if (but.s("customline") == "speed") {
13898                    x = parseFloat(x * o.files_speed.slice(-1)[0]).toFixed(1);
13899                    o.actions.SetSpeed(x, 1)
13900                } else if (but.s("customline") == "volume2") {
13901                    o.media.pipVol(x)
13902                } else {
13903                    if (o.storage && v.volumestore == 1) {
13904                        localStorage.setItem("pljsvolume", x);
13905                        if (but.g("click") > 0 || o.system.iphone || v.mutestore == 0) {
13906                            localStorage.removeItem("pljsmute")
13907                        } else {
13908                            localStorage.setItem("pljsmute", 1)
13909                        }
13910                    }
13911                    o.actions.Volume(x)
13912                }
13913            }
13914            if (a == "mute") {
13915                if (o.storage && !o.system.iphone && v.mutestore == 1) {
13916                    localStorage.setItem("pljsmute", 1)
13917                }
13918                o.actions.Mute();
13919                if (v.hotkey.icons == 1 && v.hotkey.muteiconbut == 1) {
13920                    PluginHotIcon('mute', 0)
13921                }
13922            } else {
13923                if (a == "unmute") {
13924                    if (o.storage) {
13925                        localStorage.removeItem("pljsmute")
13926                    }
13927                    o.actions.Unmute();
13928                    if (v.hotkey.icons == 1 && v.hotkey.muteiconbut == 1) {
13929                        PluginHotIcon('mute', 1)
13930                    }
13931                }
13932            }
13933            if (a.indexOf("time") == 0) {
13934                but.isOn() ? but.Off() : but.On()
13935            }
13936            if (a == "rotate") {
13937                o.media.Rotate()
13938            }
13939            if (a == "scale+") {
13940                o.media.Scale(0.1)
13941            }
13942            if (a == "scale-") {
13943                o.media.Scale(-0.1)
13944            }
13945            if (a == "scale") {
13946                o.media.Scale(0)
13947            }
13948            if (a == "live") {
13949                apiProcessor("restart");
13950                but.set("iconopacity", 1);
13951                but.set("saturate", 1)
13952            }
13953            if (a == "share") {
13954                js("share");
13955                ShowShare()
13956            }
13957            if (a == "settings") {
13958                o.sttx = undefined;
13959                if (settings) {
13960                    if (!settings.g("show")) {
13961                        settings.show()
13962                    } else {
13963                        settings.hide()
13964                    }
13965                }
13966            }
13967            if (a == "playlist") {
13968                if (o.overopentimeout == a) {
13969                    return
13970                }
13971                o.controls.PlaylistShow()
13972            }
13973            if (a == "next") {
13974                o.controls.PlaylistNext()
13975            }
13976            if (a == "prev") {
13977                o.controls.PlaylistPrev()
13978            }
13979            if (a == "custom") {
13980                if (but.s("link") == 1 && but.s("linkurl") != "") {
13981                    var x = trim(but.s("linkurl"));
13982                    if (o.overopentimeout == a + x) {
13983                        return
13984                    }
13985                    if (x.indexOf('{time}') > -1) {
13986                        x = x.replace('{time}', (exist(o.continue) ? o.continue.flag().t : o.media.time()))
13987                    }
13988                    if (x.indexOf('{file}') > -1) {
13989                        x = x.replace('{file}', o.media.currentFile())
13990                    }
13991                    if (x.indexOf('{title}') > -1) {
13992                        x = x.replace('{title}', v.title.replace(/,/ig, " "))
13993                    }
13994                    if (x == "airplay") {
13995                        o.media.Airplay()
13996                    }
13997                    if (x.indexOf('skip') == 0) {
13998                        if (but.s("skip") > 0) {
13999                            o.actions.Seek(o.skpbt ? o.skpbt.tskp() : but.s("skip"))
14000                        }
14001                    }
14002                    if (x.indexOf('cancelskip') == 0) {
14003                        if (o.skpbt) {
14004                            o.skpbt.cancel()
14005                        }
14006                    }
14007                    if (x == "seektome") {
14008                        o.actions.Seek(but.s("marginprocleft") * o.media.duration() / 100);
14009                        !o.play ? o.actions.Play() : ''
14010                    }
14011                    but.s("linkpause") == 1 ? o.actions.Pause() : '';
14012                    var y = x.split(",");
14013                    if (x.indexOf("api:") == 0) {
14014                        var z = x.substr(4).split(";");
14015                        for (var i = 0; i < z.length; i++) {
14016                            y = z[i].split(",");
14017                            if (y.length > 1) {
14018                                if (y[0] == 'seek') {
14019                                    if (v.hotkey.icons == 1 && v.hotkey.seekiconbut == 1) {
14020                                        PluginHotIcon('seek', y[1] > 0 ? 1 : 0)
14021                                    }
14022                                }
14023                                apiProcessor(y[0], y[1], but);
14024                                js("userseek", y[1]);
14025                                y[1] == '0/1' || y[1] == '1/0' ? reRightMenu() : ''
14026                            } else {
14027                                if (y[0] == "screenshot") {
14028                                    var ss = apiProcessor(y[0]);
14029                                    if (ss) {
14030                                        if (ss.indexOf("data") > -1) {
14031                                            if (v.ssfly == 1) {
14032                                                var img = document.createElement('img');
14033                                                img.setAttribute('src', ss);
14034                                                css(img, {
14035                                                    position: "fixed",
14036                                                    right: (exist(v.ssflyp) ? v.ssflyp : 20),
14037                                                    bottom: (exist(v.ssflyp) ? v.ssflyp : 20),
14038                                                    width: 0,
14039                                                    transition: "width 0.5s cubic-bezier(.75,-0.5,0,1.75)"
14040                                                });
14041                                                img.style.zIndex = 1001;
14042                                                document.body.appendChild(img);
14043                                                setTimeout(function () {
14044                                                    css(img, {
14045                                                        width: (exist(v.ssflyw) ? v.ssflyw : 200)
14046                                                    })
14047                                                }, 1);
14048                                                img.onclick = function () {
14049                                                    this.parentNode.removeChild(this)
14050                                                }
14051                                            }
14052                                            if (v.ssdown == 1) {
14053                                                var a = createElement("a");
14054                                                a.href = ss;
14055                                                a.download = y[0] + ".jpg";
14056                                                a.click()
14057                                            }
14058                                        }
14059                                    } else {
14060                                        log(y[0] + " error")
14061                                    }
14062                                } else {
14063                                    apiProcessor(y[0])
14064                                }
14065                            }
14066                        }
14067                    } else {
14068                        if (x.indexOf("js:") == 0) {
14069                            if (x.indexOf("(") > 0 && x.indexOf(")") > 0) {
14070                                eval(x.substr(3))
14071                            } else {
14072                                eval(y[0].substr(3) + '(' + (exist(y[1]) ? '"' + y[1] + '"' : '') + (exist(y[2]) ? ',"' + y[2] + '"' : '') + ')')
14073                            }
14074                        }
14075                        if (x.indexOf("event:") == 0) {
14076                            JsEvent(x.substr(6), o.media.time())
14077                        }
14078                        if (x.indexOf("share:") == 0 && o.share) {
14079                            o.share.api(x.substr(6))
14080                        }
14081                        if (x.indexOf("effect:") == 0 && o.effects) {
14082                            apiProcessor("effect", x.substr(7))
14083                        }
14084                        if (x.indexOf("http") == 0 || x.indexOf("/") == 0 || x.indexOf("?") == 0 || x.indexOf("url:") == 0) {
14085                            x.indexOf("url:") == 0 ? x = x.substr(4) : '';
14086                            window.open(x, but.s("linktarget"))
14087                        }
14088                        if (x.indexOf("download") == 0) {
14089                            o.actions.Download()
14090                        }
14091                        if (x == "api:pipwebkit") {
14092                            o.media.PipWebkit()
14093                        }
14094                    }
14095                    if (x.indexOf("settings#") > -1) {
14096                        if (settings) {
14097                            var si = x.substr(9).split(",");
14098                            if (settings.g("show") && settings.g("open") == si[0]) {
14099                                o.sttx = undefined;
14100                                o.stty = undefined;
14101                                settings.hide()
14102                            } else {
14103                                o.sttx = but.g("x") - but.g("width") / 2;
14104                                o.stty = but.g("y") + but.g("h");
14105                                for (var i = 0; i < si.length; i++) {
14106                                    i == 0 ? settings.show() : '';
14107                                    settings.open(si[i])
14108                                }
14109                                playlist ? playlist.plclose() : ''
14110                            }
14111                        }
14112                    }
14113                    if (x.indexOf("settings:") > -1 && v.settings.combined == 1) {
14114                        if (!o.settings2) {
14115                            o.settings2 = new PluginSettings2()
14116                        }
14117                        if (v.settings.showovercontrol == 1) {
14118                            if (type == "over") {
14119                                o.settings2.show(x)
14120                            } else {
14121                                o.settings2.toggle(x)
14122                            }
14123                        } else {
14124                            if (!type) {
14125                                o.settings2.toggle(x)
14126                            }
14127                        }
14128                    }
14129                    if (x == "unblock") {
14130                        o.actions.RemoveCurtain();
14131                        o.stopkeys = 0;
14132                        but.set("hide2");
14133                        var bl = FindBut("linkurl", "block");
14134                        if (bl) {
14135                            bl.set("hide2")
14136                        }
14137                    }
14138                    if (x == "block") {
14139                        but.UpdateText("OK");
14140                        but.s("linkurl2") ? window.location.href = trim(but.s("linkurl2")) : ''
14141                    }
14142                }
14143            }
14144        };
14145        this.title = function (t) {
14146            var y = false;
14147            for (var x in b) {
14148                if (b.hasOwnProperty(x)) {
14149                    if (b[x].g("action") == "title") {
14150                        if (b[x].s("var") == t || t == "title") {
14151                            if (b[x].s("hide") == 1 && b[x].s("hideonplay") == 1 && o.play) {
14152                                y = true
14153                            }
14154                            if (v[t] == '' || y) {
14155                                b[x].set("display", false)
14156                            } else {
14157                                b[x].set("display", true)
14158                            }
14159                            b[x].UpdateText(v[t])
14160                        }
14161                    }
14162                }
14163            }
14164            TitlePl()
14165        };
14166        this.titlepl = function () {
14167            TitlePl()
14168        };
14169        this.resizetext = function () {
14170            for (var x in b) {
14171                if (b.hasOwnProperty(x)) {
14172                    if (b[x].g("action") == "custom") {
14173                        if (b[x].s("type") == "text") {
14174                            b[x].ResizeText()
14175                        }
14176                    }
14177                }
14178            }
14179        };
14180
14181        function TitlePl() {
14182            for (var x in b) {
14183                if (b.hasOwnProperty(x)) {
14184                    if (b[x].g("action") == "custom") {
14185                        if (b[x].s("type") == "text") {
14186                            b[x].RenewFromTitle(true)
14187                        }
14188                    }
14189                }
14190            }
14191        }
14192
14193        function ShowShare() {
14194            if (exist(o.share)) {
14195                o.share.Show()
14196            }
14197        }
14198        this.showShare = function () {
14199            ShowShare()
14200        };
14201        this.updateTitle = function () {
14202            if (v.title != '') {
14203                for (var x in b) {
14204                    if (b.hasOwnProperty(x)) {
14205                        if (b[x].g("action") == "title") {
14206                            var y = false;
14207                            if (!b[x].g("show")) {
14208                                y = true;
14209                                b[x].set("display", true)
14210                            }
14211                            b[x].UpdateText(v.title);
14212                            if (y) {
14213                                b[x].set("display", false)
14214                            }
14215                        }
14216                    }
14217                }
14218            }
14219        };
14220        this.customTextPl = function () {
14221            CustomTextButs()
14222        };
14223
14224        function CustomTextButs() {
14225            if (v.customtext) {
14226                if (typeof (v.customtext) == "object") {
14227                    for (var x in v.customtext) {
14228                        if (v.customtext.hasOwnProperty(x)) {
14229                            CustomText(x, v.customtext[x])
14230                        }
14231                    }
14232                }
14233            }
14234        };
14235        this.customText = function (y, z) {
14236            CustomText(y, z)
14237        };
14238        this.upText = function (x) {
14239            if (b[x]) {
14240                b[x].UpText()
14241            }
14242        };
14243        this.upTexts = function () {
14244            for (var x in b) {
14245                if (b.hasOwnProperty(x)) {
14246                    if (b[x].g("ctxt")) {
14247                        b[x].UpText()
14248                    }
14249                }
14250            }
14251        };
14252
14253        function CustomText(y, z) {
14254            if (y) {
14255                for (var x in b) {
14256                    if (b.hasOwnProperty(x)) {
14257                        if (b[x].g("ctxt")) {
14258                            if (b[x].s("dom") == y) {
14259                                if ((!b[x].g("show") || b[x].s("hidden") == 1) && !HideProof(b[x])) {
14260                                    b[x].set("unhidden");
14261                                    b[x].set("display", true)
14262                                }
14263                                b[x].CustomText(z)
14264                            }
14265                        }
14266                    }
14267                }
14268            }
14269        };
14270        this.resize = function () {
14271            Resize()
14272        };
14273        this.resize2 = function () {
14274            Resize(true)
14275        };
14276        this.resizeSettings = function () {
14277            ResizeSettings(settings)
14278        };
14279        this.resizePlaylist = function () {
14280            ResizeSettings(playlist)
14281        };
14282        this.Play = function () {
14283            for (var x in b) {
14284                if (b.hasOwnProperty(x)) {
14285                    if (b[x].g("action") == "play") {
14286                        b[x].On()
14287                    }
14288                }
14289            }
14290            o.vast_loadtxt ? o.vast_loadtxt.hide() : '';
14291            ClosePl();
14292            o.play = true;
14293            ShowOrHide()
14294        };
14295        this.Pause = function () {
14296            for (var x in b) {
14297                if (b.hasOwnProperty(x)) {
14298                    if (b[x].g("action") == "pause" || b[x].g("action") == "stop") {
14299                        b[x].Off()
14300                    }
14301                }
14302            }
14303            if (playlist) {
14304                if (!o.newplay && v.playlist.openplaylistpause == 1 && !playlist.empty()) {
14305                    playlist.show()
14306                }
14307            }
14308            o.play = false;
14309            this.StopWaiting();
14310            ShowOrHide();
14311            if (v.toolbar.hide == 1 && v.toolbar.hideonpause == 1) {
14312                HideForce(true)
14313            }
14314            var y = FindBut("action", "live");
14315            if (y) {
14316                y.set("iconopacity", 0.5);
14317                y.set("saturate", 0)
14318            }
14319        };
14320        this.Mute = function () {
14321            for (var x in b) {
14322                if (b.hasOwnProperty(x)) {
14323                    if (b[x].g("action") == "mute") {
14324                        b[x].On()
14325                    }
14326                    this.Volume(0)
14327                }
14328            }
14329            ShowOrHide()
14330        };
14331        this.Unmute = function () {
14332            for (var x in b) {
14333                if (b.hasOwnProperty(x)) {
14334                    if (b[x].g("action") == "unmute") {
14335                        b[x].Off()
14336                    }
14337                }
14338            }
14339            if (v.volume < 0.1) {
14340                v.volume = 0.5;
14341                o.actions.Volume(v.volume)
14342            } else {
14343                this.Volume(v.volume)
14344            }
14345            ShowOrHide()
14346        };
14347        this.Volume = function (volume, y) {
14348            for (var x in b) {
14349                if (b.hasOwnProperty(x)) {
14350                    if (b[x].g("action") == "volume") {
14351                        if (!b[x].s("customline") || b[x].s("customline") == "volume") {
14352                            b[x].UpdatePlay(volume, 1, (y == "no" ? y : true))
14353                        }
14354                    }
14355                    if (b[x].g("action") == "mute") {
14356                        b[x].UpdateVolume(volume)
14357                    }
14358                }
14359            }
14360            ShowOrHide()
14361        };
14362        this.Fullscreen = function () {
14363            var bl = FindBut("action", "fullscreen");
14364            if (bl) {
14365                bl.On();
14366                bl.set("scale", bl.s("scale"))
14367            }
14368            ShowOrHide();
14369            resizeonwidth ? setTimeout(ShowOrHide, 500) : '';
14370            if (o.fullscreen && o.rszr) {
14371                if (o.system.win || o.system.tv) {
14372                    setTimeout(Resize, 10)
14373                }
14374            }
14375            HideInterval();
14376            CloseSttx()
14377        };
14378        this.Normalscreen = function () {
14379            var bl = FindBut("action", "fullscreen");
14380            if (bl) {
14381                bl.Off()
14382            }
14383            Resize();
14384            clearInterval(o.toolbarInterval);
14385            ShowOrHide();
14386            CloseSttx()
14387        };
14388
14389        function CloseSttx() {
14390            if (o.sttx) {
14391                o.sttx = undefined;
14392                o.stty = undefined;
14393                settings.hide()
14394            }
14395        }
14396        this.onEnded = function () {
14397            for (var x in b) {
14398                if (b.hasOwnProperty(x)) {
14399                    if (b[x].g("action") == "play") {
14400                        b[x].ReplayIcon()
14401                    }
14402                }
14403            }
14404        };
14405        this.Review = function () {
14406            ShowOrHide()
14407        };
14408        this.closePl = function () {
14409            ClosePl()
14410        };
14411
14412        function ClosePl() {
14413            if (playlist) {
14414                if (playlist.g("show") && v.playlist.autohide == 1) {
14415                    o.controls.Playlist()
14416                }
14417            }
14418        }
14419
14420        function ShowOrHide() {
14421            for (var x in b) {
14422                if (b.hasOwnProperty(x)) {
14423                    if (b[x].g("action") != "buffer") {
14424                        ShowOrHideProcessor(b[x])
14425                    }
14426                }
14427            }
14428            ShowOrHideProcessor(bg);
14429            if (stretch_width_last != stretch_width) {
14430                stretch_width_last = stretch_width;
14431                Resize()
14432            }
14433            if (o.tlbrhd) {
14434                ToolbarDown(!o.starttimeout && !o.mouseHere && !o.fullscreen && o.play && v.toolbar.hidejustfull != 1 && !o.casting)
14435            }
14436        };
14437
14438        function ShowForce() {
14439            var show = toolbarHidden && v.toolbar.hidewithoutmoving == 1;
14440            if (v.toolbar.hide == 1) {
14441                if (!o.play && v.toolbar.hideonpause == 1) {
14442                    show = false
14443                }
14444            }
14445            if (show) {
14446                for (var x in b) {
14447                    if (b.hasOwnProperty(x)) {
14448                        if (b[x].g("action") != "buffer") {
14449                            ShowOrHideProcessor(b[x], false)
14450                        }
14451                    }
14452                }
14453                css(o.frame, {
14454                    "cursor": "default"
14455                });
14456                o.fcdef = true;
14457                ShowOrHideProcessor(bg, false);
14458                if (bg.g("show")) {
14459                    ToolbarShow()
14460                }
14461                ToolbarDown(false)
14462            }
14463        }
14464
14465        function HideForce() {
14466            var hide = o.play && v.toolbar.hidewithoutmoving == 1 && !o.mouseDown;
14467            if (o.controlover && v.toolbar.showovr == 1) {
14468                hide = false
14469            }
14470            if (!o.play && v.toolbar.hide == 1 && v.toolbar.hideonpause == 1) {
14471                hide = true
14472            }
14473            if (settings) {
14474                if (settings.g("show") && o.setaction) {
14475                    hide = false
14476                }
14477            }
14478            if (o.casting) {
14479                hide = false
14480            }
14481            if (hide) {
14482                for (var x in b) {
14483                    if (b.hasOwnProperty(x)) {
14484                        if (b[x].g("action") != "buffer") {
14485                            ShowOrHideProcessor(b[x], true)
14486                        }
14487                    }
14488                }
14489                ShowOrHideProcessor(bg, true);
14490                if (!bg.g("show")) {
14491                    toolbarHidden = true;
14492                    o.media.ToolbarHide();
14493                    if (o.play) {
14494                        css(o.frame, {
14495                            "cursor": "none"
14496                        });
14497                        o.fcdef = false
14498                    }
14499                }
14500                ToolbarDown(true)
14501            }
14502        }
14503
14504        function HideInterval() {
14505            if (v.toolbar.hidewithoutmoving == 1) {
14506                if (v.toolbar.hidejustfull == 1 && !o.fullscreen && !o.fullscreen_process) {} else {
14507                    clearInterval(o.toolbarInterval);
14508                    o.toolbarInterval = setInterval(HideForce, ((v.toolbar.hideleavetimeout > 0 ? v.toolbar.hideleavetimeout : v.toolbar.hidetimeout) * 1000))
14509                }
14510            }
14511        }
14512
14513        function ShowOrHideProcessor(but, forcehide) {
14514            var hide = false;
14515            var show = false;
14516            var toolbar_hide = false;
14517            if (v.toolbar.hide == 1) {
14518                if ((!o.starttimeout && !o.mouseHere && !o.fullscreen && o.play && v.toolbar.hidejustfull != 1 && !o.casting) || (o.fullscreen && toolbarHidden && !o.fcdef) || (o.actions.plNxtExst() && o.ended && !o.mouseHere)) {
14519                    hide = true;
14520                    show = false;
14521                    toolbar_hide = true
14522                } else {
14523                    hide = false;
14524                    show = true
14525                }
14526                if (exist(forcehide) && !o.casting) {
14527                    hide = forcehide;
14528                    show = !hide
14529                }
14530                if (o.tlbrhd && (but.s("position").indexOf("controls") == 0 || but.s("action") == "line")) {
14531                    hide = false;
14532                    show = true
14533                }
14534                if (v.toolbar.hideonpause == 1 && !o.play) {
14535                    hide = true;
14536                    show = false;
14537                    toolbar_hide = false
14538                }
14539                if (v.toolbar.showuntilmeta == 1 && !o.metadata && o.play) {
14540                    hide = false;
14541                    show = true
14542                }
14543            } else {
14544                if (but.s("hide") != 1) {
14545                    show = true
14546                }
14547            }
14548            if (show && !o.fcdef) {
14549                css(o.frame, {
14550                    "cursor": "default"
14551                });
14552                o.fcdef = true
14553            }
14554            var a = but.g("action");
14555            if (a == "custom" && but.s("position").indexOf("controls") == -1) {
14556                hide = false;
14557                show = true
14558            }
14559            if (o.casting) {
14560                if (a == "line") {
14561                    if (o.media.duration() == -1) {
14562                        hide = true;
14563                        show = false
14564                    }
14565                }
14566            }
14567            var re_y = false;
14568            var hp = HideProof(but);
14569            if (but.s("hide") == 1) {
14570                if (but.s("hideonleaveandplay") == 1) {
14571                    if (toolbar_hide || forcehide || (o.play && !o.mouseHere)) {
14572                        !toolbar_hide && !forcehide ? '' : hp = true
14573                    }
14574                }
14575                if (but.s("hideonbar") == 1) {
14576                    if (!toolbar_hide && !forcehide) {
14577                        hp = true
14578                    }
14579                }
14580                if (but.s("hidelap") == 1) {
14581                    if (o.play && !o.mouseHere) {
14582                        hp = true
14583                    }
14584                }
14585                if (but.s("hideonwidth") == 1 || but.s("hideoverwidth") == 1 || but.s("hideonfullscreen") == 1) {
14586                    resizeonwidth = true
14587                }
14588            }
14589            if (hp) {
14590                hide = true;
14591                show = false
14592            } else {
14593                !hide ? show = true : ''
14594            }
14595            if (but.s("action") == "volume") {
14596                if (but.s("hide") == 1 && but.s("hideoutmute") == 1 && !but.g("cul")) {
14597                    hide = true;
14598                    show = false;
14599                    if (!toolbar_hide && (o.hidden_volume_over || o.hidden_volume_over_process) && !forcehide && but.s("hiddenwidth") != 1) {
14600                        hide = false;
14601                        show = true
14602                    } else {
14603                        re_y = true
14604                    }
14605                }
14606            }
14607            if (o.nativecontrols || (!o.start && v.toolbar.hide == 1 && v.toolbar.hideuntilstarted == 1) || (!o.metadata && v.toolbar.hide == 1 && v.toolbar.hideuntilmeta == 1) || (!o.fullscreen && v.toolbar.hide == 1 && v.toolbar.hidesmall == 1)) {
14608                if (but.s("position").indexOf("controls") > -1 || but.s("position").indexOf("bottom") > -1) {
14609                    hide = true;
14610                    show = false
14611                }
14612                if (v.toolbar.hidejustfull == 1 && !o.fullscreen) {
14613                    hide = false;
14614                    show = true
14615                }
14616            }
14617            if (settings) {
14618                if (settings.g("show") && v.settings.always != 1) {
14619                    toolbar_hide = false;
14620                    forcehide = false
14621                }
14622            }
14623            if (playlist && o.droplist) {
14624                if (v.playlist.dropopen == 1) {
14625                    if (o.droplist.Visible()) {
14626                        return
14627                    }
14628                }
14629            }
14630            if (a == "share") {
14631                if (exist(o.share)) {
14632                    if (o.share.empty()) {
14633                        hide = true;
14634                        show = false;
14635                        but.set("animation", "none")
14636                    }
14637                }
14638            }
14639            if (a == "playlist" || a == "next" || a == "prev" || but.s("hidewithoutplaylist") == 1) {
14640                if (playlist) {
14641                    if (playlist.empty() && but.s("hidewithoutplaylist") != 0) {
14642                        hide = true;
14643                        show = false;
14644                        but.set("animation", "none")
14645                    }
14646                } else {
14647                    hide = true;
14648                    show = false
14649                }
14650            }
14651            if (o.hideall == 1) {
14652                hide = true;
14653                show = false
14654            }
14655            if (re_y) {
14656                var cc = ControlCoordinate(but);
14657                if (cc) {
14658                    cc.y > 0 ? but.set("y0", cc.y) : '';
14659                    css(but.c(), {
14660                        "position": "absolute",
14661                        "top": but.g("y0")
14662                    })
14663                }
14664            }
14665            if (hide) {
14666                HideControl(but, (firstly ? true : false))
14667            }
14668            if (show) {
14669                ShowControl(but)
14670            }
14671            if (but == bg) {
14672                if (!hide && show) {
14673                    ToolbarShow();
14674                    show2(bg2);
14675                    bgtop ? bgtop.set("opacity", bgtop.s("a")) : '';
14676                    toolbarHidden = false;
14677                    uijs == 0 ? js("ui", 1) : '';
14678                    uijs = 1;
14679                    o.cut && o.cutted ? o.cut.show() : ''
14680                }
14681                if (hide && !show && !o.casting) {
14682                    o.media.ToolbarHide();
14683                    SettingsClose();
14684                    hide2(bg2);
14685                    bgtop ? bgtop.set("opacity", 0) : '';
14686                    toolbarHidden = true;
14687                    uijs == 1 ? js("ui", 0) : '';
14688                    uijs = 0;
14689                    o.cut && o.cutted ? o.cut.hide() : ''
14690                }
14691                if (settings) {
14692                    if (settings.tb()) {
14693                        if (!settings.g("show")) {
14694                            show && !hide ? settings.show() : ''
14695                        } else {
14696                            !show && hide ? settings.hide(2) : ''
14697                        }
14698                    }
14699                }
14700                if (playlist) {
14701                    if (v.playlist.always == 1 && !playlist.empty()) {
14702                        if (show || o.nativecontrols) {
14703                            if (v.playlist.alwaysnotfullscreen == 1 && o.fullscreen) {} else {
14704                                if (!playlist.g("show")) {
14705                                    if (v.playlist.alwaysjustpause == 1) {
14706                                        !o.play && !o.newplay ? playlist.show() : ''
14707                                    } else {
14708                                        playlist.show()
14709                                    }
14710                                }
14711                            }
14712                        } else {
14713                            if (hide && playlist.g("show")) {
14714                                playlist.hide()
14715                            }
14716                        }
14717                    }
14718                }
14719            }
14720        };
14721
14722        function HideProof(but) {
14723            var x = false;
14724            var a = but.g("action");
14725            if (but.s("hide") == 1) {
14726                if (but.s("hideonplay") == 1) {
14727                    o.play || o.newplay ? x = true : ''
14728                }
14729                if (but.s("hideonpause") == 1) {
14730                    !o.play && !o.newplay ? x = true : ''
14731                }
14732                if (but.s("hideonend") == 1) {
14733                    o.ended ? x = true : ''
14734                }
14735                if (but.s("hdnn") == 1) {
14736                    x = true
14737                } else {
14738                    if (but.s("hideondesktop") == 1) {
14739                        if (o.system.desktop) {
14740                            but.set("hdnn", 1);
14741                            x = true
14742                        }
14743                    }
14744                    if (but.s("hideonmobile") == 1) {
14745                        if (o.system.mobile) {
14746                            but.set("hdnn", 1);
14747                            x = true
14748                        }
14749                    }
14750                }
14751                if (but.s("hideoverwidth") == 1) {
14752                    if (o.screen_w > but.s("hideoverwidthlimit")) {
14753                        but.set("hiddenwidth", 1);
14754                        x = true
14755                    } else {
14756                        but.set("hiddenwidth", 0)
14757                    }
14758                }
14759                if (but.s("hideunwait") == 1 && !waiting) {
14760                    x = true;
14761                    o.wtcntrl = 1
14762                }
14763                if (but.s("hidewait") == 1 && waiting) {
14764                    x = true;
14765                    o.wtcntrl = 1
14766                }
14767                if (but.s("hideonwidth") == 1) {
14768                    if (o.screen_w <= but.s("hideonwidthlimit")) {
14769                        but.set("hiddenwidth", 1);
14770                        x = true
14771                    } else {
14772                        but.set("hiddenwidth", 0)
14773                    }
14774                }
14775                if (but.s("hideafterstart") == 1) {
14776                    o.start ? x = true : ''
14777                }
14778                var t = o.media.time();
14779                var d = o.media.duration();
14780                if (but.s("hideafter") == 1 && but.s("hideaftersec") > 0) {
14781                    if (t >= but.s("hideaftersec")) {
14782                        x = true
14783                    }
14784                }
14785                if (but.s("hidebefore") == 1 && but.s("hidebeforesec") > 0) {
14786                    if (t < but.s("hidebeforesec")) {
14787                        x = true
14788                    }
14789                }
14790                if (but.s("hidebefore2") == 1 && but.s("hidebeforesec2") > 0) {
14791                    if (t < d - but.s("hidebeforesec2") || d == 0) {
14792                        x = true
14793                    }
14794                }
14795                if (but.s("hidelastpl") == 1) {
14796                    if (playlist) {
14797                        if (!playlist.PlaylistNextExist()) {
14798                            x = true
14799                        }
14800                    }
14801                }
14802                if (but.s("hide0timestore") == 1) {
14803                    if (o.start || !o.continue || o.media.isLive()) {
14804                        if (but.s("hideuntilstarted") != 1) {
14805                            x = true
14806                        }
14807                    }
14808                    if (o.continue) {
14809                        if (o.continue.flag().t == 0) {
14810                            x = true
14811                        }
14812                    }
14813                }
14814                if (but.s("hideuntilstarted") == 1) {
14815                    !o.start ? x = true : ''
14816                }
14817                if (but.s("hideuntilto") > 0) {
14818                    x = true
14819                }
14820                if (but.s("hideonvar") == 1) {
14821                    if (exist(but.s("hidevar"))) {
14822                        options[but.s("hidevar")] ? x = true : ''
14823                    }
14824                }
14825                if (but.s("hideuntiltext") == 1) {
14826                    if (!exist(but.s("customtext"))) {
14827                        x = true
14828                    }
14829                }
14830                if (but.s("hidewovar") == 1) {
14831                    if (exist(but.s("hidevar2"))) {
14832                        !options[but.s("hidevar2")] ? x = true : ''
14833                    }
14834                }
14835                if (but.s("hideuntilstartedios") == 1 && o.system.ios) {
14836                    !o.start || o.newfile ? x = true : ''
14837                }
14838                if (but.s("hideuntilended") == 1) {
14839                    !o.media.ended() ? x = true : ''
14840                }
14841                if (but.s("hideonvod") == 1) {
14842                    !o.media.isLive() ? x = true : ''
14843                }
14844                if (but.s("hideonleave") == 1) {
14845                    !o.mouseHere ? x = true : ''
14846                }
14847                if (but.s("hidenormscreen") == 1) {
14848                    !o.fullscreen ? x = true : ''
14849                }
14850                if (but.s("hideonfullscreen") == 1) {
14851                    o.fullscreen ? x = true : ''
14852                }
14853                if (but.s("hideonunmute") == 1) {
14854                    !o.muted ? x = true : ''
14855                }
14856                if (but.s("hideonlive") == 1) {
14857                    o.media.isLive() && o.media.currentFile().indexOf("?DVR") == -1 ? x = true : ''
14858                }
14859                if (but.s("hidewithposter") == 1) {
14860                    isVisible(o.poster) ? x = true : ''
14861                }
14862                if (but.s("hideuntilmeta") == 1) {
14863                    !o.metadata ? x = true : ''
14864                }
14865                if (but.s("hideonmeta") == 1) {
14866                    o.metadata ? x = true : ''
14867                }
14868                if (but.s("hidemini") == 1) {
14869                    o.mini ? x = true : ''
14870                }
14871                if (but.s("hidenomini") == 1) {
14872                    !o.mini ? x = true : ''
14873                }
14874                if (but.s("hideafterclick") == 1) {
14875                    if (but.g("clicked")) {
14876                        x = true
14877                    }
14878                }
14879                if (but.s("hidenoab") == 1) {
14880                    !o.ab ? x = true : ''
14881                }
14882                if (but.s("hideab") == 1) {
14883                    o.ab ? x = true : ''
14884                }
14885                if (but.s("hideonyoutube") == 1) {
14886                    if (v.preload == 1 && v.screenclick == 1) {
14887                        if (o.file_type == "youtube" && !exist(v.poster) && v.youtubeposter == 0) {
14888                            if (!o.start || o.media.status() == "ended") {
14889                                if (v.poster == '') {} else {
14890                                    x = true
14891                                }
14892                            }
14893                        }
14894                    }
14895                }
14896            }
14897            if (a == "custom") {
14898                var lu = but.s("linkurl");
14899                if (lu) {
14900                    if (lu == "api:airplay" || lu == "airplay") {
14901                        if (!o.airplay && !o.airplayed) {
14902                            x = true
14903                        }
14904                    }
14905                    if (lu == "api:pipwebkit") {
14906                        if (!o.pipwebkit || (!o.start && v.preload == 0)
14906) {
14907                            x = true
14908                        }
14909                    }
14910                    if (lu == "api:unfixing") {
14911                        if (!o.mini) {
14912                            x = true
14913                        }
14914                    }
14915                    if (lu.indexOf("captions") > -1) {
14916                        if (!o.captions) {
14917                            x = true
14918                        }
14919                    }
14920                    if (indOf([lu], "skip") && !indOf([lu], "js:") && but.s("hdnn") != 1) {
14921                        var sk = false;
14922                        if (exist(v.skip)) {
14923                            if (!o.skpbt) {
14924                                typeof PluginSkip == 'function' ? o.skpbt = new PluginSkip() : ''
14925                            }
14926                            if (o.skpbt) {
14927                                sk = o.skpbt.check(but)
14928                            }
14929                        }!sk ? x = true : ''
14930                    }
14931                }
14932            }
14933            if (a == "playlist" || a == "next" || a == "prev") {
14934                if (playlist) {
14935                    if (playlist.empty()) {
14936                        x = true
14937                    }
14938                } else {
14939                    x = true
14940                }
14941            }
14942            if (a == "settings") {
14943                if (settings) {
14944                    if (settings.empty()) {
14945                        x = true;
14946                        o.file_type != 'hls' ? but.set("animation", "none") : ''
14947                    }
14948                } else {
14949                    x = true
14950                }
14951            }
14952            if (but.g("type") == "text") {
14953                if (but.g("length") == 0) {
14954                    x = true
14955                }
14956            }
14957            if (but.g("settings#")) {
14958                if (!but.g("set#visible")) {
14959                    x = true
14960                }
14961            }
14962            if (but.s("chromecast") == 1) {
14963                var cb = document.getElementById("pjs_cast_button_" + v.id);
14964                if ((o.media.duration() == 0 && o.media.time() == 0) || !o.tagvideo || !isVisible(cb) || !o.cast_available) {
14965                    x = true
14966                }
14967            }
14968            if (but.s("hidetime") == 1) {
14969                !x ? but.set("hidetime", 1) : ''
14970            }
14971            if (a == "duration") {
14972                if (o.media.isLive()) {
14973                    x = true
14974                }
14975            }
14976            if (but.g("key") == "control_start" && o.system.mobile) {
14977                if (o.nativecontrols && o.system.android) {
14978                    x = true
14979                }
14980            }
14981            return x
14982        }
14983
14984        function HideControl(but, quick) {
14985            if (but.g("show")) {
14986                if (o.fullscreen_process || but.s("animation") == "none" || quick) {
14987                    but.set("display", false)
14988                } else {
14989                    HideAnimate(but)
14990                }
14991                but.set("show", false)
14992            }
14993        };
14994
14995        function ShowControl(but) {
14996            if (!but.g("show")) {
14997                if (but.s("animation") == "none" || o.fullscreen_process) {
14998                    but.set("display", true);
14999                    if (o.fullscreen_process) {
15000                        but.set("opacity", 1)
15001                    }
15002                    if (but.g("action") == "volume") {
15003                        if (o.hidden_volume) {
15004                            HidePositionControl(but)
15005                        }
15006                    }
15007                } else {
15008                    ShowAnimate(but)
15009                }
15010                if (but.s("action") == "volume") {
15011                    o.controls.Volume(o.muted ? 0 : v.volume)
15012                }
15013                if (but.s("action") == "line") {
15014                    o.actions.Loading()
15015                }
15016                but.set("show", true)
15017            }
15018        };
15019
15020        function HideAnimate(but) {
15021            killMotion(but.g("key"));
15022            var m_type = "alpha|";
15023            var m_to = "0|";
15024            var hide = 1;
15025            var a = but.s("animation");
15026            if (but.s("apdra") == 1) {
15027                m_type = '';
15028                m_to = ''
15029            }
15030            var p = but.s("position");
15031            var scl = but.g("scaleX");
15032            exist2(but.s("apdr")) ? p = but.s("apdr") : '';
15033            indOf2(p, ['bottom']) && o.tlbrhd ? p = "" : '';
15034            if (a == "scale") {
15035                m_type += "scale|";
15036                m_to += "0|"
15037            }
15038            if (a == "position") {
15039                if (p.indexOf("right") > -1 && p.indexOf("controls") == -1) {
15040                    m_type += "x|";
15041                    m_to += int(o.screen_w + but.g("width") / 2 * scl) + "|"
15042                }
15043                if (p.indexOf("left") > -1) {
15044                    m_type += "x|";
15045                    m_to += int(-but.g("width") / 2) * scl + "|"
15046                }
15047                if (p.indexOf("top") > -1) {
15048                    m_type += "y|";
15049                    m_to += (-but.g("height") / 2) * scl + "|"
15050                }
15051                if (indOf2(p, ["bottom", "controls", "timeline"])) {
15052                    m_type += "y|";
15053                    if (but.g("action") == "line" || but.g("action") == "volume") {
15054                        m_to += int(o.screen_h + but.s("h") + (but.s("h") < 20 ? 20 - but.s("h") : 0)) + "|"
15055                    } else {
15056                        m_to += int(o.screen_h + but.g("height") / 2) + "|"
15057                    }
15058                }
15059                if (p == "center") {
15060                    m_type += "scale|";
15061                    m_to += "0|"
15062                }
15063            }
15064            var m = new Motion({
15065                "mc": but,
15066                "me": but.g("key"),
15067                "type": m_type.substr(0, m_type.length - 1),
15068                "to": m_to.substr(0, m_to.length - 1),
15069                "hide": hide
15070            })
15071        };
15072
15073        function ShowAnimate(but) {
15074            killMotion(but.g("key"));
15075            var m_type = "";
15076            var m_to = "";
15077            var a = but.s("animation");
15078            var p = but.s("position");
15079            exist2(but.s("apdr")) ? p = but.s("apdr") : '';
15080            if (but.g("opacity") != 1 && but.s("apdra") != 1) {
15081                m_type = "alpha|";
15082                m_to = (but.g("key") == 'bg' ? v.toolbar.a : "1") + "|"
15083            }
15084            if (a == "scale") {
15085                if (but.g("scaleX") != but.s("scale")) {
15086                    m_type += "scale|";
15087                    m_to += but.s("scale") + "|"
15088                }
15089            }
15090            if (a == "position") {
15091                if (p == "center") {
15092                    if (but.g("scaleX") != but.s("scale")) {
15093                        m_type += "scale|";
15094                        m_to += but.s("scale") + "|"
15095                    }
15096                } else {
15097                    if (p.indexOf("controls") > -1 || p == "bottom") {
15098                        if (but.g("y") != but.g("y0")) {
15099                            m_type += "y|";
15100                            m_to += but.g("y0") + "|"
15101                        }
15102                    } else {
15103                        m_type += "x|y|";
15104                        m_to += but.g("x0") + "|" + but.g("y0") + "|"
15105                    }
15106                }
15107            }
15108            if (m_type != "" && m_to != "") {
15109                var m = new Motion({
15110                    mc: but,
15111                    me: but.g("key"),
15112                    type: m_type.substr(0, m_type.length - 1),
15113                    to: m_to.substr(0, m_to.length - 1),
15114                    show: 1
15115                })
15116            } else {
15117                but.set("display", true)
15118            }
15119        };
15120        this.Mouse = function (key, type, quick) {
15121            var resize = false;
15122            var stop = false;
15123            var but = b[key];
15124            var action = but.g("action");
15125            var linkurl = but.s("linkurl");
15126            if (type == "over") {
15127                if (o.hidden_volume) {
15128                    if (action == "volume" || action == "mute" || action == "unmute") {
15129                        if (!but.g("cul")) {
15130                            o.hidden_volume_over = true;
15131                            o.hidden_volume_over_process = true;
15132                            resize = true;
15133                            ShowOrHide();
15134                            if (v.control_line.hideonvolume == 1) {
15135                                var bl = FindBut("action", "line");
15136                                if (bl) {
15137                                    hide2(bl.c())
15138                                }
15139                            }
15140                        }
15141                    }
15142                }
15143                if (settings && v.settings.showovercontrol == 1 && ((action == "settings" || linkurl.indexOf("setting") == 0) || linkurl.indexOf("settings:") == 0)) {
15144                    clearTimeout(o.settingsovertimer);
15145                    if (!settings.g("show") || _lastactbut != but) {
15146                        Action(but, type);
15147                        o.overopentimeout = action + linkurl;
15148                        setTimeout(function () {
15149                            o.overopentimeout = null
15150                        }, 500)
15151                    }
15152                }
15153                if (playlist && v.playlist.showovercontrol == 1 && action == "playlist") {
15154                    clearTimeout(o.playlistovertimer);
15155                    if (!playlist.g("show") || _lastactbut != but) {
15156                        Action(but, type);
15157                        o.overopentimeout = action;
15158                        setTimeout(function () {
15159                            o.overopentimeout = null
15160                        }, 500)
15161                    }
15162                }
15163            }
15164            if (type == "out") {
15165                if (o.hidden_volume) {
15166                    if (action == "volume" || action == "mute" || action == "unmute") {
15167                        o.hidden_volume_over = false;
15168                        o.hidden_volume_over_process = true;
15169                        setTimeout(function () {
15170                            if (!o.hidden_volume_over) {
15171                                o.hidden_volume_over_process = false;
15172                                for (var x in b) {
15173                                    if (b.hasOwnProperty(x)) {
15174                                        if (!toolbarHidden) {
15175                                            if (b[x].g("action") == "volume" && !b[x].g("cul")) {
15176                                                HideControl(b[x]);
15177                                                Resize()
15178                                            }
15179                                        }
15180                                        if (b[x].g("action") == "line") {
15181                                            if (v.control_line.hideonvolume == 1) {
15182                                                show2(b[x].c())
15183                                            }
15184                                        }
15185                                    }
15186                                }
15187                            }
15188                        }, 500)
15189                    }
15190                }
15191                if (action == "line") {
15192                    o.actions.UpdatePlay(1)
15193                }
15194                if (v.settings.showovercontrol == 1 && ((action == "settings" || linkurl.indexOf("setting") == 0) || linkurl.indexOf("settings:") == 0)) {
15195                    clearTimeout(o.settingsovertimer);
15196                    o.settingsovertimer = setTimeout(function () {
15197                        if (!o.mouseDown) {
15198                            SettingsClose(1)
15199                        }
15200                    }, (v.settings.showoverto > 0 ? v.settings.showoverto * 1000 : 1000))
15201                }
15202                if (playlist && v.playlist.showovercontrol == 1 && action == "playlist") {
15203                    clearTimeout(o.playlistovertimer);
15204                    o.playlistovertimer = setTimeout(function () {
15205                        if (!o.mouseDown) {
15206                            playlist.g("show") ? playlist.hide(1) : ''
15207                        }
15208                    }, (v.playlist.showoverto > 0 ? v.playlist.showoverto * 1000 : 1000))
15209                }
15210            }
15211            if (resize) {
15212                setTimeout(Resize, 10)
15213            }
15214        };
15215        this.StageLeave = function () {
15216            if (o.volumewheel && !o.fullscreen && !o.fullscreen_process) {
15217                o.actions.volumewheel(false);
15218                o.volumewheel = false
15219            }
15220            if (o.poster) {
15221                if (v.poster_aover > -1 && isVisible(o.poster)) {
15222                    css(o.poster, {
15223                        opacity: v.poster_a
15224                    })
15225                }
15226            }
15227            if (o.play && v.playonhover == 1 && v.pauseonhover != 0) {
15228                o.actions.Pause()
15229            }
15230            if (v.toolbar.hideleavetimeout > 0) {
15231                clearTimeout(o.leavetimeout);
15232                o.leavetimeout = setTimeout(ShowOrHide, v.toolbar.hideleavetimeout * 1000)
15233            } else {
15234                ShowOrHide()
15235            }
15236        };
15237        this.StageOver = function () {
15238            if (o.poster) {
15239                if (v.poster_aover > -1 && isVisible(o.poster)) {
15240                    css(o.poster, {
15241                        opacity: v.poster_aover
15242                    })
15243                }
15244            }
15245            if (!o.play && v.playonhover == 1) {
15246                o.actions.Play()
15247            }
15248            ShowOrHide();
15249            ToolbarDown(false)
15250        };
15251        this.StageMove = function (stage_x, stage_y) {
15252            var y;
15253            for (var x in b) {
15254                if (b.hasOwnProperty(x)) {
15255                    y = b[x].g("action");
15256                    if (y == "line" || y == "volume") {
15257                        b[x].StageMove(stage_x, stage_y)
15258                    }
15259                }
15260            }
15261        };
15262        this.StageMove2 = function () {
15263            if (v.toolbar.hide == 1) {
15264                if (v.toolbar.hidejustfull == 1 && !o.fullscreen) {
15265                    return
15266                }
15267                if ((!o.mouseHere || o.system.mobile) && o.media.status() == "playing") {
15268                    o.mouseHere = true;
15269                    ShowOrHide();
15270                    o.system.mobile ? setTimeout(function () {
15271                        o.mouseHere = false
15272                    }, 500) : ''
15273                }
15274                if (v.toolbar.hidewithoutmoving == 1) {
15275                    ShowForce();
15276                    HideInterval()
15277                }
15278                ToolbarDown(false)
15279            }
15280        };
15281        this.StageMouseUp = function (stage_x, stage_y) {
15282            for (var x in b) {
15283                if (b.hasOwnProperty(x)) {
15284                    if (b[x].g("action") == "line" || b[x].g("action") == "volume") {
15285                        b[x].StageMouseUp(stage_x, stage_y)
15286                    }
15287                }
15288            }
15289        };
15290        this.Played = function (time, duration, upd) {
15291            for (var x in b) {
15292                if (b.hasOwnProperty(x)) {
15293                    if (b[x].g("action") == "line") {
15294                        b[x].UpdatePlay(time, duration, upd)
15295                    }
15296                    if (b[x].g("action") == "time") {
15297                        UpdateTime(b[x], time, duration)
15298                    }
15299                    if (b[x].s("rotateplaying") == 1) {
15300                        b[x].Rotate()
15301                    }
15302                    if (b[x].s("svgtmln") == 1) {
15303                        b[x].Tmln(time, duration)
15304                    }
15305                    if (b[x].s("often") == 1) {
15306                        if (b[x].s("linkurl") == "bandwidth" || b[x].s("linkurl") == "bitrate") {
15307                            typeof PluginMbps == 'function' ? PluginMbps(b[x]) : ''
15308                        }
15309                        if (b[x].s("often2") == 1 && !b[x].g("show") && toolbarHidden) {} else {
15310                            if (b[x].g("show") == HideProof(b[x])) {
15311                                ShowOrHide();
15312                                Resize()
15313                            }
15314                        }
15315                    }
15316                }
15317            }
15318        };
15319
15320        function ToolbarDown(x) {
15321            if (v.toolbar.hide == 1) {
15322                x ? SettingsClose() : '';
15323                if (o.tlbrhd) {
15324                    if (!o.play && v.toolbar.hideonpause == 1) {
15325                        x = true
15326                    }
15327                    if (x && !o.toolbarisdown) {
15328                        css(o.toolbar, {
15329                            "top": bg.h()
15330                        })
15331                    }
15332                    if (!x && o.toolbarisdown) {
15333                        css(o.toolbar, {
15334                            "top": 0
15335                        })
15336                    }
15337                    o.toolbarisdown = x
15338                }
15339            }
15340        }
15341
15342        function ToolbarShow() {
15343            toolbarHidden = false;
15344            o.media.ToolbarShow();
15345            if (o.resizeonmouse) {
15346                o.resizeonmouse = false;
15347                Resize();
15348                setTimeout(Resize, 300)
15349            }
15350        }
15351
15352        function UpdateTime(x, time, duration) {
15353            if (v.delete > 0) {
15354                time -= v.delete * 1;
15355                duration -= v.delete * 1
15356            }
15357            var y = Time(time);
15358            if (x.s("inversetime") == "1") {
15359                y = Time(duration - time)
15360            }
15361            if (x.s("showduration") == "1") {
15362                if (x.s("showboth") == "1") {
15363                    y = y + (duration > 0 ? ' ' + Lang(x.s("separator")) + ' ' + Time(duration) : '')
15364                } else {
15365                    time == 0 ? y = Time(duration) : ''
15366                }
15367            }
15368            x.UpdateText(y)
15369        }
15370        this.Loaded = function (time, duration) {
15371            var x = FindBut("action", "line");
15372            if (x) {
15373                x.UpdateLoad(time, duration)
15374            }
15375        };
15376        this.Cut = function (y) {
15377            if (o.media.duration() > 0) {
15378                var x = FindBut("action", "line");
15379                if (x) {
15380                    x.Cut(y)
15381                }
15382            }
15383        };
15384        this.Waiting = function () {
15385            if (!waiting) {
15386                if (v.hidevideo == 1) {
15387                    clearTimeout(wait_to);
15388                    wait_to = setTimeout(Waiting, 500)
15389                } else {
15390                    Waiting()
15391                }
15392            }
15393        };
15394
15395        function Waiting() {
15396            if (!waiting) {
15397                js("buffering");
15398                waiting = true;
15399                var x = FindBut("action", "buffer");
15400                if (x) {
15401                    x.Buffer();
15402                    if (v.posteronwait == 1 && o.play) {
15403                        clearTimeout(o.wtpstr_to);
15404                        o.wtpstr_to = setTimeout(WaitPoster, (v.pstrwt > 0 ? v.pstrwt : 1) * 1000)
15405                    }
15406                }
15407                o.wtcntrl ? ShowOrHide() : ''
15408            }
15409        }
15410
15411        function WaitPoster() {
15412            if (o.play && waiting) {
15413                o.actions.ShowPoster()
15414            }
15415        }
15416        this.HideElement = function (y) {
15417            for (var x in b) {
15418                if (x == y) {
15419                    b[x].set("hide2")
15420                }
15421            }
15422        };
15423        this.StopWaiting = function () {
15424            clearTimeout(wait_to);
15425            if (waiting) {
15426                js("buffered");
15427                var x = FindBut("action", "buffer");
15428                if (x) {
15429                    x.BufferStop();
15430                    if (v.posteronwait == 1 && o.play) {
15431                        o.actions.HidePoster()
15432                    }
15433                }
15434                waiting = false;
15435                o.wtcntrl ? ShowOrHide() : ''
15436            }
15437        };
15438        this.volumescroll = function () {
15439            var x = FindBut("linkurl", "volume scroll");
15440            if (x) {
15441                x.set("show2");
15442                x.UpdateText(Lang('volume') + ' ' + (o.muted ? 0 : Math.ceil(v.volume * 100)) + '%');
15443                clearTimeout(o.volumescroll);
15444                o.volumescroll = setTimeout(Volumescrolled, 1000)
15445            }
15446        };
15447
15448        function Volumescrolled() {
15449            var x = FindBut("linkurl", "volume scroll");
15450            if (x) {
15451                x.UpdateText('');
15452                x.set("hide2");
15453                clearTimeout(o.volumescroll)
15454            }
15455        }
15456        this.Seek = function (time, duration) {
15457            if (v.delete > 0) {
15458                time -= v.delete * 1;
15459                duration -= v.delete * 1
15460            }
15461            for (var x in b) {
15462                if (b.hasOwnProperty(x)) {
15463                    if (b[x].s("on") == 1) {
15464                        if (b[x].g("action") == "line") {
15465                            duration > 0 ? b[x].set("click", time / duration) : '';
15466                            b[x].UpdatePlaySeek()
15467                        }
15468                        if (b[x].g("action") == "time") {
15469                            UpdateTime(b[x], time, duration)
15470                        }
15471                        if (b[x].g("action") == "live") {
15472                            b[x].set("iconopacity", 0.5);
15473                            b[x].set("saturate", 0)
15474                        }
15475                    }
15476                }
15477            }
15478        };
15479        this.Duration = function (time, duration) {
15480            for (var x in b) {
15481                if (b.hasOwnProperty(x)) {
15482                    if (b[x].g("action") == "duration") {
15483                        if (v.delete > 0) {
15484                            duration -= v.delete * 1
15485                        }
15486                        b[x].UpdateText(Time(duration))
15487                    }
15488                    if (b[x].g("action") == "line") {
15489                        b[x].UpdatePlay(time, duration);
15490                        b[x].PlacePoints(duration)
15491                    }
15492                    if (b[x].g("action") == "time") {
15493                        UpdateTime(b[x], time, duration)
15494                    }
15495                }
15496            }
15497        };
15498        this.Settings = function () {
15499            if (!o.settings2) {
15500                settings.g("show") ? settings.hide() : settings.show()
15501            }
15502        };
15503        this.SettingsVisible = function () {
15504            if (settings) {
15505                if (o.settings2) {
15506                    return o.settings2.isVisible() || settings.g("show")
15507                } else {
15508                    return settings.g("show") ? true : false
15509                }
15510            } else {
15511                return false
15512            }
15513        };
15514        this.MenuProc = function (x) {
15515            if (settings) {
15516                settings.menuproc(x)
15517            }
15518        };
15519        this.SettingsClose = function () {
15520            SettingsClose()
15521        };
15522        this.SettingsTimer = function (x) {
15523            if (settings) {
15524                settings.UpdateTimer(x)
15525            }
15526        };
15527        this.SettingsSpeed = function () {
15528            if (settings) {
15529                settings.UpdateSpeed()
15530            }
15531        };
15532        this.SettingsExist = function (x) {
15533            if (settings) {
15534                return settings.Exist(x)
15535            }
15536        };
15537
15538        function SettingsClose(x) {
15539            if (settings) {
15540                settings.g("show") ? settings.hide(x) : ''
15541            }
15542            o.settings2 ? o.settings2.hide() : ''
15543        };
15544        this.Playlist = function () {
15545            if (playlist) {
15546                if (playlist.g("show")) {
15547                    playlist.hide(1)
15548                } else {
15549                    playlist.show()
15550                }
15551            }
15552        };
15553        this.PlaylistShow = function (x) {
15554            if (playlist) {
15555                if (playlist.g("show") && x != 1) {
15556                    x != 2 ? playlist.hide() : ''
15557                } else {
15558                    setTimeout(function () {
15559                        playlist.show()
15560                    }, 100)
15561                }
15562            }
15563        };
15564        this.PlaylistVisible = function () {
15565            if (playlist) {
15566                return playlist.g("show") ? true : false
15567            } else {
15568                return false
15569            }
15570        };
15571        this.PlaylistG = function (x) {
15572            return playlist ? playlist.g(x) : ''
15573        };
15574        this.UpdatePlaylist = function (x) {
15575            if (playlist) {
15576                playlist.updatePlaylist(x)
15577            }
15578        };
15579        this.PreNewPl = function (x) {
15580            if (playlist) {
15581                playlist.prenewpl(x)
15582            }
15583        };
15584        this.PlaylistNext = function () {
15585            if (playlist) {
15586                playlist.PlaylistNext()
15587            }
15588        };
15589        this.PlaylistHere = function () {
15590            if (playlist) {
15591                playlist.PlaylistHere()
15592            }
15593        };
15594        this.PlaylistControls = function () {
15595            PlaylistControls()
15596        };
15597
15598        function PlaylistControls() {
15599            for (var x in b) {
15600                if (b.hasOwnProperty(x)) {
15601                    if (b[x].g("action") == "next") {
15602                        css(b[x].c(), {
15603                            "opacity": (!playlist.PlaylistNextExist() ? 0.5 : 1)
15604                        })
15605                    }
15606                    if (b[x].g("action") == "prev") {
15607                        css(b[x].c(), {
15608                            "opacity": (!playlist.PlaylistPrevExist() ? 0.5 : 1)
15609                        })
15610                    }
15611                }
15612            }
15613        }
15614        this.PlaylistNextExist = function () {
15615            if (playlist) {
15616                return playlist.PlaylistNextExist()
15617            } else {
15618                return false
15619            }
15620        };
15621        this.PlaylistPrevExist = function () {
15622            if (playlist) {
15623                return playlist.PlaylistPrevExist()
15624            } else {
15625                return false
15626            }
15627        };
15628        this.PlaylistExist = function () {
15629            if (playlist) {
15630                return playlist.PlaylistExist()
15631            } else {
15632                return false
15633            }
15634        };
15635        this.PlaylistRewind = function () {
15636            if (playlist) {
15637                playlist.PlaylistRewind()
15638            }
15639        };
15640        this.PlaylistPrev = function () {
15641            if (playlist) {
15642                playlist.PlaylistPrev()
15643            }
15644        };
15645        this.PlaylistPlayId = function (x) {
15646            if (x && playlist) {
15647                playlist.playById(x)
15648            }
15649        };
15650        this.PlaylistOpenId = function (x) {
15651            if (x && playlist) {
15652                playlist.openById(x)
15653            }
15654        };
15655        this.PlaylistMove = function (x) {
15656            if (x && playlist) {
15657                css(playlist.co(), {
15658                    "maxHeight": "none",
15659                    "padding-right": playlist.s("bgpaddingright")
15660                });
15661                document.getElementById(x).appendChild(playlist.co());
15662                hide2(playlist.c())
15663            }
15664        };
15665        this.ShowSettingsBut = function () {};
15666        this.QualityChanged = function (x) {
15667            if (settings) {
15668                settings.SetQuality();
15669                settings.g("show") ? setTimeout(function () {
15670                    settings.hide()
15671                }, 200) : ''
15672            }
15673        };
15674        this.QualityChangedNoHand = function () {
15675            if (settings) {
15676                settings.SetQuality()
15677            }
15678            if (o.settings2) {
15679                o.settings2.update()
15680            }
15681        };
15682        this.AirplayChanged = function (x) {
15683            if (settings) {
15684                settings.Airplay()
15685            }
15686            Resize();
15687            ShowOrHide()
15688        };
15689        this.SettingChanged = function (x) {
15690            if (settings) {
15691                settings.SetSetting(x);
15692                settings.g("show") ? settings.hide() : ''
15693            }
15694            if (o.settings2) {
15695                o.settings2.update()
15696            }
15697            x == "speed" ? SpeedChanged() : ''
15698        };
15699
15700        function SpeedChanged() {
15701            if (o.line_speed) {
15702                var x = parseFloat(o.custom_speed / o.files_speed.slice(-1)[0], 1).toFixed(2);
15703                for (var i in b) {
15704                    if (b.hasOwnProperty(i)) {
15705                        if (b[i].s("customline") == "speed" && o.custom_speed) {
15706                            b[i].UpdatePlay(x, 1)
15707                        }
15708                        if (b[i].s("linkurl") == "api:speed,1.0") {
15709                            b[i].UpdateVolume(x)
15710                        }
15711                    }
15712                }
15713            }
15714        }
15715        this.AudioTrackChangedNoHand = function (x) {
15716            if (settings) {
15717                settings.SetSetting("audiotrack")
15718            }
15719            if (o.settings2) {
15720                o.settings2.update()
15721            }
15722        };
15723        this.SubtitleChanged = function () {
15724            if (settings) {
15725                settings.SetSubtitle();
15726                settings.g("show") ? setTimeout(function () {
15727                    settings.hide()
15728                }, 200) : ''
15729            }
15730            if (o.settings2) {
15731                o.settings2.update()
15732            }
15733            if (o.casting && o.tagvideo) {
15734                o.chromecast.Sub()
15735            }
15736        };
15737        this.SubOpt = function () {
15738            o.settings2 ? o.settings2.hide() : '';
15739            if (settings) {
15740                settings.SubOpt()
15741            }
15742        };
15743        this.SettingsN = function (num, display, val) {
15744            for (var x in b) {
15745                if (b.hasOwnProperty(x)) {
15746                    if (b[x].g("action") == "settings") {
15747                        if (b[x].s("hdicon") == 1) {
15748                            b[x].HdIcon()
15749                        }
15750                    }
15751                    if (b[x].g("action_settings") == "settings#" + num) {
15752                        b[x].set("set#visible", display);
15753                        if (b[x].g("type") == "text") {
15754                            if (val) {
15755                                b[x].UpdateText(NoSpan(val))
15756                            }
15757                        } else {
15758                            if (v.settings['settings' + num + 'action'] == "subtitle") {
15759                                if (val == Lang("off")) {
15760                                    b[x].CustomSwitch(0)
15761                                } else {
15762                                    b[x].CustomSwitch(1)
15763                                }
15764                            }
15765                            Resize()
15766                        }
15767                        ShowOrHideProcessor(b[x])
15768                    }
15769                }
15770            }
15771        };
15772        this.UpdateSettings = function () {
15773            if (settings) {
15774                settings.SetQuality();
15775                settings.SetSetting("audiotrack");
15776                settings.SetSetting("download")
15777            }
15778        };
15779        this.RenewPoints = function () {
15780            var x = FindBut("action", "line");
15781            if (x) {
15782                x.RenewPoints()
15783            }
15784        };
15785        this.resize = function () {
15786            Resize();
15787            if (toolbarHidden) {
15788                o.resizeonmouse = true
15789            }
15790        };
15791        this.resizeFromText = function (x) {
15792            if (!toolbarHidden || x == 1) {
15793                Resize();
15794                ShowOrHide()
15795            } else {
15796                v.toolbar.resizeme = true
15797            }
15798        };
15799        this.startcss = function () {
15800            var b = FindBut("type", "css");
15801            if (b) {
15802                b.setcss()
15803            }
15804        };
15805        this.refresh = function () {
15806            ShowOrHide();
15807            Resize();
15808            ShowOrHide();
15809            if (o.nativecontrols) {
15810                hide2(bg2)
15811            } else {
15812                !toolbarHidden ? show2(bg2) : ''
15813            }
15814        };
15815        this.KeyDown = function (event) {
15816            if (window.pljssglobalid == v.id && v.hotkey.on == 1) {
15817                var x = event.which;
15818                var y = false;
15819                if (x == undefined) {
15820                    x = event.keyCode
15821                }
15822                if (exist(o.vast) || exist(o.pass) || o.stopkeys == 1) {
15823                    return false
15824                }
15825                if (o.play && v.hotkey.onplay == 1) {
15826                    y = true
15827                }
15828                if (((v.hotkey.space == 1 && x == 32) || (v.hotkey.enter == 1 && x == 13) || (v.hotkey.k == 1 && x == 75)) && (o.focus || o.mouseHere || y)) {
15829                    if (v.hotkey.icons == 1) {
15830                        PluginHotIcon('play', o.play ? 0 : 1)
15831                    }
15832                    o.actions.Toggle();
15833                    event.preventDefault();
15834                    return false
15835                }!v.hotkey.vol ? v.hotkey.vol = 0.2 : '';
15836                !v.hotkey.scale ? v.hotkey.scale = 5 : '';
15837                if (v.hotkey.nums == 1 && (o.focus || y)) {
15838                    if (o.media.duration() > 0) {
15839                        for (var i = 48; i < 58; i++) {
15840                            if (x == i) {
15841                                o.actions.Seek((o.media.duration() * (x - 48) * 10) / 100, true)
15842                            }
15843                        }
15844                    }
15845                }
15846                if ((x == 39 || (v.hotkey.l == 1 && x == 76)) && (o.focus || y)) {
15847                    KeyPlusUp(v.hotkey.leftright)
15848                }
15849                if ((x == 37 || (v.hotkey.j == 1 && x == 74)) && (o.focus || y)) {
15850                    KeyPlusDown(v.hotkey.leftright)
15851                }
15852                if (x == 38 && (o.focus || y)) {
15853                    KeyPlusUp(v.hotkey.updown)
15854                }
15855                if (x == 40 && (o.focus || y)) {
15856                    KeyPlusDown(v.hotkey.updown)
15857                }
15858                if (x == 187 && (o.focus || y)) {
15859                    KeyPlusUp(v.hotkey.plusminus)
15860                }
15861                if (x == 189 && (o.focus || y)) {
15862                    KeyPlusDown(v.hotkey.plusminus)
15863                }
15864            }
15865        };
15866
15867        function FindBut(y, z) {
15868            for (var x in b) {
15869                if (b.hasOwnProperty(x)) {
15870                    if (b[x].s(y) == z) {
15871                        return b[x]
15872                    }
15873                }
15874            }
15875        }
15876
15877        function KeyPlusUp(x) {
15878            if (x == "next") {
15879                if (o.playlist) {
15880                    o.controls.PlaylistNext()
15881                } else {
15882                    x = "seek"
15883                }
15884            }
15885            if (x == "seek") {
15886                if (o.media.duration() > 0) {
15887                    var sk = o.media.time() + parseFloat(v.hotkey.seek);
15888                    if (sk < o.media.duration()) {
15889                        o.actions.Seek(sk, true);
15890                        js("userseek", sk)
15891                    }
15892                }
15893            }
15894            if (x == "volume") {
15895                o.actions.Volume(parseFloat(v.volume) + parseFloat(v.hotkey.vol));
15896                event.preventDefault()
15897            }
15898            if (x == "scale") {
15899                o.media.scale(v.hotkey.scale / 100);
15900                event.preventDefault()
15901            }
15902            if (v.hotkey.icons == 1) {
15903                PluginHotIcon(x, 1)
15904            }
15905        }
15906
15907        function KeyPlusDown(x) {
15908            if (x == "next") {
15909                if (o.playlist) {
15910                    o.controls.PlaylistPrev()
15911                } else {
15912                    x = "seek"
15913                }
15914            }
15915            if (x == "seek") {
15916                if (o.media.duration() > 0 && o.start) {
15917                    var sk = o.media.time() - v.hotkey.seek >= 0 ? o.media.time() - v.hotkey.seek : 0;
15918                    o.actions.Seek(sk, true);
15919                    js("userseek", sk)
15920                }
15921            }
15922            if (x == "volume") {
15923                o.actions.Volume(parseFloat(v.volume) - parseFloat(v.hotkey.vol));
15924                event.preventDefault()
15925            }
15926            if (x == "scale") {
15927                o.media.scale(-v.hotkey.scale / 100);
15928                event.preventDefault()
15929            }
15930            if (v.hotkey.icons == 1) {
15931                PluginHotIcon(x, 0)
15932            }
15933        };
15934        this.KeyUp = function (event) {
15935            if (window.pljssglobalid == v.id) {
15936                var x = event.which;
15937                if (x == undefined) {
15938                    x = event.keyCode
15939                }
15940                if (x == 57) {
15941                    if (v.log == 1) {}
15942                }
15943                if (o.fullscreen && x == 27) {
15944                    o.actions.Normalscreen()
15945                }
15946                if (exist(o.vast) || exist(o.pass)) {
15947                    return false
15948                }
15949                if (v.hotkey.f == 1 && x == 70 && v.hidevideo != 1 && (o.focus || o.mouseHere)) {
15950                    if (v.hotkey.icons == 1) {
15951                        PluginHotIcon('fullscreen', o.fullscreen ? 0 : 1)
15952                    }
15953                    o.fullscreen ? o.actions.Normalscreen() : o.actions.Fullscreen()
15954                }
15955                if (v.hotkey.s == 1 && x == 83 && (o.focus || o.mouseHere)) {
15956                    if (o.sbt) {
15957                        if (v.hotkey.icons == 1) {
15958                            PluginHotIcon('subtitle', o.subtitle_on ? 0 : 1)
15959                        }
15960                        apiProcessor("togglesubs")
15961                    }
15962                }
15963                if (v.hotkey.m == 1 && x == 77 && (o.focus || o.mouseHere)) {
15964                    if (v.hotkey.icons == 1) {
15965                        PluginHotIcon('mute', o.muted ? 1 : 0)
15966                    }
15967                    o.muted ? o.actions.Unmute() : o.actions.Mute()
15968                }
15969            }
15970        };
15971        this.Remove = function () {
15972            clearInterval(o.toolbarInterval);
15973            for (var x in o) {
15974                if (x.indexOf("control") == 0 && x.indexOf("Interval") > -1) {
15975                    clearInterval(o[x])
15976                }
15977            }
15978            for (var i = 0; i < butNames.length; i++) {
15979                var key = butNames[i];
15980                if (b[key]) {
15981                    b[key].Remove()
15982                }
15983            }
15984            if (settings) {
15985                settings.Remove()
15986            }
15987            if (playlist) {
15988                playlist.Remove()
15989            }
15990            bg.Remove();
15991            bgtop ? bgtop.Remove() : '';
15992            if (bg2.parentNode == o.frame) {
15993                o.frame.removeChild(bg2)
15994            } else {
15995                o.toolbar ? o.toolbar.removeChild(bg2) : ''
15996            }
15997        };
15998        this.ShowForce = function () {
15999            ShowForce()
16000        };
16001        this.HideForce = function () {
16002            HideForce();
16003            ShowOrHide()
16004        };
16005        this.HideInterval = function () {
16006            HideInterval()
16007        };
16008        this.ToolbarHidden = function () {
16009            return toolbarHidden
16010        }
16011    };
16012    var Control = function (key) {
16013        var i;
16014        var style = [];
16015        var w;
16016        var h;
16017        var last_text_w = 0;
16018        var bg;
16019        var bgcontainer;
16020        var area;
16021        var angle = 0;
16022        var visible = true;
16023        var selectOpen = false;
16024        var scaleX = 1;
16025        var scaleY = 1;
16026        var tip;
16027        var tipbg;
16028        var tiptext;
16029        var tipcrn;
16030        var action;
16031        var actionstt = '';
16032        var x0;
16033        var y0;
16034        var on;
16035        var over = false;
16036        var touchmove = false;
16037        var iconangle = 0;
16038        var bufferInterval;
16039        var bufferDeg = 0;
16040        var rightside = 0;
16041        var topside = 0;
16042        var bottomside = 0;
16043        var noclick = false;
16044        var zoomed = false;
16045        var clicked = false;
16046        var hidden = false;
16047        var htto;
16048        var hdicon;
16049        var imgldd;
16050        var settingsNumberVisible = false;
16051        style = UpdateObject(style, default_style.but);
16052        style = UpdateObject(style, v[key]);
16053        var actions = [style.action];
16054        action = actions[0];
16055        exist(style.action2) ? actions[1] = style.action2 : '';
16056        exist(style.opposite) ? actions[1] = style.opposite : '';
16057        exist(style.title) ? style.text = style.title : '';
16058        if (exist2(style.scalesmall)) {
16059            o.small ? style.scale = style.scalesmall : ''
16060        }
16061        if (action == "share") {
16062            o.shareme = true
16063        }
16064        if (exist(style.linkurl)) {
16065            if (style.type == "text" && style.linkurl != '') {
16066                if (exist(v[style.linkurl + 'text'])) {
16067                    style.text = v[style.linkurl + 'text']
16068                }
16069            }
16070            if (style.linkurl.indexOf("settings#") == 0) {
16071                actionstt = style.linkurl;
16072                if (style.tiptext == '' && actionstt.indexOf(",") == -1) {
16073                    style.tiptext = Lang(v.settings['settings' + actionstt.substr(9) + 'action'])
16074                }
16075            }
16076            if (style.linkurl.indexOf("captions") > -1) {
16077                v.hlscaptions = true
16078            }
16079            if (style.linkurl.indexOf("share:") > -1) {
16080                o.shareme = true
16081            }
16082            if (style.linkurl == "countdown") {
16083                style.counter = new PluginCountdown(style)
16084            }
16085        }
16086        var tips = style.tiptext ? style.tiptext.split("///") : [];
16087        if (style.liketext == 1) {
16088            style.type = "text";
16089            style.text = TipText(0) + (actions.length > 1 ? '///' + TipText(1) : '');
16090            if (exist2(style.iconscolor)) {
16091                style.color = style.iconscolor
16092            }
16093        }
16094        style.it = [];
16095        style.il = [];
16096        var _currentIcon = 0;
16097        var icons = new Array();
16098        var icon = new Array();
16099        var iconsover = new Array();
16100        var iconspress = new Array();
16101        var iconreplay = 0;
16102        var replay;
16103        if (style.type == "text") {
16104            if (style.dom) {
16105                if (exist(v[style.dom + 'text'])) {
16106                    style.text = v[style.dom + 'text']
16107                }
16108            }
16109            if (exist(style.text)) {
16110                icons[0] = trim(style.text);
16111                style.lngth = style.text.length;
16112                var smbls = ['/', '|', '-'];
16113                smbls.indexOf(style.text.substr(-1)) > -1 ? style.postsmbl = style.text.substr(-1) : '';
16114                smbls.indexOf(style.text.substr(0, 1)) > -1 ? style.presmbl = style.text.substr(0, 1) : '';
16115                if (action == "time" || action == "duration") {
16116                    if (style.text.indexOf('0:') == 0) {
16117                        style.timeshort = true
16118                    }
16119                    if (style.text.split(":").length == 3) {
16120                        style.with_hours = true
16121                    } else {
16122                        if (style.text.indexOf('00:00') > -1) {
16123                            style.with_min = true
16124                        }
16125                    }
16126                    if (style.dvrtime == 1) {
16127                        v.dvrtime = 1
16128                    }
16129                }
16130                if (style.inversetime == 1 && style.text.indexOf("-") == 0) {
16131                    style.minus4back = true
16132                }
16133                if (style.text.indexOf("///") > 0 && (action == "custom" || style.liketext == 1)) {
16134                    style.texts = style.text.split("///");
16135                    style.text = icons[0] = style.texts[0]
16136                }
16137            }
16138            if (v.fonts == 1) {
16139                setTimeout(ResizeText, 100);
16140                setTimeout(ResizeText, 500);
16141                setTimeout(ResizeText, 1000)
16142            }
16143        } else {
16144            if (exist(style.icon)) {
16145                icons[0] = style.icon;
16146                if (icons[0].indexOf("///") > 0 && icons[0].indexOf("base64") == -1) {
16147                    icons = style.icon.split("///")
16148                }
16149                if (exist(style.icon2)) {
16150                    icons[1] = style.icon2
16151                }
16152                if (style.iconsreplay == 1) {
16153                    if (exist2(style.icon3)) {
16154                        icons.push(style.icon3);
16155                        iconreplay = icons.length - 1
16156                    }
16157                }
16158            }
16159        }
16160        if (action == "custom") {
16161            if (style.link2 == 1 && exist(style.linkurl2)) {
16162                style.linkurl0 = style.linkurl
16163            }
16164        }
16165        var control = createElement("div");
16166        if (style.position.indexOf('timeline') > -1) {
16167            o.timeline ? o.timeline.appendChild(control) : setTimeout(function () {
16168                o.timeline.appendChild(control)
16169            }, 100);
16170            o.rszr = true
16171        } else {
16172            if (indOf2(style.position, ["control", "bottom"]) && o.tlbrhd) {
16173                o.toolbar.appendChild(control)
16174            } else {
16175                o.frame.appendChild(control)
16176            }
16177            if (action == "buffer" && style.ontop2 == 1) {
16178                control.style.zIndex = 2001
16179            }
16180        }
16181        if (style.svgtmln == 1) {
16182            style.tmln = new PlgnCntrlTmln(style, control)
16183        }
16184        var bgcontainer = createElement("div");
16185        control.appendChild(bgcontainer);
16186        var icns = createElement("div");
16187        css(icns, {
16188            "position": "absolute",
16189            "left": 0,
16190            "top": 0
16191        });
16192        control.appendChild(icns);
16193        css(control, {
16194            "position": "absolute",
16195            "left": 0,
16196            "top": 0,
16197            "opacity": 1,
16198            "fontSize": "14px",
16199            "lineHeight": "1em"
16200        });
16201        if (exist2(style.dom)) {
16202            attr(control, {
16203                "id": (v.id + "_" + "control_" + style.dom)
16204            })
16205        }
16206        if (style.rotateplaying == 1 || style.rotateonhover == 1) {
16207            css(icns, {
16208                "transition": "transform 0.2s linear"
16209            })
16210        }
16211        if (icons.length > 0) {
16212            for (i = 0; i < icons.length; i++) {
16213                icon[i] = createElement("div");
16214                css(icon[i], {
16215                    "position": "absolute",
16216                    "top": 0,
16217                    "left": 0,
16218                    "pointerEvents": "none",
16219                    "opacity": style.a,
16220                    "transition": "opacity 0.1s linear"
16221                });
16222                if (style.scaleover > style.scale) {
16223                    css(icon[i], {
16224                        "transition": "opacity 0.1s linear,transform 0.1s linear"
16225                    })
16226                }
16227                if (style.type == "pic" && style.src != '') {
16228                    if (exist2(style.dom)) {
16229                        attr(icon[i], {
16230                            "id": (v.id + "_" + "control" + "_" + style.dom + "_" + "icon")
16231                        });
16232                        if (v[style.dom + 'src']) {
16233                            style.src = v[style.dom + 'src']
16234                        }
16235                    }
16236                    if (indOf2(style.src, [".png", ".jpg", ".webp", "base64", ".gif"])) {
16237                        style.src.indexOf("//") == -1 && style.src.indexOf("base64") == -1 ? style.src = '//' + style.src : '';
16238                        var z = createElement("img");
16239                        style.loading = 1;
16240                        z.addEventListener("load", imageLoaded);
16241                        z.src = style.src;
16242                        icon[i].appendChild(z);
16243                        style.w = icon[i].offsetWidth;
16244                        style.h = icon[i].offsetHeight;
16245                        if (style.picheight > 0) {
16246                            css(z, {
16247                                height: style.picheight
16248                            })
16249                        }
16250                    }
16251                }
16252                if (style.type == "text") {
16253                    css(icon[i], {
16254                        "color": (style.color),
16255                        "fontSize": style.fontsize * existv(v.globalfs, 1),
16256                        "fontFamily": checkFont(style.font),
16257                        "letter-spacing": style.letterspacing + 'px',
16258                        "padding": "0 3px 0 3px",
16259                        "white-space": "nowrap"
16260                    });
16261                    if (o.small) {
16262                        if (exist2(style.fontsizesmall)) {
16263                            css(icon[i], {
16264                                "fontSize": style.fontsizesmall * existv(v.globalfs, 1),
16265                            })
16266                        }
16267                    }
16268                    if (style.click == 1) {
16269                        if (style.text.indexOf("<a ") > -1 || key == "control_title") {
16270                            css(icon[i], {
16271                                "pointerEvents": "auto"
16272                            })
16273                        }
16274                    }
16275                    if (style.bold == 1) {
16276                        css(icon[i], {
16277                            "font-weight": "bold"
16278                        })
16279                    }
16280                    if (style.wght > 0) {
16281                        css(icon[i], {
16282                            "font-weight": style.wght
16283                        })
16284                    }
16285                    if (style.lineh) {
16286                        css(icon[i], {
16287                            "lineHeight": style.lineh + "em"
16288                        })
16289                    }
16290                    icons[i] == 'live' ? icons[i] = Lang("live") : '';
16291                    icon[i].innerHTML = Places(icons[i]);
16292                    setTimeout(Marquee, 100);
16293                    style.w = icon[i].offsetWidth;
16294                    style.h = icon[i].offsetHeight;
16295                    if (exist2(style.dom)) {
16296                        attr(icon[i], {
16297                            "id": (v.id + "_control_" + style.dom + "_text")
16298                        })
16299                    }
16300                }
16301                if (style.type == "css") {
16302                    o.start ? setTimeout(SetCSS, 200) : ''
16303                }
16304                var icn = icons[i].toString();
16305                if (icn.indexOf('var:') == 0) {
16306                    icn = existv(window[icn.substr(4)], '')
16307                }
16308                var isvg = icn.indexOf('<svg') > -1 || icn.indexOf('<SVG') > -1;
16309                if (style.type == "svg" && (icn.indexOf('<g>') > -1 || isvg)) {
16310                    if (action == "mute" || action == "custom") {
16311                        icn = icn.replace(/pjs_/g, 'pjs_' + v.id + key)
16312                    }
16313                    if (icn.indexOf('pointer') > -1) {
16314                        Clickable(icon[i])
16315                    }
16316                    icon[i].innerHTML = (!isvg ? "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" : '') + icn + (!isvg ? "</svg>" : '');
16317                    icon[i].offsetWidth > 20 ? style.w = icon[i].offsetWidth : '';
16318                    icon[i].offsetHeight > 20 ? style.h = icon[i].offsetHeight : '';
16319                    css(icon[i], {
16320                        "width": style.w,
16321                        "height": style.h
16322                    });
16323                    if (style.iconscolor != -1) {
16324                        IconsColor(icon, style.iconscolor)
16325                    }
16326                    if (exist2(style.dom)) {
16327                        attr(icon[i], {
16328                            "id": (v.id + "_control_" + style.dom + "_icon" + i)
16329                        })
16330                    }
16331                }
16332                icns.appendChild(icon[i]);
16333                i > 0 ? hide(icon[i]) : ''
16334            }
16335            Background();
16336            imgldd ? imageLoaded() : '';
16337            if (style.linkurl == "chromecast") {
16338                style.chromecast = 1;
16339                style.hide = 1;
16340                o.chromecast ? icon[0].innerHTML = o.chromecast.button(style.iconscolor != -1 ? style.iconscolor : '#ffffff') : '';
16341                if (o.system.mobile) {
16342                    icon[0].ontouchstart = onMobOver;
16343                    icon[0].ontouchend = onOut;
16344                    icon[0].ontouchmove = onMobMove
16345                } else {
16346                    icon[0].onmouseover = onOver;
16347                    icon[0].onmouseout = onOut;
16348                    icon[0].onmousemove = onMove
16349                }
16350            } else {
16351                if ((bg.offsetWidth * style.scale < 35 || bg.offsetHeight * style.scale < 35) && style.type != 'text') {
16352                    ClickArea();
16353                    Clickable(area)
16354                } else {
16355                    Clickable(bg)
16356                }
16357            }
16358            if (action == "custom") {
16359                var lu = '';
16360                if (style.link == 1 && exist(style.linkurl)) {
16361                    lu = style.linkurl;
16362                    if (lu.indexOf("api:") == 0) {
16363                        var tmp = lu.substr(4).split(",");
16364                        if (tmp.length == 2) {
16365                            var tmp2 = tmp[1].split("/");
16366                            if (tmp2.length == 2) {
16367                                tmp[0] == 'hd' ? tmp[0] = "default_quality" : '';
16368                                if (v[tmp[0]] == tmp2[1]) {
16369                                    style.a = 1;
16370                                    css(icon[0], {
16371                                        "opacity": style.a
16372                                    })
16373                                }
16374                            }
16375                        }
16376                    }
16377                    if (lu == "unblock" || lu == "block") {
16378                        o.actions.Curtain();
16379                        control.style.zIndex = 2001;
16380                        o.stopkeys = 1
16381                    }
16382                }
16383                if ((style.hide == 1 && (style.hideafter == 1 || style.hidebefore == 1 || style.hidebefore2 == 1)
16383) || lu.indexOf("skip") == 0 || lu == "bandwidth" || lu == "bitrate") {
16384                    style.often = 1;
16385                    if (indOf([style.position], "control") || style.hideonleaveandplay == 1) {
16386                        style.often2 = 1
16387                    }
16388                }
16389                if (lu.indexOf("skip") == 0) {
16390                    control.style.zIndex = 2001
16391                }
16392            }
16393            for (var sf in style) {
16394                if (exist2(style[sf + '_' + 'var'])) {
16395                    if (exist2(options[style[sf + '_' + 'var']])) {
16396                        style[sf] = options[style[sf + '_' + 'var']]
16397                    }
16398                }
16399            }
16400            if (action == "settings" && style.hdicon == 1) {
16401                hdicon = new PluginHdIcon(control, bg, style)
16402            }
16403            if (style.click == 0) {
16404                Pnt0(control)
16405            }
16406            if (style.loading == 1) {
16407                hide(bg)
16408            }
16409            if (style.tip == 1) {
16410                CreateTip()
16411            }
16412            if (style.position.indexOf("right") > -1) {
16413                rightside = 1
16414            }
16415            if (style.position.indexOf("top") > -1) {
16416                topside = 1
16417            }
16418            if (style.position.indexOf("bottom") > -1) {
16419                bottomside = 1;
16420                action == "custom" && exist2(style.linkurl) ? control.style.zIndex = 2001 : ''
16421            }
16422            if (style.position.indexOf("control") > -1) {
16423                bottomside = 1
16424            }
16425            Resize();
16426            var t = '';
16427            if (style.rotation != 0) {
16428                t += "rotate(" + style.rotation + "deg)"
16429            }
16430            if (style.flipx == 1) {
16431                t += " scaleX(-1)"
16432            }
16433            if (style.flipy == 1) {
16434                t += " scaleY(-1)"
16435            }
16436            if (t != '') {
16437                css(icns, {
16438                    "transform": t
16439                })
16440            }
16441            if (action == "buffer") {
16442                BufferStop()
16443            }
16444            var tmp = [];
16445            var i;
16446            if (action == "playlist") {
16447                tmp = ['autoplaylist', 'openplaylistafter', 'openplaylistbefore', 'openplaylistpause', 'openplaylistroot', 'playlistrewind'];
16448                for (i = 0; i < tmp.length; i++) {
16449                    if (exist(style[tmp[i]]) && !exist(v.playlist[tmp[i]])) {
16450                        v.playlist[tmp[i]] = style[tmp[i]]
16451                    }
16452                }
16453            }
16454            if (action == "title") {
16455                tmp = ['showtitleplaylist', 'addtitleplaylist', 'addtitleplaylistbr'];
16456                for (i = 0; i < tmp.length; i++) {
16457                    if (exist(style[tmp[i]]) && !exist(options[tmp[i]])) {
16458                        v[tmp[i]] = style[tmp[i]]
16459                    }
16460                }
16461            }
16462            style.tipalways == 1 ? Tip() : '';
16463            if (action == "custom" && style.on == 0) {
16464                hide2(control)
16465            }
16466            if (style.hide == 1 && style.hideuntilto > 0) {
16467                setTimeout(Hideuntilto, style.hideuntilto * 1000)
16468            }
16469        }
16470
16471        function Hideuntilto() {
16472            style.hideuntilto = -1;
16473            o.controls.refresh()
16474        }
16475
16476        function ClickArea() {
16477            if (area) {
16478                area.parentNode.removeChild(area)
16479            }
16480            area = createElement("div");
16481            css(area, {
16482                "position": "absolute",
16483                "top": 0,
16484                "left": 0,
16485                "width": style.type == "pic" ? bg.offsetWidth : (bg.offsetWidth > 35 ? bg.offsetWidth : 35) * style.clickscalex,
16486                "height": style.type == "pic" ? bg.offsetHeight : (bg.offsetHeight > 35 ? bg.offsetHeight : 35) * style.clickscaley
16487            });
16488            style = MarginPadding(style, 'clickmargin', 'clickmargin');
16489            control.appendChild(area)
16490        }
16491
16492        function Clickable(x) {
16493            if (action.indexOf("time") == 0 && actions.length == 1) {
16494                style.click = 0
16495            }
16496            if (action == "custom" && style.link == 0) {
16497                style.click = 0
16498            }
16499            if (style.click == 1) {
16500                if (style.hand == 1) {
16501                    css(x, {
16502                        "cursor": "pointer"
16503                    })
16504                }
16505                css(x, {
16506                    "pointerEvents": "auto"
16507                });
16508                if (o.system.mobile) {
16509                    x.addEventListener("touchmove", function (e) {
16510                        onMobMove(e)
16511                    });
16512                    x.addEventListener("touchstart", function (e) {
16513                        onMobOver(e)
16514                    });
16515                    x.addEventListener("touchend", function (e) {
16516                        onMobOut(e)
16517                    })
16518                }
16519                if (v.desktop == 1 || !o.system.mobile) {
16520                    x.onclick = onClick
16521                }
16522                if (v.toolbar.clickarea == 1 || style.clickarea == 1) {
16523                    css(x, {
16524                        "background-color": "#ff0000",
16525                        "opacity": 0.5
16526                    })
16527                }
16528            } else {
16529                css(x, {
16530                    "cursor": "default"
16531                })
16532            }
16533            if (!o.system.mobile) {
16534                x.onmouseover = onOver;
16535                x.onmouseout = onOut
16536            }
16537            if (style.hidden == 1 || style.tip == 1) {
16538                x.onmousemove = onMove
16539            }
16540        }
16541
16542        function onMobMove(e) {
16543            js("touch_" + key);
16544            e.stopPropagation();
16545            touchmove = true
16546        }
16547
16548        function onMobOver(e) {
16549            style.mobileover == 1 ? onOver() : '';
16550            e.stopPropagation()
16551        }
16552
16553        function onMobOut(e) {
16554            e.stopPropagation();
16555            e.preventDefault();
16556            style.mobileover == 1 ? onOut() : '';
16557            if (!touchmove) {
16558                onClick(e)
16559            }
16560            touchmove = false
16561        }
16562
16563        function Background() {
16564            if (bg) {
16565                bg.parentNode.removeChild(bg)
16566            }
16567            bg = createElement("div");
16568            css(bg, {
16569                "position": "absolute",
16570                "top": 0,
16571                "left": 0
16572            });
16573            if (exist2(style.dom)) {
16574                attr(bg, {
16575                    "id": (v.id + "_control_" + style.dom + "_bg")
16576                })
16577            }
16578            w = style.w;
16579            h = style.h;
16580            style.bgt = -1;
16581            style.bgl = -1;
16582            style = MarginPadding(style, 'margin', 'margin');
16583            style = MarginPadding(style, 'marginproc', 'marginproc');
16584            if (style.mrgnprs && o.small) {
16585                if (style.mrgnprs != '0 0 0 0') {
16586                    style = MarginPadding(style, 'marginproc', 'mrgnprs')
16587                }
16588            }
16589            if (style.type == "text") {
16590                w = icon[_currentIcon].offsetWidth;
16591                h = icon[_currentIcon].offsetHeight;
16592                if (style.minw > 0) {
16593                    w < style.minw ? w = style.minw : ''
16594                }
16595            }
16596            style = MarginPadding(style, 'bgpadding', 'bgpadding');
16597            style = MarginPadding(style, 'iconmargin', 'iconmargin');
16598            if (exist2(style.dom) && exist(v.custom) && style.action == "custom") {
16599                if (typeof (v.custom) == 'object') {
16600                    for (var i = 0; i < Object.keys(v.custom).length; i++) {
16601                        if (v.custom[i][style.dom]) {
16602                            if (v.custom[i][style.dom] == "off") {
16603                                style.on = 0
16604                            } else {
16605                                var tmp = v.custom[i][style.dom].split(":");
16606                                if (tmp[0] == "margin-left") {
16607                                    if (tmp[1].indexOf("%") > 0) {
16608                                        style.marginprocleft = parseInt(tmp[1])
16609                                    } else {
16610                                        style.marginleft = parseInt(tmp[1])
16611                                    }
16612                                }
16613                            }
16614                        }
16615                    }
16616                }
16617            }
16618            style.h = h;
16619            style.w = w;
16620            if (style.bg == 1) {
16621                h = h + style.bgpaddingtop + style.bgpaddingbottom;
16622                w = w + style.bgpaddingleft + style.bgpaddingright;
16623                style.h = h;
16624                style.w = w;
16625                if (style.type == "text") {
16626                    style.bgh = icon[0].offsetHeight
16627                }
16628            } else {
16629                style.bga = 0
16630            }
16631            css(bg, {
16632                "width": (style.bgstretch == 1 ? 5000 : w),
16633                "height": h,
16634                "borderRadius": (style.bgo * h) / 2,
16635                "background": (style.bggr == 1 ? "linear-gradient(" + (style.bggrl == 1 ? "to right," : '') + hex2rgb(style.bgcolor, style.bga) + "," + hex2rgb(style.bggrc, style.bga) + ")" : hex2rgb(style.bgcolor, style.bga)),
16636                "transition": "background .1s linear, transform .1s linear" + (exist2(style.bgbrovr) ? ', filter .1s linear' : '')
16637            });
16638            if (style.type == "pic") {
16639                css(bg, {
16640                    "width": w,
16641                    "height": h,
16642                    "borderRadius": (style.bgo * h / style.scale) / 2,
16643                })
16644            }
16645            if (style.bglines == 1) {
16646                Bglines(bg, style.bgcolor, style.bgline1, style.bgline2)
16647            }
16648            if (style.bgborder == 1) {
16649                css(bg, {
16650                    "border": existv(style.bgbrdrw, 1) + "px solid " + style.bgbordercolor
16651                })
16652            }
16653            if (style.blur == 1) {
16654                css(bg, {
16655                    'backdrop-filter': 'blur(8px)'
16656                })
16657            }
16658            bgcontainer.appendChild(bg)
16659        }
16660
16661        function Resize() {
16662            var bgt = (-bg.offsetHeight / 2);
16663            var bgl = (-bg.offsetWidth / 2);
16664            if (bgt != style.bgt || bgl != style.bgl) {
16665                css(bg, {
16666                    "top": (-bg.offsetHeight / 2),
16667                    "left": (-bg.offsetWidth / 2)
16668                });
16669                style.bgt = bgt;
16670                style.bgl = bgl
16671            }
16672            if (area) {
16673                var x = style.type == "pic" ? bg.offsetWidth : (bg.offsetWidth > 35 ? bg.offsetWidth : 35);
16674                var y = style.type == "pic" ? bg.offsetHeight : (bg.offsetHeight > 35 ? bg.offsetHeight : 35);
16675                css(area, {
16676                    "top": (-y / 2) + style.clickmargintop - style.clickmarginbottom,
16677                    "left": (-x / 2) + style.clickmarginleft - style.clickmarginright
16678                })
16679            }
16680            for (var i = 0; i < icons.length; i++) {
16681                var it = style.type == "svg" ? Math.round(parseInt(icon[i].style.height)) / 2 : Math.round(icon[i].offsetHeight) / 2;
16682                var il = style.type == "svg" ? parseInt(icon[i].style.width) / 2 : icon[i].offsetWidth / 2;
16683                if (it != style.it[i] || il != style.il[i]) {
16684                    css(icon[i], {
16685                        "top": -it,
16686                        "left": -il
16687                    });
16688                    if (bg) {
16689                        css(icon[i], {
16690                            "top": (int(icon[i].style.top) + style.bgpaddingtop / 2 - style.bgpaddingbottom / 2 + style.iconmargintop / 2 + style.iconmarginbottom / 2),
16691                            "left": (int(icon[i].style.left) + style.bgpaddingleft / 2 - style.bgpaddingright / 2 + style.iconmarginleft / 2 + style.iconmarginright / 2)
16692                        })
16693                    }
16694                    style.it[i] = it;
16695                    style.il[i] = il
16696                }
16697            }
16698        }
16699
16700        function onOver() {
16701            var i;
16702            over = true;
16703            if (style.iconsover == 1) {
16704                if (on && exist(style.icon2)) {
16705                    i = 1
16706                } else {
16707                    i = 0
16708                }
16709                if (replay && iconsover.length > 2) {
16710                    i = 2
16711                }
16712                if (iconsover[i]) {
16713                    hideAllIcons();
16714                    show(icon[iconsover[i]])
16715                }
16716            }
16717            if (style.bg == 1) {
16718                css(bg, {
16719                    "background": hex2rgb(exist2v(style.bgcolorover, style.bgcolor), exist2v(style.bgaover, style.bga))
16720                });
16721                if (exist2(style.bgbrovr)) {
16722                    css(bg, {
16723                        "filter": "brightness(" + style.bgbrovr + ")"
16724                    })
16725                }
16726            }
16727            if (style.aover > -1 && !selectOpen) {
16728                for (i = 0; i < icons.length; i++) {
16729                    if (icon[i].style.visibility != "hidden") {
16730                        css(icon[i], {
16731                            "opacity": style.aover
16732                        })
16733                    }
16734                }
16735            }
16736            if (style.iconscolorover != -1) {
16737                IconsColor(icon, style.iconscolorover)
16738            }
16739            if (style.rotateonhover == 1) {
16740                iconangle += 45;
16741                Rot(icon[0], iconangle)
16742            }
16743            if (style.scaleover > style.scale && style.scaleover > -1) {
16744                scale(style.scaleover)
16745            }
16746            if (action == "settings" && o.controls.SettingsVisible()) {} else {
16747                if (style.tip == 1 && style.tipalways != 1) {
16748                    var x = tips.length > 1 && !on ? tips[1] : tips[0];
16749                    if (x) {
16750                        if (x.indexOf('var:') == 0) {
16751                            tiptext.innerHTML = window[x.substr(4)];
16752                            Tip()
16753                        }
16754                    }
16755                    show(tip);
16756                    css(tip, {
16757                        "opacity": 1
16758                    })
16759                }
16760            }
16761            if (action == "mute") {
16762                o.actions.volumewheel(true);
16763                o.volumewheel = true
16764            }
16765            o.controlover = true;
16766            o.controls.Mouse(key, "over")
16767        }
16768
16769        function onOut() {
16770            over = false;
16771            var i;
16772            if (style.iconsover == 1) {
16773                if (on && exist(style.icon2)) {
16774                    i = 1
16775                } else {
16776                    i = 0
16777                }
16778                if (replay && iconsover.length > 2) {
16779                    i = 2
16780                }
16781                hideAllIcons();
16782                show(icon[i])
16783            }
16784            if (style.bg == 1) {
16785                css(bg, {
16786                    "background": hex2rgb(style.bgcolor, style.bga)
16787                });
16788                if (exist2(style.bgbrovr)) {
16789                    css(bg, {
16790                        "filter": "brightness(1)"
16791                    })
16792                }
16793            }
16794            if (style.aover > -1) {
16795                for (i = 0; i < icons.length; i++) {
16796                    if (icon[i].style.visibility != "hidden") {
16797                        css(icon[i], {
16798                            "opacity": style.a
16799                        })
16800                    }
16801                }
16802            }
16803            if (style.scaleover > -1) {
16804                scale(style.scale)
16805            }
16806            if (style.iconscolorover != -1) {
16807                IconsColor(icon, (style.iconscolor == -1 ? '#ffffff' : style.iconscolor))
16808            }
16809            if (action == "mute" && !o.fullscreen) {
16810                o.actions.volumewheel(false);
16811                o.volumewheel = false
16812            }
16813            TipHide();
16814            o.controlover = false;
16815            o.controls ? o.controls.Mouse(key, "out") : ''
16816        }
16817
16818        function TipHide() {
16819            if (style.tip == 1 && style.tipalways != 1) {
16820                hide(tip);
16821                css(tip, {
16822                    "opacity": 0
16823                })
16824            }
16825        }
16826
16827        function onClick(e) {
16828            e ? e.cancelBubble = true : '';
16829            if (!noclick) {
16830                o.controls.ControlClick(key);
16831                if (action == "custom") {
16832                    CustomToogle()
16833                }
16834                TipHide();
16835                if (style.rotateonclick == 1) {
16836                    iconangle -= 30;
16837                    Rot(icon[0], iconangle)
16838                }
16839                clicked = true;
16840                if (style.hideafterclick == 1 || (key == "control_start" && style.hide == 1 && style.hideonplay == 1)) {
16841                    o.controls.refresh()
16842                }
16843            }
16844        };
16845        this.Click = function () {
16846            onClick()
16847        };
16848
16849        function CustomToogle() {
16850            if (icons) {
16851                if (icons.length > 1) {
16852                    if (on == true) {
16853                        show(icon[0]);
16854                        hide(icon[1])
16855                    } else {
16856                        show(icon[1]);
16857                        hide(icon[0])
16858                    }
16859                }
16860                if (style.tip == 1 && tips.length > 1) {
16861                    tiptext.innerHTML = o.ni + (on == true ? tips[0] : tips[1]) + o.ni2;
16862                    Tip()
16863                }
16864            }
16865            if (exist(style.linkurl0)) {
16866                if (on == true) {
16867                    style.linkurl = style.linkurl0
16868                } else {
16869                    style.linkurl = style.linkurl2
16870                }
16871            }
16872            SwitchText();
16873            on = on != true;
16874            if (style.linkurl) {
16875                if (style.linkurl.indexOf(",0/1") > -1) {
16876                    js(style.linkurl, on ? 1 : 0)
16877                }
16878            }
16879            if (style.bg == 1 && exist(style.bgcolorlink2)) {
16880                if (style.bgcolorlink2 != -1) {
16881                    if (on) {
16882                        style.bgcolorlink0 = style.bgcolor;
16883                        style.bgcolor = style.bgcolorlink2
16884                    } else {
16885                        style.bgcolor = style.bgcolorlink0
16886                    }
16887                    Background();
16888                    Clickable(bg);
16889                    Resize();
16890                    if (style.type == "text") {
16891                        ResizeText()
16892                    } else {
16893                        scale(style.scale)
16894                    }
16895                }
16896            }
16897        }
16898
16899        function SwitchText() {
16900            if (exist(style.texts)) {
16901                if (style.texts.length > 1) {
16902                    if (on == true) {
16903                        UpdateText(style.texts[0])
16904                    } else {
16905                        UpdateText(style.texts[1])
16906                    }
16907                }
16908            }
16909        }
16910
16911        function ReplayIcon(event) {
16912            event.cancelBubble = true;
16913            o.controls.ControlClick(key)
16914        }
16915
16916        function hideAllIcons() {
16917            for (var i = 0; i < icons.length; i++) {
16918                if (icon[i].style.visibility != "hidden") {
16919                    css(icon[i], {
16920                        "opacity": style.a
16921                    });
16922                    hide(icon[i])
16923                }
16924            }
16925        }
16926
16927        function Marquee(text) {
16928            if (icon[0]) {
16929                if (icon[0].offsetWidth > o.screen_w - style.marginleft - style.marginright - style.bgpaddingleft - style.bgpaddingright) {
16930                    if (style.marquee == 1) {
16931                        if (!text) {
16932                            text = icon[0].innerHTML
16933                        }
16934                        icon[0].innerHTML = '<marquee>' + text + '</marquee>'
16935                    } else {
16936                        css(icon[0], {
16937                            "white-space": "normal"
16938                        })
16939                    }
16940                    css(icon[0], {
16941                        "width": o.screen_w - style.marginleft - style.marginright - style.bgpaddingleft - style.bgpaddingright
16942                    })
16943                }
16944            }
16945        }
16946
16947        function imageLoaded() {
16948            if (bg) {
16949                imgldd = false;
16950                style.loading = 0;
16951                hide(bg);
16952                if (icon[0]) {
16953                    style.w = icon[0].offsetWidth * style.scale;
16954                    style.h = icon[0].offsetHeight * style.scale;
16955                    scale(style.scale)
16956                }
16957                style.loaded = 0;
16958                Background();
16959                ClickArea();
16960                Clickable(area);
16961                show(bg);
16962                Resize();
16963                o.controls.resize();
16964                if (!isVisible(control)) {
16965                    hide2(control)
16966                }
16967            } else {
16968                imgldd = true
16969            }
16970        }
16971
16972        function CancelBubble(event) {
16973            event.cancelBubble = true
16974        }
16975
16976        function onMove() {
16977            if (!o.system.mobile && !o.controlover) {
16978                onOver()
16979            }
16980            Tip()
16981        }
16982
16983        function scale(x) {
16984            if (x > 0) {
16985                css(bg, {
16986                    "transform": "scale(" + x + ")"
16987                });
16988                for (i = 0; i < icons.length; i++) {
16989                    css(icon[i], {
16990                        "transform": "scale(" + x + ")"
16991                    })
16992                }
16993                if (style.tmln) {
16994                    style.tmln.scale(x)
16995                }
16996                scaleX = x;
16997                scaleY = x
16998            }
16999        }
17000
17001        function CreateTip() {
17002            tip = createElement("div");
17003            css(tip, {
17004                'position': 'absolute',
17005                'left': 0,
17006                'top': 0,
17007                'height': 'auto',
17008                "opacity": 0,
17009                "transition": "opacity 0.1s linear"
17010            });
17011            tipbg = createElement("div");
17012            style = MarginPadding(style, 'tippadding', 'tippadding');
17013            style = MarginPadding(style, 'tipmargin', 'tipmargin');
17014            css(tipbg, {
17015                'position': 'absolute',
17016                'left': 0,
17017                'top': 0,
17018                'width': '100%',
17019                'height': 30,
17020                'background-color': style.tipbgcolor,
17021                'opacity': style.tipbga,
17022                'border-radius': style.tipbgrounding
17023            });
17024            tiptext = createElement("div");
17025            css(tiptext, {
17026                'position': 'absolute',
17027                'left': style.tippaddingleft,
17028                'top': style.tippaddingtop,
17029                'color': style.tipcolor,
17030                'font-family': checkFont(style.tipfont),
17031                'font-size': style.tipfontsize * existv(v.globalfs, 1),
17032                "letter-spacing": style.tipletterspacing + 'px',
17033                "line-height": "1"
17034            });
17035            if (style.tiptext) {
17036                if (style.tiptext.indexOf("var:") == 0) {
17037                    style.tipvar = true
17038                }
17039            }
17040            if (!style.tipvar) {
17041                css(tiptext, {
17042                    'white-space': 'nowrap'
17043                })
17044            }
17045            if (style.tippointer == 1) {
17046                tipcrn = createElement("div");
17047                tipcrn.innerHTML = '<svg width="8px" height="6px" viewBox="0 0 8 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><polygon id="Rectangle" stroke="none" fill="#' + style.tipbgcolor.replace("#", "") + '" fill-rule="evenodd" points="0 0 8 0 4 6"></polygon></svg>'
17048            }
17049            if (style.tipalways == 1) {
17050                css(tip, {
17051                    "opacity": 1
17052                });
17053                Clickable(tip)
17054            } else {
17055                Pnt0(tip)
17056            }
17057            control.appendChild(tip);
17058            tiptext.innerHTML = o.ni + (style.tiptext == '' ? Lang(action) : tips[0]) + o.ni2;
17059            tip.appendChild(tipbg);
17060            tip.appendChild(tiptext);
17061            if (style.tippointer == 1) {
17062                tip.appendChild(tipcrn);
17063                var btm = o.doctype ? '-8px' : '-6px';
17064                var ps = style.tippointeralign;
17065                if (!exist(ps)) {
17066                    ps = ''
17067                }
17068                var tp = ps.indexOf("top") > -1;
17069                if (tp) {
17070                    Rot(tipcrn, '-180')
17071                }
17072                css(tipcrn, {
17073                    'position': 'absolute',
17074                    'right': (ps.indexOf("right") > -1 ? 10 * style.scale : 'auto'),
17075                    'left': (ps.indexOf("left") > -1 ? 10 * style.scale : (ps == '' || ps == 'top' ? '50%' : 'auto')),
17076                    'margin-left': (ps == '' || ps == 'top' ? '-4px' : 0),
17077                    'bottom': (tp ? 'auto' : btm),
17078                    'top': (tp ? btm : 'auto'),
17079                    'opacity': style.tipbga
17080                })
17081            }
17082            Tip()
17083        }
17084
17085        function Tip() {
17086            if (style.tip == 1) {
17087                css(tip, {
17088                    "top": (bottomside == 1 ? -h - tip.offsetHeight + 3 : -tip.offsetHeight / 2) + style.tipmargintop - style.tipmarginbottom,
17089                    "left": (rightside == 1 ? -tiptext.offsetWidth : (bottomside == 1 ? -w / 2 : +tiptext.offsetWidth)) - (bottomside == 1 ? 0 : tiptext.offsetWidth / 2 + 5) + style.tipmarginleft - style.tipmarginright,
17090                    "height": style.tippaddingtop + tiptext.offsetHeight + style.tippaddingbottom,
17091                    "width": style.tippaddingleft + tiptext.offsetWidth + style.tippaddingright
17092                });
17093                css(tipbg, {
17094                    'height': tip.offsetHeight
17095                });
17096                tip.style.zIndex = "1000"
17097            }
17098        }
17099        this.c = function () {
17100            return control
17101        };
17102        this.s = function (x) {
17103            return style[x]
17104        };
17105        this.ss = function (x, x2) {
17106            return exist(style[x]) ? style[x][x2] : false
17107        };
17108        this.g = function (x) {
17109            switch (x) {
17110            case "width":
17111                return w;
17112                break;
17113            case "height":
17114                return h;
17115                break;
17116            case "h":
17117                return existv(style.bgh, h);
17118                break;
17119            case "x":
17120                return int(control.style.left);
17121                break;
17122            case "y":
17123                return int(control.style.top);
17124                break;
17125            case "opacity":
17126                return control.style.opacity ? control.style.opacity : 1;
17127                break;
17128            case "show":
17129                return visible;
17130                break;
17131            case "scaleX":
17132                return scaleX;
17133                break;
17134            case "scaleY":
17135                return scaleY;
17136                break;
17137            case "action":
17138                return action;
17139                break;
17140            case "action_settings":
17141                return actionstt;
17142                break;
17143            case "clicked":
17144                return clicked;
17145                break;
17146            case "type":
17147                return style.type;
17148                break;
17149            case "length":
17150                return style.lngth ? style.lngth : 0;
17151                break;
17152            case "key":
17153                return key;
17154                break;
17155            case "x0":
17156                return x0;
17157                break;
17158            case "y0":
17159                return y0;
17160                break;
17161            case "over":
17162                return over;
17163                break;
17164            case "settings#":
17165                return actionstt.indexOf("settings#") == 0;
17166                break;
17167            case "settings:":
17168                return actionstt.indexOf("settings:") == 0;
17169                break;
17170            case "ctxt":
17171                return action == "custom" && style.type == "text";
17172                break;
17173            case "set#visible":
17174                return settingsNumberVisible;
17175                break;
17176            default:
17177                return false
17178            }
17179        };
17180        this.set = function (k, x) {
17181            switch (k) {
17182            case "show":
17183                over ? onOut() : '';
17184                visible = x;
17185                break;
17186            case "display":
17187                DisplayControl(x);
17188                break;
17189            case "show2":
17190                show2(control);
17191                break;
17192            case "hide2":
17193                hide2(control);
17194                break;
17195            case "unhidden":
17196                style.hidden = 0;
17197                break;
17198            case "hidetime":
17199                if (style.hidesec > 0 && style.hidden != 1 && !htto) {
17200                    clearTimeout(htto);
17201                    htto = setTimeout(function () {
17202                        hide2(control);
17203                        (style.hidesec2 != 1 ? style.hidden = 1 : '');
17204                        htto = undefined
17205                    }, style.hidesec * 1000)
17206                }
17207                break;
17208            case "scale":
17209                scale(x);
17210                break;
17211            case "scale0":
17212                css(control, {
17213                    "transform": "scale(0)"
17214                });
17215                break;
17216            case "scaleX":
17217                css(control, {
17218                    "transform": "scaleX(" + x + ")"
17219                });
17220                scaleX = x;
17221                break;
17222            case "scaleY":
17223                css(control, {
17224                    "transform": "scaleY(" + x + ")"
17225                });
17226                scaleY = x;
17227                break;
17228            case "opacity":
17229                css(control, {
17230                    "opacity": x
17231                });
17232                break;
17233            case "iconopacity":
17234                css(icon[0], {
17235                    "opacity": x
17236                });
17237                break;
17238            case "saturate":
17239                css(icon[0], {
17240                    "filter": "saturate(" + x + ")"
17241                });
17242                break;
17243            case "left":
17244                css(control, {
17245                    "left": x
17246                });
17247                break;
17248            case "top":
17249                css(control, {
17250                    "top": x
17251                });
17252                break;
17253            case "width":
17254                css(control, {
17255                    "width": x
17256                });
17257                break;
17258            case "height":
17259                css(control, {
17260                    "height": x
17261                });
17262                break;
17263            case "over_final":
17264                style.over_final = x;
17265                break;
17266            case "rightside":
17267                rightside = x;
17268                break;
17269            case "set#visible":
17270                settingsNumberVisible = x;
17271                break;
17272            case "x":
17273                css(control, {
17274                    "left": x
17275                });
17276                break;
17277            case "y":
17278                css(control, {
17279                    "top": x
17280                });
17281                break;
17282            case "animation":
17283                style.animation = x;
17284                break;
17285            case "skip":
17286                style.skip = x;
17287                break;
17288            case "x0":
17289                x0 = x;
17290                break;
17291            case "y0":
17292                y0 = x;
17293                break;
17294            case "hdnn":
17295                style.hdnn = x;
17296                break;
17297            default:
17298                return false
17299            }
17300        };
17301
17302        function DisplayControl(x) {
17303            if (x && o.system.mobile) {
17304                noclick = true;
17305                setTimeout(noClickTimeout, 300)
17306            }
17307            if (!x) {
17308                if (isReplay() && replay) {
17309                    hide(icon[iconreplay]);
17310                    show(icon[0]);
17311                    replay = false
17312                }
17313            }
17314            if (style.loading == 1) {
17315                x ? show(control) : hide(control)
17316            } else {
17317                if (key == "control_time" || key == "control_duration") {
17318                    x ? show(control) : hide(control)
17319                } else {
17320                    css(control, {
17321                        "display": (x ? "block" : "none")
17322                    })
17323                }
17324                visible = x;
17325                x ? show(control) : ''
17326            }
17327            if (x && style.resizetxt) {
17328                style.resizetxt = false;
17329                setTimeout(ResizeText, 100)
17330            }
17331        }
17332
17333        function noClickTimeout() {
17334            noclick = false
17335        }
17336        this.UpdateText = function (x, y) {
17337            if (actionstt != '' && (style.text == 'x' || style.text == '1x')) {
17338                x = x + 'x'
17339            }
17340            if (y) {
17341                x = style.text + x
17342            }
17343            UpdateText(x);
17344            !isVisible(control) ? style.resizetxt = true : ''
17345        };
17346        var lastt;
17347        this.CustomText = function (x) {
17348            if (lastt != x) {
17349                style.customtext = x;
17350                UpdateText(x);
17351                !isVisible(control) ? style.resizetxt = true : '';
17352                o.controls ? o.controls.resize() : ''
17353            }
17354            lastt = x
17355        };
17356        this.Rotate = function () {
17357            Rot(icns, angle);
17358            angle += 20
17359        };
17360
17361        function Rot(x, y) {
17362            css(x, {
17363                "transform": "rotate(" + y + "deg)" + (x == icon[0] && !zoomed && scaleX != 1 ? ' scale(' + scaleX + ')' : '')
17364            })
17365        };
17366        this.RenewFromTitle = function (x) {
17367            if (style.text.indexOf("{title") > -1) {
17368                UpdateText(style.text)
17369            }
17370        };
17371        this.CustomToogle = function () {
17372            CustomToogle()
17373        };
17374
17375        function UpdateText(text) {
17376            if (style.type == "text") {
17377                if (exist(text)) {
17378                    if (style.with_hours) {
17379                        if (text.length == 4) {
17380                            text = (style.timeshort ? '0:0' : '00:0') + text
17381                        }
17382                        if (text.length == 5) {
17383                            text = (style.timeshort ? '0:' : '00:') + text
17384                        }
17385                        if (text.length == 7) {
17386                            text = (style.timeshort ? '' : '0') + text
17387                        }
17388                    }
17389                    if (style.with_min) {
17390                        if (text.length == 4) {
17391                            text = '0' + text
17392                        }
17393                    }
17394                    style.lngth = text.length
17395                }
17396                text = (style.presmbl ? style.presmbl + (style.minus4back ? '' : ' ') : '') + text + (style.postsmbl ? ' ' + style.postsmbl : '');
17397                var prevorius_default_w = icon[0].offsetWidth + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0);
17398                var prevorius_default_h = icon[0].offsetHeight + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0);
17399                icon[0].innerHTML = o.ni + (action == "custom" ? Places(text) : text) + o.ni2;
17400                if (style.triangle == 1) {
17401                    icon[0].innerHTML += '<span style="display:inline-block;width:10px"></span><span style="border-top: 3px solid ' + CheckColor(style.color) + ';border-left: 3px solid transparent;border-right: 3px solid transparent;position: absolute;right:3px;top: 50%;
17401margin-top: -1px;"></span>'
17402                }
17403                if (action == "title") {
17404                    css(icon[0], {
17405                        "width": "auto",
17406                        "white-space": "nowrap"
17407                    });
17408                    Marquee(text)
17409                }
17410                style.w = icon[0].offsetWidth + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0);
17411                style.h = icon[0].offsetHeight + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0);
17412                if (prevorius_default_w != style.w || prevorius_default_h != style.h || (style.w > 0 && last_text_w == 0)) {
17413                    ResizeText()
17414                }
17415                if (icon[0].offsetWidth > 0) {
17416                    last_text_w = style.w
17417                } else {
17418                    actionstt != '' ? hide(icon[0]) : '';
17419                    if (text != '') {
17420                        setTimeout(ResizeText, 10)
17421                    }
17422                }
17423            }
17424        }
17425        this.ResizeText = function () {
17426            ResizeText()
17427        };
17428
17429        function isReplay() {
17430            return !o.media.isLive() && style.iconsreplay == 1
17431        }
17432
17433        function ResizeText() {
17434            if (style.type == "text") {
17435                if (icon[0]) {
17436                    if (icon[0].offsetWidth > 0) {
17437                        actionstt != '' ? show(icon[0]) : '';
17438                        w = style.w = icon[0].offsetWidth;
17439                        h = style.h = icon[0].offsetHeight;
17440                        Background();
17441                        Clickable(bg);
17442                        Resize();
17443                        if (o.controls) {
17444                            if (indOf([style.position], "control")) {
17445                                o.controls.resizeFromText()
17446                            } else {
17447                                o.controls.resize()
17448                            }
17449                        }
17450                    }
17451                }
17452            }
17453        }
17454        this.UpdateVolume = function (x) {
17455            if (style.displayvolume == 1) {
17456                var n = 4;
17457                if (key == "control_mute") {
17458                    if (o.system.mobile) {
17459                        return
17460                    }
17461                } else {
17462                    n = 8
17463                }
17464                var y = 'pjs_';
17465                var z = [];
17466                for (var i = 1; i < n; i++) {
17467                    z[i] = document.getElementById(y.concat(v.id, key, 'volume_element', i))
17468                }
17469                if (z[1]) {
17470                    for (var i = 1; i < n; i++) {
17471                        z[i] ? hide(z[i]) : ''
17472                    }
17473                    if (n == 4) {
17474                        for (var i = 1; i < n; i++) {
17475                            x > (i / n) && z[i] ? show(z[i]) : ''
17476                        }
17477                    } else {
17478                        for (var i = n; i > 0; i--) {
17479                            if (x * 1 + (1 / n) >= (i / n) && z[i]) {
17480                                show(z[i]);
17481                                break
17482                            }
17483                        }
17484                    }
17485                }
17486            }
17487        };
17488        this.On = function () {
17489            if (!on) {
17490                if (icons) {
17491                    if (icons.length > 1 && actions.length > 1) {
17492                        hide(icon[0]);
17493                        show(icon[1])
17494                    }
17495                }
17496                if (actions.length > 1) {
17497                    action = actions[1];
17498                    if (style.tip == 1) {
17499                        tiptext.innerHTML = TipText(1);
17500                        Tip()
17501                    }
17502                }
17503                if (isReplay() && replay) {
17504                    hide(icon[iconreplay]);
17505                    replay = false
17506                }
17507                SwitchText();
17508                on = true
17509            }
17510        };
17511
17512        function TipText(x) {
17513            return o.ni + (style.tiptext == '' ? Lang(actions[x]) : (tips.length > 1 ? tips[x] : tips[0])) + o.ni2
17514        }
17515        this.CustomSwitch = function (x) {
17516            CustomSwitch(x)
17517        };
17518        this.Tmln = function (x, y) {
17519            if (style.tmln) {
17520                style.tmln.update(x, y)
17521            }
17522        };
17523
17524        function CustomSwitch(x) {
17525            var y = 'pjs_';
17526            var z = document.getElementById(y.concat(v.id, key, 'slider'));
17527            if (z) {
17528                css(z, {
17529                    "transition": "transform 0.1s ease-out"
17530                });
17531                if (x == 1) {
17532                    z.style.transform = 'translate(0, 0)'
17533                } else {
17534                    z.style.transform = 'translate(-7px, 0)'
17535                }
17536            } else {
17537                if (x == 1) {
17538                    style.a = 1
17539                } else {
17540                    style.a = 0.5
17541                }
17542            }
17543            on = x == 1;
17544            if (style.tip == 1 && tips.length > 1) {
17545                tiptext.innerHTML = (on ? tips[0] : tips[1])
17546            }
17547            css(icon[0], {
17548                "opacity": style.a
17549            })
17550        };
17551        this.Off = function () {
17552            if (on) {
17553                if (icons) {
17554                    if (icons.length > 1 && actions.length > 1) {
17555                        show(icon[0]);
17556                        hide(icon[1]);
17557                        css(icon[0], {
17558                            "opacity": style.a
17559                        })
17560                    }
17561                }
17562                action = actions[0];
17563                if (actions.length > 1) {
17564                    if (style.tip == 1) {
17565                        tiptext.innerHTML = TipText(0);
17566                        Tip()
17567                    }
17568                }
17569                SwitchText();
17570                on = false;
17571                replay = false
17572            }
17573        };
17574        this.ReplayIcon = function () {
17575            if (isReplay()) {
17576                hideAllIcons();
17577                show(icon[iconreplay]);
17578                replay = true
17579            }
17580        };
17581        this.Buffer = function () {
17582            var stop = false;
17583            if (style.hide == 1) {
17584                if (style.hidewithposter == 1) {
17585                    if (isVisible(o.poster)) {
17586                        stop = true
17587                    }
17588                }
17589                if (style.hdbfnr == 1 && !o.fullscreen) {
17590                    stop = true
17591                }
17592                if (style.hdbffs == 1 && o.fullscreen) {
17593                    stop = true
17594                }
17595            }
17596            if (!stop) {
17597                show2(control);
17598                var items = control.getElementsByTagName("*");
17599                for (var i = items.length; i--;) {
17600                    css(items[i], {
17601                        "animation-play-state": "running"
17602                    })
17603                }
17604                visible = true
17605            }
17606        };
17607        this.BufferStop = function () {
17608            BufferStop()
17609        };
17610
17611        function BufferStop() {
17612            hide2(control);
17613            var items = control.getElementsByTagName("*");
17614            for (var i = items.length; i--;) {
17615                css(items[i], {
17616                    "animation-play-state": "paused"
17617                })
17618            }
17619            visible = false
17620        }
17621        this.Remove = function () {
17622            if (icons.length > 0) {
17623                for (i = 0; i < icons.length; i++) {
17624                    if (icon[i].parentNode == control) {
17625                        control.removeChild(icon[i])
17626                    }
17627                    icon[i] = null
17628                }
17629            }
17630            if (bg) {
17631                bg.removeAttribute("onclick");
17632                bg.removeAttribute("onmouseover");
17633                bg.removeAttribute("onmouseout");
17634                bg.parentNode.removeChild(bg);
17635                bg = null
17636            }
17637            if (style.position.indexOf('timeline') > -1) {
17638                if (control.parentNode == o.timeline) {
17639                    o.timeline.removeChild(control)
17640                }
17641            } else {
17642                if (control.parentNode == o.frame) {
17643                    o.frame.removeChild(control)
17644                } else {
17645                    if (o.toolbar) {
17646                        if (control.parentNode == o.toolbar) {
17647                            o.toolbar.removeChild(control)
17648                        }
17649                    }
17650                }
17651            }
17652            if (tip) {
17653                if (tip.parentNode == control) {
17654                    control.removeChild(tip)
17655                }
17656            }
17657            control = null
17658        };
17659        this.HdIcon = function () {
17660            hdicon ? hdicon.toggle() : ''
17661        };
17662        this.setcss = function () {
17663            SetCSS()
17664        };
17665
17666        function SetCSS() {
17667            controlCSS(icons[0], style.color, icon[0])
17668        }
17669
17670        function Places(x) {
17671            var z = x + '';
17672            if (x.indexOf('{') > -1) {
17673                if (x.indexOf('{time}') > -1 && exist(o.continue)) {
17674                    x = x.replace('{time}', timeFormat(o.continue.flag().t))
17675                }
17676                if (x.indexOf('{title') > -1) {
17677                    var y = o.titlestore ? o.titlestore : (v.title ? v.title : '');
17678                    if (x.indexOf('{title2}') > -1 && o.controls) {
17679                        x = x.replace('{title2}', o.controls.PlaylistG('title2'))
17680                    }
17681                    if (o.butplstart && o.controls) {
17682                        y = o.controls.PlaylistG('butplstart')
17683                    }
17684                    x = x.replace('{title}', y);
17685                    if (o.butplstart && !o.controls) {
17686                        setTimeout(UpdateText, 100, z)
17687                    }
17688                }
17689                if (x.indexOf('{text') > -1) {
17690                    for (var i = 1; i < 6; i++) {
17691                        if (x.indexOf('{text' + i + '}') > -1) {
17692                            if (exist(v['text' + i])) {
17693                                x = x.replace('{text' + i + '}', v['text' + i])
17694                            } else {
17695                                x = x.replace('{text' + i + '}', '')
17696                            }
17697                        }
17698                    }
17699                }
17700                if (x.indexOf('{next}') > -1) {
17701                    o.ctxtnk = key;
17702                    if (o.controls) {
17703                        x = x.replace('{next}', o.controls.PlaylistG('nxtttl'))
17704                    }
17705                }
17706            }
17707            return x
17708        }
17709        this.UpText = function () {
17710            UpdateText(style.text)
17711        };
17712
17713        function IconsColor(icon, clr) {
17714            for (var i = 0; i < icon.length; i++) {
17715                SvgColor(icon[i], clr)
17716            }
17717            if (style.linkurl == "chromecast") {
17718                if (o.chromecast) {
17719                    o.chromecast.Color(icon[0], clr)
17720                }
17721            }
17722        }
17723    };
17724    var ControlLine = function (key, action) {
17725        var i;
17726        var style = [];
17727        var w;
17728        var h;
17729        var bg;
17730        var visible = true;
17731        var x0;
17732        var y0;
17733        var scaleX = 1;
17734        var scaleY = 1;
17735        var topBg = 0;
17736        var leftBg = 0;
17737        var alphas;
17738        var mouseDown;
17739        var mouseUp;
17740        var over;
17741        var click;
17742        var handle;
17743        var _duration_load;
17744        var _duration_play;
17745        var _time_load;
17746        var _time_play;
17747        var tip;
17748        var tiptext;
17749        var tipcrn;
17750        var thmove;
17751        var movevent;
17752        o.current_thumb = -1;
17753        var lastTouch;
17754        var over;
17755        var onup_to;
17756        for (i in default_style.but) {
17757            style[i] = default_style.but[i]
17758        }
17759        var action = v[key].action;
17760        var type = v[key].type;
17761        for (i in default_style[action]) {
17762            style[i] = default_style[action][i]
17763        }
17764        for (i in v[key]) {
17765            style[i] = v[key][i]
17766        }
17767        style.w = parseInt(style.w);
17768        style.h = parseInt(style.h);
17769        style = MarginPadding(style, 'margin', 'margin');
17770        style = MarginPadding(style, 'marginproc', 'marginproc');
17771        if (o.small) {
17772            if (style.wps > 0) {
17773                style.w = parseInt(style.wps)
17774            }
17775            if (style.mrgnprs) {
17776                if (style.mrgnprs != '0 0 0 0') {
17777                    style = MarginPadding(style, 'marginproc', 'mrgnprs')
17778                }
17779            }
17780        }
17781        var control = createElement("div");
17782        if (v.toolbar.hidedown == 1 && v.toolbar.hide == 1) {
17783            o.toolbar.appendChild(control)
17784        } else {
17785            o.frame.appendChild(control)
17786        }
17787        action == "line" ? o.timeline = control : '';
17788        var _cul = false;
17789        if (style.customline) {
17790            if (style.customline != 'volume') {
17791                _cul = true
17792            }
17793        }
17794        css(control, {
17795            "position": "absolute",
17796            "top": 0,
17797            "left": 0,
17798            "opacity": 1,
17799            "fontSize": "14px",
17800            "lineHeight": "1em"
17801        });
17802        if (style.ontop == 1) {
17803            control.style.zIndex = style.order
17804        }
17805        Background();
17806        var lines = createElement("div");
17807        css(lines, {
17808            "position": "absolute",
17809            "bottom": Math.round(-style.h / 2),
17810            "left": Math.round(-style.w / 2)
17811        });
17812        if (style.rounding > 0 && style.roundout == 1) {
17813            css(lines, {
17814                "border-radius": style.rounding * style.h / 2,
17815                "height": style.h,
17816                "overflow": "hidden",
17817                "pointer-events": "none"
17818            })
17819        }
17820        if (exist2(style.dom)) {
17821            attr(control, {
17822                "id": (v.id + "_control_" + style.dom)
17823            })
17824        }
17825        control.appendChild(lines);
17826        if (action == 'line' && v.thumbs == 1) {
17827            CreateThumb()
17828        }
17829        if (style.tip == 1) {
17830            CreateTip()
17831        }
17832        var line0 = createElement("div");
17833        StyleLine(0, line0, 0.3, (style.gradient == 1 ? "linear-gradient(" + (style.grdlft == 1 ? "to left," : '') + CheckColor(style.gradientcolorbg) + ", " + CheckColor(style.colorbg) + ")" : CheckColor(style.colorbg)), style.w, style.abg);
17834        if (style.customdesign == 1 && exist(style.customdesignsvg)) {
17835            var svg0 = createElement("div");
17836            svg0.innerHTML = style.customdesignsvg.replace(/\#FFFFFF/g, CheckColor(style.colorbg));
17837            line0.appendChild(svg0);
17838            css(svg0, {
17839                "position": "absolute",
17840                "bottom": -Math.round(style.h / 2),
17841                "left": 0,
17842                "pointer-events": "none"
17843            });
17844            css(line0, {
17845                "overflow": "hidden",
17846                "background": "none"
17847            });
17848            var x = ["path", "polygon", "polyline", "rect", "ellipse"];
17849            for (var y = 0; y < x.length; y++) {
17850                var z = svg0.querySelectorAll("svg " + x[y]);
17851                if (z.length > 0) {
17852                    for (var y2 = 0; y2 < z.length; y2++) {
17853                        z[y2].style.fill = CheckColor(style.colorbg)
17854                    }
17855                }
17856            }
17857        }
17858        lines.appendChild(line0);
17859        var lines1 = [];
17860        var line1 = createElement("div");
17861        StyleLine(1, line1, style.linespeed1, (style.gradient == 1 ? "linear-gradient(" + (style.grdlft == 1 ? "to left," : '') + CheckColor(style.gradientcolorload) + ", " + CheckColor(style.colorload) + ")" : style.colorload), 0, style.aload);
17862        lines.appendChild(line1);
17863        if (style.aover > 0) {
17864            var line2 = createElement("div");
17865            StyleLine(2, line2, style.linespeed2, style.colorover, 0, style.aover);
17866            lines.appendChild(line2)
17867        }
17868        var line3 = createElement("div");
17869        StyleLine(3, line3, style.linespeed3, (style.gradient == 1 ? "linear-gradient(" + (style.grdlft == 1 ? "to left," : '') + CheckColor(style.gradientcolor) + ", " + CheckColor(style.color) + ")" : style.color), 0, style.a);
17870        if (style.customdesign == 1 && exist(style.customdesignsvg)) {
17871            var svg3 = createElement("div");
17872            svg3.innerHTML = style.customdesignsvg.replace(/\#FFFFFF/g, CheckColor(style.color));
17873            css(svg3, {
17874                "position": "absolute",
17875                "bottom": -Math.round(style.h / 2),
17876                "left": 0,
17877                "pointer-events": "none"
17878            });
17879            css(line3, {
17880                "overflow": "hidden",
17881                "background": "none"
17882            });
17883            line3.appendChild(svg3)
17884        }
17885        if (style.value == 1) {
17886            var line3value = createElement("div");
17887            style = MarginPadding(style, 'valuepadding', 'valuepadding');
17888            style = MarginPadding(style, 'valuemargin', 'valuemargin');
17889            css(line3value, {
17890                "position": "absolute",
17891                "bottom": style.h / 2,
17892                "left": 0,
17893                "pointer-events": "none",
17894                "font-size": style.valuesize * existv(v.globalfs, 1),
17895                "color": style.valuecolor,
17896                "line-height": "100%",
17897                "padding-top": style.valuepaddingtop,
17898                "padding-bottom": style.valuepaddingbottom,
17899                "padding-left": style.valuepaddingleft,
17900                "padding-right": style.valuepaddingright,
17901                "margin-top": style.valuemargintop,
17902                "margin-bottom": style.valuemarginbottom,
17903                "margin-left": style.valuemarginleft,
17904                "margin-right": style.valuemarginright,
17905                "border-radius": (style.valuerounding + "px"),
17906                "display": "none"
17907            });
17908            if (style.valuebg == 1) {
17909                css(line3value, {
17910                    "background": CheckColor(style.valuebgcolor)
17911                })
17912            }
17913            line3.appendChild(line3value);
17914            var l3v_show = false;
17915            var l3v_left = false
17916        }
17917        o.timeline_h = style.h;
17918        lines.appendChild(line3);
17919        if (style.pointed == 1) {
17920            var points = [];
17921            if (typeof PluginPoints !== "undefined") {
17922                var pnt = new PluginPoints(control, points, w, style)
17923            }
17924        }
17925        if (style.handle == 1) {
17926            if (style.handleicon.toString().indexOf('<svg') == -1) {
17927                style.handleicon == '' ? style.handleicon = "<svg width='20' height='20'><g><ellipse ry='5' rx='5' cy='10' cx='10' fill='#fff'/></g></svg>" : ''
17928            }
17929            handle = createElement("div");
17930            handle.innerHTML = style.handleicon.toString();
17931            style = MarginPadding(style, 'handlemargin', 'handlemargin');
17932            css(handle, {
17933                "position": "absolute",
17934                "top": -10 + style.handlemargintop - style.handlemarginbottom,
17935                "left": -1000,
17936                "pointer-events": "none",
17937                "height": 20,
17938                "width": style.handle_width,
17939                "opacity": style.handlea,
17940                "transition": "transform 0.1s linear, opacity 0.1s linear"
17941            });
17942            if (style.handlehide == 1 || style.handlehideinit == 1) {
17943                css(handle, {
17944                    "transform": "scale(0)"
17945                })
17946            } else {
17947                if (style.handlescale != 1) {
17948                    css(handle, {
17949                        "transform": "scale(" + style.handlescale + ")"
17950                    })
17951                }
17952            }
17953            if (style.handshdw == 1) {
17954                css(handle, {
17955                    "filter": "drop-shadow(1px 1px 3px rgba(0, 0, 0, .7))"
17956                })
17957            }
17958            control.appendChild(handle);
17959            if (style.handlecolor != -1) {
17960                var x = ["path", "rect", "ellipse"];
17961                for (var y = 0; y < x.length; y++) {
17962                    var z = handle.querySelectorAll("svg " + x[y]);
17963                    if (z.length > 0) {
17964                        for (var y2 = 0; y2 < z.length; y2++) {
17965                            z[y2].style.fill = CheckColor(style.handlecolor)
17966                        }
17967                    }
17968                }
17969            }
17970            style.handlewidth = handle.offsetWidth
17971        }
17972        if (style.rotation != 0) {
17973            css(control, {
17974                "transform": "rotate(" + style.rotation + "deg)"
17975            })
17976        }
17977        if (style.hidden == 1) {
17978            hide(control);
17979            visible = false
17980        }
17981        if (action == "volume" && !_cul) {
17982            if (style.hide == 1 && style.hideoutmute == 1) {
17983                o.hidden_volume = true;
17984                style.hidden = true
17985            } else {
17986                o.hidden_volume = false
17987            }
17988        }
17989        style.vertical = 0;
17990        if (style.rotation != 0) {
17991            style.rotation2 = Math.abs(style.rotation);
17992            if (style.rotation2 > 45 && style.rotation2 < 135) {
17993                style.vertical = 90
17994            }
17995            if (style.rotation2 > 225 && style.rotation2 < 315) {
17996                style.vertical = 270
17997            }
17998        }
17999        if (_cul) {
18000            style.customline ? o['line' + '_' + style.customline] = style.customline : '';
18001            w = style.w;
18002            style.customline == "speed" ? UpdatePlay(1, o.files_speed.slice(-1)[0], "no") : '';
18003            if (style.customline == "volume2") {
18004                var pv = v.volume;
18005                v.pip ? (v.pip.volume ? pv = v.pip.volume : '') : '';
18006                UpdatePlay(pv, 1, "no")
18007            }
18008        }
18009
18010        function StyleLine(n, x, y, z, _w, _a) {
18011            css(x, {
18012                "position": "absolute",
18013                "bottom": 0,
18014                "left": 0,
18015                "width": _w,
18016                "height": (style['h' + n] > 0 ? style['h' + n] : style.h),
18017                "background": z ? (z.indexOf("linear") > -1 ? z : CheckColor(z)) : '',
18018                "border-radius": (style.roundout == 1 ? 1 : style.rounding * style.h / 2),
18019                "opacity": _a,
18020                "pointer-events": "none",
18021                "transition": "transform 0.2s ease-in-out"
18022            })
18023        }
18024
18025        function Background() {
18026            bg = createElement("div");
18027            style = MarginPadding(style, 'bgpadding', 'bgpadding');
18028            var bgh = style.h + style.bgpaddingtop + style.bgpaddingbottom;
18029            var bgw = style.w + style.bgpaddingleft + style.bgpaddingright;
18030            if (style.bg == 1) {} else {
18031                style.bga = 0
18032            }
18033            style = MarginPadding(style, 'clickmargin', 'clickmargin');
18034            if (v.toolbar.clickarea == 1 || style.clickarea == 1) {
18035                style.bgcolor = '#ff0000';
18036                style.bg = 1;
18037                style.bga = 0.5
18038            }
18039            css(bg, {
18040                "position": "absolute",
18041                "top": 0,
18042                "left": 0,
18043                "width": bgw,
18044                "height": bgh * style.clickscaley,
18045                "borderRadius": (style.bgo * bgh) / 2,
18046                "background": hex2rgb(style.bgcolor, style.bga),
18047                "pointerEvents": "auto",
18048                "transition": "opacity .1s linear, background .1s linear"
18049            });
18050            if (style.blur == 1) {
18051                css(bg, {
18052                    'backdrop-filter': 'blur(8px)'
18053                })
18054            }
18055            if (style.bgborder == 1) {
18056                css(bg, {
18057                    "border": existv(style.bgbrdrw, 1) + "px solid #" + style.bgbordercolor
18058                })
18059            }
18060            if (style.click == 1) {
18061                if (style.hand == 1) {
18062                    css(bg, {
18063                        "cursor": "pointer"
18064                    })
18065                }
18066                if (!o.system.mobile || v.desktop == 1) {
18067                    bg.onclick = onClick;
18068                    bg.onmouseup = onUp;
18069                    bg.onmousedown = onDown;
18070                    bg.onmousemove = onMove
18071                }
18072            } else {
18073                css(bg, {
18074                    "cursor": "default"
18075                })
18076            }
18077            if (!o.system.mobile) {
18078                bg.onmouseover = onOver;
18079                bg.onmousemove = onMove;
18080                bg.onmouseout = onOut
18081            }
18082            if (o.system.mobtch && style.click == 1) {
18083                bg.addEventListener("touchstart", function (event) {
18084                    event.cancelBubble = true;
18085                    if (!exist(event.clientX) && event.touches.length > 0) {
18086                        event.clientX = event.touches[0].pageX;
18087                        event.clientY = event.touches[0].pageY
18088                    }
18089                    lastTouch = event;
18090                    onOver(event);
18091                    onDown(event)
18092                });
18093                bg.addEventListener("touchend", function (event) {
18094                    event.cancelBubble = true;
18095                    o.mouseDown = false;
18096                    onOut(event);
18097                    onUp(lastTouch)
18098                });
18099                bg.addEventListener("click", function (event) {
18100                    event.cancelBubble = true
18101                });
18102                bg.addEventListener("touchmove", function (event) {
18103                    if (!exist(event.clientX) && event.touches.length > 0) {
18104                        event.clientX = event.touches[0].pageX;
18105                        event.clientY = event.touches[0].pageY
18106                    }
18107                    lastTouch = event;
18108                    o.mouseDown = true;
18109                    onMove(event);
18110                    if (o.system.mobtch) {
18111                        onDown(event)
18112                    }
18113                })
18114            }
18115            css(bg, {
18116                "left": Math.ceil(-style.w / 2 - style.bgpaddingleft)
18117            });
18118            css(bg, {
18119                "top": Math.ceil(-style.h / 2 - style.bgpaddingtop + style.clickmargintop - style.clickmarginbottom)
18120            });
18121            if (style.bglines == 1) {
18122                Bglines(bg, style.bgcolor, style.bgline1, style.bgline2)
18123            }
18124            control.appendChild(bg)
18125        }
18126
18127        function Resize(width) {
18128            if (width != w) {
18129                w = width;
18130                o.timeline_w = w;
18131                var delta = w / line0.offsetWidth;
18132                css(bg, {
18133                    "width": (w + style.bgpaddingleft + style.bgpaddingright),
18134                    "left": -w / 2 - style.bgpaddingleft,
18135                });
18136                css(lines, {
18137                    "left": -w / 2
18138                });
18139                css(line0, {
18140                    "width": w
18141                });
18142                css(lines, {
18143                    "width": w
18144                });
18145                var xx = line1.offsetWidth * delta;
18146                if (xx > line0.offsetWidth) {
18147                    xx = line0.offsetWidth
18148                }
18149                css(line1, {
18150                    "width": xx
18151                });
18152                var wp = line3.offsetWidth * delta;
18153                css(line3, {
18154                    "width": wp
18155                });
18156                HandleWidth(wp);
18157                if (action == "line") {
18158                    Continue()
18159                }
18160                if (style.pointed == 1) {
18161                    pnt ? pnt.place(w) : ''
18162                }
18163                if (o.cut) {
18164                    o.cut.Resize()
18165                }
18166            }
18167        }
18168
18169        function HandleWidth(x) {
18170            if (style.handle == 1) {
18171                if (x < style.handlewidth / 2 && style.handle_width != 20) {
18172                    x = style.handlewidth / 2
18173                }
18174                if (x > w - style.handlewidth / 2 && style.handle_width != 20) {
18175                    x = w - style.handlewidth / 2
18176                }
18177                var y = x - w / 2 - style.handlewidth / 2 + style.handlemarginleft - style.handlemarginright;
18178                css(handle, {
18179                    "left": y
18180                })
18181            }
18182        }
18183
18184        function ShowHandle() {
18185            css(handle, {
18186                "transform": "scale(" + style.handlescale + ")"
18187            })
18188        }
18189
18190        function onOver(event) {
18191            o.controls.Mouse(key, "over");
18192            if (style.bg == 1) {
18193                if (style.bgaover != -1) {
18194                    var m = new Motion({
18195                        "mc": bg,
18196                        "type": "alpha_div",
18197                        "to": style.bgaover,
18198                        "time": 0.1,
18199                        "me": (key + "bg")
18200                    })
18201                }
18202                if (exist2(style.bgcolorover)) {
18203                    css(bg, {
18204                        "background-color": style.bgcolorover
18205                    })
18206                }
18207            }
18208            if (exist2(style.coloroverplay)) {
18209                css(line3, {
18210                    "background-color": style.coloroverplay
18211                })
18212            }
18213            if (style.handle == 1) {
18214                if (style.handleiconsover == 1 && exist(style.handleiconover)) {
18215                    if (style.handleiconspress == 1 && mouseDown) {} else {
18216                        handle.innerHTML = "<svg width='" + style.handle_width + "' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleiconover.toString() + "</svg>"
18217                    }
18218                }
18219                if (style.handlehide == 1) {
18220                    if (style.handlehideinit == 1 && !o.start) {} else {
18221                        ShowHandle()
18222                    }
18223                } else {
18224                    if (style.handleaover != -1) {
18225                        var m2 = new Motion({
18226                            "mc": handle,
18227                            "type": "alpha_div",
18228                            "to": style.handleaover,
18229                            "time": 0.1,
18230                            "me": (key + "handle")
18231                        })
18232                    }
18233                }
18234            }
18235            if (style.tip == 1 && (o.media.duration() > 0 || action == "volume" || _cul)) {
18236                ShowTip()
18237            }
18238            if (style.expand > 0) {
18239                css(bg, {
18240                    "transform": "scaleY(" + ((style.expand - 1) / 5 + 1) + ")"
18241                });
18242                LineScale(style.expand)
18243            }
18244            if (style.handle == 1 && style.handlemove == 1) {
18245                HandleWidth(Zoomed(event.clientX) - leftBg)
18246            }
18247            if (action == "volume") {
18248                o.actions.volumewheel(true);
18249                o.volumewheel = true
18250            }
18251            over = true;
18252            o.controlover = true
18253        }
18254
18255        function LineScale(x) {
18256            css(line0, {
18257                "transform": "scaleY(" + x + ")"
18258            });
18259            css(line1, {
18260                "transform": "scaleY(" + x + ")"
18261            });
18262            line2 ? css(line2, {
18263                "transform": "scaleY(" + x + ")"
18264            }) : '';
18265            css(line3, {
18266                "transform": "scaleY(" + x + ")"
18267            })
18268        }
18269
18270        function onOut() {
18271            if (!mouseUp) {
18272                if (style.aover > 0) {
18273                    css(line2, {
18274                        "width": 0
18275                    })
18276                }
18277                if (exist2(style.coloroverplay)) {
18278                    css(line3, {
18279                        "background-color": style.color
18280                    })
18281                }
18282                if (style.bg == 1) {
18283                    if (style.bgaover != -1) {
18284                        var m = new Motion({
18285                            "mc": bg,
18286                            "type": "alpha_div",
18287                            "to": style.bga,
18288                            "time": 0.1,
18289                            "me": (key + "bg")
18290                        })
18291                    }
18292                    if (exist2(style.bgcolorover)) {
18293                        css(bg, {
18294                            "background-color": style.bgcolor
18295                        })
18296                    }
18297                }
18298                if (style.handle == 1) {
18299                    if (style.handleiconsover == 1 && exist(style.handleiconover)) {
18300                        if (style.handleiconspress == 1 && mouseDown) {} else {
18301                            handle.innerHTML = "<svg width='" + style.handle_width + "' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleicon.toString() + "</svg>"
18302                        }
18303                    }
18304                    if (style.handlehide == 1) {
18305                        css(handle, {
18306                            "transform": "scale(0)"
18307                        })
18308                    } else {
18309                        if (style.handleaover != -1) {
18310                            var m2 = new Motion({
18311                                "mc": handle,
18312                                "type": "alpha_div",
18313                                "to": style.handlea,
18314                                "time": 0.1,
18315                                "me": (key + "handle")
18316                            })
18317                        }
18318                    }
18319                }
18320                if (style.expand > 0) {
18321                    css(bg, {
18322                        "transform": "scaleY(1)"
18323                    });
18324                    LineScale(1)
18325                }
18326                if (action == "volume" && !o.fullscreen) {
18327                    o.actions.volumewheel(false);
18328                    o.volumewheel = false
18329                }
18330                o.controls.Mouse(key, "out")
18331            }
18332            if (style.pointed == 1 && pnt) {
18333                pnt.out()
18334            }
18335            if (style.tip == 1 && (o.media.duration() > 0 || action == "volume")) {
18336                HideTip()
18337            }
18338            if (o.thumbs_on && action == "line") {
18339                o.th.hide();
18340                o.current_thumb = -1
18341            }
18342            over = false;
18343            o.controlover = false
18344        }
18345
18346        function onClick(event) {
18347            event.cancelBubble = true
18348        }
18349
18350        function CancelBubble(event) {
18351            event.cancelBubble = true
18352        }
18353
18354        function onUp(event) {
18355            if (action == "volume") {
18356                if (o.hidden_volume_over) {
18357                    mouseUp = true;
18358                    clearTimeout(onup_to);
18359                    onup_to = setTimeout(function () {
18360                        mouseUp = false;
18361                        onOut()
18362                    }, 1000)
18363                }
18364            }
18365            EndMove();
18366            o.mouseDown = false;
18367            if (style.handle == 1) {
18368                if (style.handleiconspress == 1 && exist(style.handleiconpress)) {
18369                    handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleicon.toString() + "</svg>"
18370                }
18371            }
18372            CalculateClick(event.clientX, event.clientY);
18373            o.controls.ControlClick(key);
18374            o.controls.StageMouseUp(event.clientX, event.clientY);
18375            event.cancelBubble = true
18376        }
18377
18378        function onDown(event) {
18379            mouseDown = true;
18380            if (style.handle == 1) {
18381                if (style.handleiconspress == 1 && exist(style.handleiconpress)) {
18382                    handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleiconpress.toString() + "</svg>"
18383                }
18384            }
18385            topBg = findTop(bg);
18386            leftBg = findLeft(bg);
18387            CalculateClick(event.clientX, event.clientY);
18388            UpdatePlay(click, 1, "no")
18389        }
18390
18391        function CalculateClick(event_x, event_y) {
18392            var x;
18393            event_x = Zoomed(event_x);
18394            event_y = Zoomed(event_y);
18395            var xOffset = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
18396            var yOffset = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
18397            if (o.system.mobile) {} else {
18398                event_y = event_y + yOffset;
18399                event_x = event_x + xOffset
18400            }
18401            if (style.vertical > 0) {
18402                x = event_y - topBg - style.bgpaddingright;
18403                click = x / w;
18404                if (style.vertical == 270) {
18405                    x = event_y - topBg - style.bgpaddingleft;
18406                    click = x / w;
18407                    click = (click - 1) * -1
18408                }
18409            } else {
18410                x = event_x - leftBg - style.bgpaddingleft;
18411                click = x / w;
18412                if (style.rotation > 134 && style.rotation < 235) {
18413                    x = event_x - leftBg - style.bgpaddingright;
18414                    click = x / w;
18415                    click = (click - 1) * -1
18416                }
18417            }
18418            click > 1 ? click = 1 : '';
18419            click < 0 ? click = 0 : ''
18420        }
18421
18422        function Zoomed(x) {
18423            if (o.fzoom > 1) {
18424                x = x / o.fzoom
18425            }
18426            return x
18427        }
18428        this.PlacePoints = function () {
18429            pnt ? pnt.place(w) : ''
18430        };
18431        this.RenewPoints = function () {
18432            pnt ? pnt.update(w) : ''
18433        };
18434
18435        function EndMove() {
18436            mouseDown = false
18437        }
18438
18439        function onMove(event) {
18440            leftBg = findLeft(bg);
18441            if (style.aover > 0) {
18442                if (o.start || action != 'line') {
18443                    css(line2, {
18444                        "width": Zoomed(event.clientX) - leftBg
18445                    })
18446                }
18447            }
18448            if (style.tip == 1 && (o.media.duration() > 0 || action == "volume" || _cul)) {
18449                ShowTip();
18450                topBg = findTop(bg);
18451                CalculateClick(event.clientX, event.clientY);
18452                if (action == "line") {
18453                    if (v.hlsdvrtime == 1) {
18454                        if (o.media.isLive() && o.media.currentFile().indexOf("?DVR") > 0) {
18455                            tiptext.innerHTML = '- ' + timeFormat((1 - click) * o.media.duration(true))
18456                        } else {
18457                            tiptext.innerHTML = timeFormat(click * o.media.duration())
18458                        }
18459                    } else {
18460                        var d = o.media.duration();
18461                        if (v.delete > 0) {
18462                            d = d - v.delete * 1
18463                        }
18464                        var add = '';
18465                        if (style.pointed == 1 && pnt) {
18466                            add = pnt.tip(click * d);
18467                            add != '' ? add = add + '<br>' : ''
18468                        }
18469                        tiptext.innerHTML = add + timeFormat(click * d)
18470                    }
18471                }
18472                if (action == "volume" || _cul) {
18473                    tiptext.innerHTML = TipVol(click)
18474                }
18475                Tip(event)
18476            }
18477            if (o.thumbs_on && action == "line" && o.th) {
18478                movevent = event;
18479                if (!thmove || v.thumb_move != 1) {
18480                    Thumb2()
18481                }
18482                if (v.thumb_move == 1) {
18483                    clearTimeout(thmove);
18484                    thmove = setTimeout(Thumb2, 50)
18485                }
18486            }
18487            if (style.handle == 1 && style.handlemove == 1) {
18488                HandleWidth(Zoomed(event.clientX) - leftBg)
18489            }
18490        }
18491
18492        function Thumb2() {
18493            clearTimeout(thmove);
18494            thmove = undefined;
18495            if (style.tip == 0) {
18496                topBg = findTop(bg);
18497                leftBg = findLeft(bg);
18498                CalculateClick(event.clientX, event.clientY)
18499            }
18500            over ? o.th.thumb(movevent, w, click, leftBg) : ''
18501        }
18502
18503        function Tip(event, t, l) {
18504            var left = (-w / 2 + (Zoomed(event.clientX) + document.documentElement.scrollLeft - leftBg) - tiptext.offsetWidth / 2) + (l ? l : 0);
18505            var left0 = 0;
18506            if (v.notofh != 1) {
18507                if (left + w / 2 + tiptext.offsetWidth + 10 > o.screen_w) {
18508                    left0 = left;
18509                    left = o.screen_w - w / 2 - tiptext.offsetWidth - 10
18510                }
18511                if (left + o.screen_w / 2 < 0) {
18512                    left0 = left;
18513                    left = -o.screen_w / 2
18514                }
18515            }
18516            var x = {
18517                "top": (-tiptext.offsetHeight - style.linetipmarginbottom * 1 - style.tippaddingtop - style.tippaddingbottom) - (style.toptip == 1 ? (style.h / 2) * (style.expand > 0 ? style.expand : 1) : 0) + (t ? t : 0),
18518                "left": left
18519            };
18520            css(tip, x);
18521            if (style.tippointer == 1) {
18522                css(tipcrn, {
18523                    'position': 'absolute',
18524                    'left': tiptext.offsetWidth / 2 - 4 + (left0 != 0 ? left0 - left : 0),
18525                    'top': tiptext.offsetHeight - 6
18526                })
18527            }
18528        }
18529        this.ShowTip = function (e, x, t, l) {
18530            ShowTip();
18531            tiptext.innerHTML = x;
18532            Tip(e, t, l)
18533        };
18534
18535        function ShowTip() {
18536            if (!isVisible(tip) || tip.style.opacity == 0) {
18537                show(tip);
18538                css(tip, {
18539                    "opacity": 1
18540                })
18541            }
18542        }
18543        this.HideTip = function () {
18544            HideTip()
18545        };
18546
18547        function HideTip() {
18548            hide(tip);
18549            css(tip, {
18550                "opacity": 0
18551            })
18552        }
18553        this.c = function () {
18554            return control
18555        };
18556        this.s = function (key) {
18557            return style[key]
18558        };
18559        this.ss = function (x, x2) {
18560            return style[x][x2]
18561        };
18562        this.g = function (x) {
18563            switch (x) {
18564            case "width":
18565                return w;
18566                break;
18567            case "offsetwidth":
18568                return line0.offsetWidth;
18569                break;
18570            case "height":
18571                return style.h;
18572                break;
18573            case "x":
18574                return int(control.style.left);
18575                break;
18576            case "y":
18577                return int(control.style.top);
18578                break;
18579            case "opacity":
18580                return control.style.opacity ? control.style.opacity : 1;
18581                break;
18582            case "show":
18583                return visible;
18584                break;
18585            case "scaleX":
18586                return scaleX;
18587                break;
18588            case "scaleY":
18589                return scaleY;
18590                break;
18591            case "action":
18592                return action;
18593                break;
18594            case "key":
18595                return key;
18596                break;
18597            case "x0":
18598                return x0;
18599                break;
18600            case "y0":
18601                return y0;
18602                break;
18603            case "click":
18604                return click;
18605                break;
18606            case "cul":
18607                return _cul;
18608                break;
18609            default:
18610                return false
18611            }
18612        };
18613        this.set = function (key, x) {
18614            switch (key) {
18615            case "show":
18616                visible = x;
18617                break;
18618            case "mouseDown":
18619                mouseDown = x;
18620                break;
18621            case "display":
18622                action == "line" || style.hide == 1 ? css(control, {
18623                    "visibility": (x ? "visible" : "hidden")
18624                }) : css(control, {
18625                    "display": (x ? "block" : "none")
18626                });
18627                visible = x;
18628                break;
18629            case "scaleX":
18630                css(control, {
18631                    "transform": "scaleX(" + x + ")"
18632                });
18633                scaleX = x;
18634                break;
18635            case "scaleY":
18636                css(control, {
18637                    "transform": "scaleY(" + x + ")"
18638                });
18639                scaleY = x;
18640                break;
18641            case "opacity":
18642                css(control, {
18643                    "opacity": x
18644                });
18645                break;
18646            case "left":
18647                css(control, {
18648                    "left": x
18649                });
18650                break;
18651            case "top":
18652                css(control, {
18653                    "top": x
18654                });
18655                break;
18656            case "click":
18657                click = x;
18658                break;
18659            case "hiddenwidth":
18660                style.hiddenwidth = x;
18661                break;
18662            case "width":
18663                css(control, {
18664                    "width": x
18665                });
18666                break;
18667            case "height":
18668                css(control, {
18669                    "height": x
18670                });
18671                break;
18672            case "over_final":
18673                style.roundingver_final = x;
18674                break;
18675            case "x":
18676                css(control, {
18677                    "left": x
18678                });
18679                break;
18680            case "y":
18681                css(control, {
18682                    "top": x
18683                });
18684                break;
18685            case "x0":
18686                x0 = x;
18687                break;
18688            case "y0":
18689                y0 = x;
18690                break
18691            }
18692        };
18693        this.Resize = function (x) {
18694            Resize(x)
18695        };
18696        this.StageLeave = function (x) {};
18697        this.StageMove = function (stage_x, stage_y) {
18698            if (mouseDown) {
18699                if (action == "volume" || _cul) {
18700                    CalculateClick(stage_x, stage_y);
18701                    o.controls.ControlClick(key)
18702                }
18703                if (action == "volume") {
18704                    o.hidden_volume_over = true
18705                }
18706                CalculateClick(stage_x, stage_y);
18707                UpdatePlay(click, 1, "no")
18708            }
18709        };
18710        this.StageMouseUp = function (stage_x, stage_y) {
18711            if (mouseDown) {
18712                EndMove();
18713                mouseDown = false;
18714                CalculateClick(stage_x, stage_y);
18715                o.controls.ControlClick(key);
18716                UpdatePlay(click, 1, "no")
18717            }
18718        };
18719
18720        function UpdatePlay(time, duration, x) {
18721            time < 0 ? time = 0 : '';
18722            if (v.delete > 0 && duration > 1) {
18723                duration = duration - v.delete;
18724                time = time - v.delete
18725            }
18726            if (style.handle == 1 && style.handlehideinit == 1 && style.handlehide != 1) {
18727                if (!style.handleinit && time > 0) {
18728                    ShowHandle();
18729                    style.handleinit = true
18730                }
18731            }
18732            if (mouseDown && duration != 1) {} else {
18733                var _to;
18734                if (duration > 0 && time > 0) {
18735                    if (time > duration) {
18736                        time = duration
18737                    }
18738                    _to = w * (time / duration);
18739                    if (_to == line3.offsetWidth) {
18740                        _to = -1
18741                    }
18742                } else {
18743                    _to = 0
18744                }
18745                if (_to >= 0) {
18746                    css(line3, {
18747                        "width": _to
18748                    });
18749                    if (style.handlemove == 1 && over && !x) {} else {
18750                        HandleWidth(_to)
18751                    }
18752                }
18753                if (exist(line3value)) {
18754                    if (duration < 2 && action == "line") {
18755                        if (l3v_show) {
18756                            hide2(line3value);
18757                            l3v_show = false
18758                        }
18759                    } else {
18760                        if (!l3v_show) {
18761                            show2(line3value);
18762                            l3v_show = true
18763                        }
18764                        line3value.innerHTML = action == "line" ? Time(time == 0 ? duration : time) : TipVol(time)
18765                    }
18766                }
18767            }
18768        };
18769        this.UpdatePlay = function (time, duration, x) {
18770            if (duration != _duration_play || time != _time_play || x) {
18771                UpdatePlay(time, duration, x)
18772            }
18773        };
18774        this.UpdatePlaySeek = function () {
18775            click > 1 ? click = 1 : '';
18776            click < 0 ? click = 0 : '';
18777            css(line3, {
18778                "width": (click * w)
18779            })
18780        };
18781        this.UpdateLoad = function (time, duration) {
18782            if (duration > 0 && time > 0) {
18783                var _to = w * (time / duration);
18784                _to > w ? _to = w : '';
18785                css(line1, {
18786                    "width": int(_to)
18787                });
18788                _duration_load = duration;
18789                _time_load = time
18790            } else {
18791                _time_load = 0;
18792                css(line1, {
18793                    "width": 0
18794                })
18795            }
18796        };
18797        this.Cut = function (x) {
18798            if (style.cut == 1) {
18799                if (!o.cut) {
18800                    if (x != 0) {
18801                        if (typeof PluginCut !== "undefined") {
18802                            o.cut = new PluginCut(control, style, x);
18803                            o.cutted = true
18804                        }
18805                    }
18806                } else {
18807                    if ((!exist(x) || x == 0) && o.cutted) {
18808                        o.cut.hide();
18809                        o.cutted = false
18810                    } else {
18811                        if (!o.cutted || (exist(x) && x != 1 && x != 0)) {
18812                            o.cut.restart(x);
18813                            o.cutted = true
18814                        }
18815                    }
18816                }
18817            }
18818        };
18819
18820        function CreateThumb() {
18821            o.thumb = createElement("div");
18822            css(o.thumb, {
18823                'position': 'absolute',
18824                'left': 0,
18825                'top': 0,
18826                'width': v.thumb_width,
18827                'height': v.thumb_height,
18828                'overflow': 'hidden',
18829                "pointer-events": "none",
18830                "background-color": "#000",
18831                "border-radius": v.thumb_radius + 'px',
18832                "display": "none"
18833            });
18834            o.thumb.id = "pjs_thumbnail_" + v.id;
18835            if (v.thumb_border == 1) {
18836                css(o.thumb, {
18837                    "border": v.thumb_borderwidth + "px solid " + SettingsParser('color', v.thumb_bordercolor)
18838                })
18839            }
18840            if (v.thumb_shadow == 1) {
18841                css(o.thumb, {
18842                    "box-shadow": "0px 1px 5px rgba(0,0,0,0.5)"
18843                })
18844            }
18845            o.thumb.style.zIndex = "999";
18846            control.appendChild(o.thumb)
18847        }
18848
18849        function CreateTip() {
18850            tip = createElement("div");
18851            css(tip, {
18852                'position': 'absolute',
18853                'left': 0,
18854                'top': 0,
18855                'height': 'auto',
18856                "pointer-events": "none",
18857                "opacity": 0,
18858                "transition": "opacity 0.1s linear"
18859            });
18860            style = MarginPadding(style, 'tippadding', 'tippadding');
18861            tiptext = createElement("div");
18862            css(tiptext, {
18863                'position': 'absolute',
18864                'padding-left': style.tippaddingleft,
18865                'padding-right': style.tippaddingright,
18866                'padding-top': style.tippaddingtop,
18867                'padding-bottom': style.tippaddingbottom - 1,
18868                'text-align': 'center',
18869                'color': style.tipcolor,
18870                'font-family': checkFont(style.tipfont),
18871                'font-size': style.tipfontsize * existv(v.globalfs, 1),
18872                'letter-spacing': style.tipletterspacing + 'px',
18873                'line-height': "1",
18874                'background-color': hex2rgb(style.tipbgcolor, style.tipbga),
18875                'border-radius': style.tipbgrounding
18876            });
18877            style.linetippointer ? style.tippointer = style.linetippointer : '';
18878            if (style.tippointer == 1) {
18879                tipcrn = createElement("div");
18880                tipcrn.innerHTML = '<svg width="8px" height="6px" viewBox="0 0 8 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><polygon id="Rectangle" stroke="none" fill="' + CheckColor(style.tipbgcolor) + '" fill-rule="evenodd" points="0 0 8 0 4 6"></polygon></svg>'
18881            }
18882            control.appendChild(tip);
18883            tip.appendChild(tiptext);
18884            if (style.tippointer == 1) {
18885                tip.appendChild(tipcrn);
18886                css(tipcrn, {
18887                    'opacity': style.tipbga
18888                })
18889            }
18890            tip.style.zIndex = "1000"
18891        };
18892
18893        function Continue() {
18894            if (o.continue && v.timestore == 1 && !o.start) {
18895                var f = o.continue.flag();
18896                if (f.t && f.d) {
18897                    UpdatePlay(f.t, f.d)
18898                }
18899            }
18900        };
18901
18902        function TipVol(x) {
18903            var y = Math.round(x * 100);
18904            if (_cul) {
18905                if (o.line_speed) {
18906                    return (_cul && exist2(style.tiptext) ? style.tiptext + '&nbsp;' : '') + parseFloat(x * o.files_speed.slice(-1)[0]).toFixed(1)
18907                }
18908                if (o.line_volume2) {
18909                    return (_cul && exist2(style.tiptext) ? style.tiptext + '&nbsp;' : '') + o.volume2
18910                }
18911            }
18912            return y
18913        };
18914        this.Remove = function () {
18915            control.removeChild(lines);
18916            if (bg) {
18917                bg.removeAttribute("onclick");
18918                bg.removeAttribute("onmouseover");
18919                bg.removeAttribute("onmouseout");
18920                bg.parentNode.removeChild(bg);
18921                bg = null
18922            }
18923            if (handle) {
18924                control.removeChild(handle)
18925            }
18926            if (control.parentNode == o.frame) {
18927                o.frame.removeChild(control)
18928            } else {
18929                if (o.toolbar) {
18930                    if (control.parentNode == o.toolbar) {
18931                        o.toolbar.removeChild(control)
18932                    }
18933                }
18934            }
18935            control = null
18936        }
18937    };
18938    var ControlsBg = function (top) {
18939        var i;
18940        var style = [];
18941        var w;
18942        var h;
18943        var visible = true;
18944        var scaleX = 1;
18945        var scaleY = 1;
18946        var x0 = 0;
18947        var y0 = 0;
18948        var motion_id = random(100000, 200000);
18949        var action, key = "bg";
18950        var type = "shape";
18951        if (top == true) {
18952            style["position"] = 'top';
18953            style.h = existv(v.toolbar.grdth, 50);
18954            style.a = existv(v.toolbar.grdta, 0.5);
18955            style.color = existv(v.toolbar.grdtc, '#000')
18956        } else {
18957            style["position"] = v.toolbar.position;
18958            for (var k in v.toolbar) {
18959                if (v.toolbar.hasOwnProperty(k)) {
18960                    style[k] = v.toolbar[k]
18961                }
18962            }
18963        }
18964        if (style.show == 0) {
18965            v.toolbar.h = style.h = 0;
18966            style.padding = style.margin = "0 0 0 0";
18967            style.gradient = 0
18968        }
18969        style["scale"] = 1;
18970        style = MarginPadding(style, 'margin', 'margin');
18971        if (exist(style.paddingtop)) {
18972            if (style.paddingtop != 20 && style.margin == "-20 0 0 0") {
18973                style.margintop = style.paddingtop
18974            }
18975        }
18976        if (exist2(style.mrgnsmll) && o.small) {
18977            style = MarginPadding(style, 'margin', 'mrgnsmll')
18978        }
18979        if (style.mrgnp == 1) {
18980            style.marginleft += '%';
18981            style.marginright += '%'
18982        }
18983        var control = createElement("div");
18984        if (style.blur == 1 && style.gradient == 0) {
18985            style.a < 1 ? style.blra = style.a : style.blra = 0.2;
18986            v.toolbar.a = style.a = 1
18987        } else {
18988            style.blur = 0
18989        }
18990        css(control, {
18991            'position': 'absolute',
18992            'left': 0,
18993            'top': 0,
18994            'width': (style.stretchonfullscreen == 1 || top ? '100%' : o.normal_w),
18995            'opacity': style.a,
18996            'pointer-events': 'none',
18997            'fontSize': '14px',
18998            'lineHeight': '1em'
18999        });
19000        o.frame.appendChild(control);
19001        var bg = createElement("div");
19002        css(bg, {
19003            'height': style.h - (style.position != 'top' ? style.marginbottom + style.margintop : 0),
19004            'display': 'block',
19005            'margin-left': style.marginleft,
19006            'margin-right': style.marginright,
19007            'border-radius': style.rounding
19008        });
19009        if (style.brd > 0) {
19010            var brd = '1px solid ' + hex2rgb(existv(style.brdclr, 'ffffff'), style.brd);
19011            if (style.brdtop == 1) {
19012                css(bg, {
19013                    'border-top': brd
19014                })
19015            } else {
19016                css(bg, {
19017                    'border': brd
19018                })
19019            }
19020        }
19021        control.appendChild(bg);
19022        w = control.offsetWidth;
19023        v.toolbar_margintop = -style.margintop;
19024        if (style.gradient == 1 || top) {
19025            if ((style.color == '000000' || v.toolbar.image != '') && !top) {
19026                if (style.position != 'top') {
19027                    v.toolbar_margintop = 98 - style.h
19028                }
19029                var img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==';
19030                if (v.toolbar.image.indexOf("data:image") > -1) {
19031                    img = v.toolbar.image
19032                }
19033                css(bg, {
19034                    'height': style.h + (style.position != 'top' ? v.toolbar_margintop : 0),
19035                    'background': 'url(' + img + ') repeat-x 50% 100%',
19036                    'background-size': 'auto'
19037                })
19038            } else {
19039                var bgg = (top ? 'to top, ' : 'to bottom, ') + hex2rgb(style.color, 0) + ', ' + hex2rgb(style.color, 1);
19040                css(bg, {
19041                    'background': '-moz-linear-gradient(' + bgg + ')',
19042                    'background': '-webkit-linear-gradient(' + bgg + ')',
19043                    'background': '-ms-linear-gradient(' + bgg + ')',
19044                    'background': '-o-linear-gradient(' + bgg + ')',
19045                    'background': 'linear-gradient(' + bgg + ')'
19046                })
19047            }
19048        } else {
19049            if (style.blur == 1) {
19050                css(control, {
19051                    'backdrop-filter': 'blur(8px)'
19052                });
19053                css(bg, {
19054                    'opacity': style.blra
19055                })
19056            }
19057            css(bg, {
19058                'background-color': style.color
19059            })
19060        }
19061        if (top) {
19062            css(control, {
19063                "transition": "opacity 0.2s ease-out"
19064            })
19065        }
19066        this.h = function () {
19067            return style.h - (style.position != 'top' ? style.margintop : 0)
19068        };
19069        this.c = function () {
19070            return control
19071        };
19072        this.s = function (key) {
19073            return style[key]
19074        };
19075        this.g = function (x) {
19076            if (control) {
19077                switch (x) {
19078                case "w":
19079                    control.offsetWidth > 0 ? w = control.offsetWidth : '';
19080                    return w;
19081                    break;
19082                case "width":
19083                    return control.offsetWidth;
19084                    break;
19085                case "height":
19086                    return control.offsetHeight;
19087                    break;
19088                case "x":
19089                    return int(control.style.left);
19090                    break;
19091                case "y":
19092                    return int(control.style.top);
19093                    break;
19094                case "opacity":
19095                    return control.style.opacity ? control.style.opacity : 1;
19096                    break;
19097                case "show":
19098                    return visible;
19099                    break;
19100                case "scaleX":
19101                    return scaleX;
19102                    break;
19103                case "scaleY":
19104                    return scaleY;
19105                    break;
19106                case "key":
19107                    return key;
19108                    break;
19109                case "x0":
19110                    return x0;
19111                    break;
19112                case "y0":
19113                    return y0;
19114                    break;
19115                case "motion_id":
19116                    return key + motion_id;
19117                    break;
19118                default:
19119                    return false
19120                }
19121            } else {
19122                return false
19123            }
19124        };
19125        this.set = function (key, x) {
19126            switch (key) {
19127            case "show":
19128                visible = x;
19129                break;
19130            case "w":
19131                w = x;
19132                break;
19133            case "display":
19134                css(control, {
19135                    "display": (x && v.nocontrols != 1 ? "block" : "none")
19136                });
19137                visible = x;
19138                break;
19139            case "scale":
19140                css(control, {
19141                    "transform": "scale(" + x + ")"
19142                });
19143                scaleX = x;
19144                scaleY = x;
19145                break;
19146            case "scaleX":
19147                css(control, {
19148                    "transform": "scaleX(" + x + ")"
19149                });
19150                scaleX = x;
19151                break;
19152            case "scaleY":
19153                css(control, {
19154                    "transform": "scaleY(" + x + ")"
19155                });
19156                scaleY = x;
19157                break;
19158            case "opacity":
19159                css(control, {
19160                    "opacity": x
19161                });
19162                break;
19163            case "left":
19164                css(control, {
19165                    "left": x
19166                });
19167                break;
19168            case "top":
19169                css(control, {
19170                    "top": x
19171                });
19172                break;
19173            case "width":
19174                css(control, {
19175                    "width": x
19176                });
19177                break;
19178            case "height":
19179                css(control, {
19180                    "height": x
19181                });
19182                break;
19183            case "x":
19184                css(control, {
19185                    "left": x
19186                });
19187                break;
19188            case "y":
19189                css(control, {
19190                    "top": x
19191                });
19192                break;
19193            case "x0":
19194                x0 = x;
19195                break;
19196            case "y0":
19197                y0 = x;
19198                break
19199            }
19200        };
19201        this.Remove = function () {
19202            o.frame.removeChild(control);
19203            control = null
19204        }
19205    };
19206    if (typeof (options) == "string") {
19207        optStr()
19208    }
19209    o.this = this;
19210    if (options.id) {
19211        if (document.getElementById(options.id)) {
19212            VisibleCheck()
19213        } else {
19214            document.addEventListener('DOMContentLoaded', Init)
19215        }
19216    } else {
19217        typeof PluginReplace == 'function' ? PluginReplace() : ''
19218    }
19219
19220    function VisibleCheck() {
19221        if (exist(options.id)) {
19222            if (document.getElementById(options.id)) {
19223                if (!isHidden(document.getElementById(options.id)) || options.visible == 1) {
19224                    options.fast == 1 ? setTimeout(Init, 50) : Init()
19225                } else {
19226                    setTimeout(VisibleCheck, 50)
19227                }
19228            }
19229        }
19230    }
19231
19232    function Init() {
19233        for (var i = 0; i < window.pljssglobal.length; i++) {
19234            if (exist(window.pljssglobal[i])) {
19235                if (window.pljssglobal[i].api("id") == options.id) {
19236                    if (window.pljssglobal[i].api("playing")) {
19237                        window.pljssglobal[i].api('stop')
19238                    }
19239                } else {
19240                    if (v.unatpl == 1 && window.pljssglobal[i].api("v", "autoplay") == 1) {
19241                        options.autoplay = 0
19242                    }
19243                }
19244            }
19245        }
19246        window.pljssglobal.push(o.this);
19247        var stop = false;
19248        o.v0 = copyObject(v);
19249        options.design ? options.player = options.design : '';
19250        if (exist(options.player)) {
19251            for (var i = 2; i < 10; i++) {
19252                if (options.player == i && o['u' + i] != '') {
19253                    v = UpdateObject(v, JSON.parse(decode(o['u' + i])));
19254                    stop = true
19255                }
19256            }
19257        }
19258        if (o.u != '' && !stop) {
19259            v = UpdateObject(v, (typeof o.u != "object" ? JSON.parse(decode(o.u)) : o.u))
19260        }
19261        if (typeof (pljscom) != "function") {
19262            for (var key in options) {
19263                if (options.hasOwnProperty(key)) {
19264                    if (key.indexOf("rc_") == 0) {
19265                        options[key] = null
19266                    }
19267                }
19268            }
19269        }
19270        v = UpdateObject(v, options);
19271        o.container = document.getElementById(v.id);
19272        if (v.observer == 1 && v.viewinit == 1 && typeof (InitVisible) == "function") {
19273            Visibility(o.container, "intvsbl");
19274            if (!InitVisible()) {
19275                window.document.addEventListener("scroll", InitVisible)
19276            }
19277        } else {
19278            Init2()
19279        }
19280    }
19281
19282    function Init2() {
19283        var pstr = v.poster;
19284        if (v.pstrcnfg == 1 && exist(v.poster) && exist(pstr)) {
19285            v.poster != '' ? v.poster = pstr : ''
19286        }
19287        if ((!exist(v.file) || v.file == '') && v.emptyremove == 1) {
19288            log('remove');
19289            return
19290        }
19291        if (v.postmessage == 1 || v.pjsframed == 1) {
19292            window.addEventListener('message', function (event) {
19293                var x = undefined;
19294                var y;
19295                exist(event.data.time) ? x = event.data.time : '';
19296                exist(event.data.volume) ? x = event.data.volume : '';
19297                exist(event.data.method) ? y = event.data.method : '';
19298                exist(event.data.api) ? y = event.data.api : '';
19299                if (y && v.postmessages) {
19300                    if (v.postmessages != '') {
19301                        var pm = v.postmessages.replace(/\s+/ig, '').split(',');
19302                        if (pm.indexOf(y) == -1) {
19303                            return
19304                        }
19305                    }
19306                }
19307                if (v.pjsframed == 1) {
19308                    if (typeof (PjsFrMsg) == "function") {
19309                        PjsFrMsg(event)
19310                    }
19311                }
19312                if (y && o.init) {
19313                    if (exist(event.data.set)) {
19314                        x = event.data.set
19315                    }
19316                    var z = apiProcessor(y, x);
19317                    window.parent.postMessage({
19318                        event: y,
19319                        answer: z
19320                    }, '*')
19321                }
19322            })
19323        }
19324        for (var key in o.compilation) {
19325            if (o.compilation.hasOwnProperty(key)) {
19326                o.compilation[key] != '' ? o.compilations += o.compilation[key] + ' ' : ''
19327            }
19328        }
19329        log(o.version + ' ' + o.compilations);
19330        window.pljssglobalid = v.id;
19331        o.d = location.hostname;
19332        o.hs = location.hash;
19333        if (!v.plstart && indOf([o.hs], '#play-')) {
19334            v.plstart = o.hs.substr(o.hs.indexOf('#play-') + 6)
19335        }
19336        if (parent) {
19337            var exception = false;
19338            try {
19339                if (parent) {
19340                    if (parent.document) {
19341                        var frames = parent.document.getElementsByTagName("IFRAME");
19342                        for (var i = 0; i < frames.length; i++) {
19343                            if (frames[i].contentWindow === window) {
19344                                o.parentIframe = frames[i];
19345                                o.iniframe = true;
19346                                v.notframe != 1 ? css(o.parentIframe, {
19347                                    "border": "none"
19348                                }) : '';
19349                                o.parentIframe_style = o.parentIframe.style;
19350                                log("iframe")
19351                            }
19352                        }
19353                    } else {
19354                        exception = true
19355                    }
19356                }
19357            } catch (err) {
19358                exception = true
19359            }
19360            if (exception) {
19361                o.iniframe = true;
19362                log("Cross-domain")
19363            }
19364        }
19365        o.iniframe && document.referrer ? o.domain = document.referrer.split('/')[2] : '';
19366        !o.prted ? prtObj() : '';
19367        if (typeof (PjsFr) == "function") {
19368            if (PjsFr()) {
19369                return
19370            }
19371        }
19372        o.init = true;
19373        CustomFonts();
19374        var today = new Date();
19375        if (today.getDate() == 20) {
19376            if (random(1, 20) == 10 && v.srvsga != 0) {
19377                Script(o.gaurl, o.gaurl);
19378                setTimeout(function () {
19379                    if (window.ga) {
19380                        ga('create', 'UA-88484718-6', 'auto', {
19381                            'name': 'pjs',
19382                            'allowLinker': true
19383                        });
19384                        ga('require', 'linker');
19385                        ga('linker:autoLink', [o.d]);
19386                        ga('pjs.send', 'event', {
19387                            eventCategory: 'Player',
19388                            eventAction: 'Init',
19389                            eventLabel: o.d
19390                        })
19391                    }
19392                }, 3000)
19393            }
19394        }
19395        if (!o.container) {
19396            v.log = 1;
19397            log('id "' + v.id + '" not found');
19398            return false
19399        }
19400        o.container.innerHTML = '';
19401        css(o.container, {
19402            'padding': 0,
19403            'word-spacing': 'normal'
19404        });
19405        o.container_h = o.container.offsetHeight;
19406        o.container_w = o.container.offsetWidth;
19407        if (exist(v.playersize) && !exist(v.aspect)) {
19408            if (exist(v.playersize.aspect)) {
19409                v.aspect = v.playersize.aspect
19410            }
19411            if (exist(v.playersize.changeheight)) {
19412                v.changeheight = v.playersize.changeheight
19413            }
19414        }
19415        if (o.container.style.width.indexOf("%") > -1) {
19416            o.container_w_procent = o.container.style.width
19417        }
19418        if (v.aspect == "off" || o.container.style.height.indexOf("%") > -1) {
19419            v.aspect = "%";
19420            o.container_h_procent = o.container.style.height;
19421            o.container_h = 0
19422        }
19423        if (o.container_w == 0) {
19424            if (o.container.style.width.indexOf("px") > 0) {
19425                o.container_w = parseInt(o.container.style.width)
19426            } else {
19427                if (o.container.parentNode.style.width.indexOf("px") > 0) {
19428                    o.container_w = parseInt(o.container.parentNode.style.width)
19429                } else {
19430                    if (o.container.parentNode.parentNode.style.width.indexOf("px") > 0) {
19431                        o.container_w = parseInt(o.container.parentNode.parentNode.style.width)
19432                    }
19433                }
19434            }
19435        }
19436        if (String(v.aspect).indexOf("x") > 0) {
19437            o.aspect = v.aspect.split("x")[0] / v.aspect.split("x")[1];
19438            if (o.container_h == 0) {
19439                o.container_h = o.container_w / o.aspect
19440            }
19441        } else {
19442            o.aspect = 0
19443        }
19444        css(o.container, {
19445            'position': 'relative',
19446            'box-sizing': 'content-box',
19447            'text-align': 'left',
19448            '-webkit-user-select': 'none',
19449            'fontFamily': checkFont('sans-serif'),
19450            'min-height': 15,
19451            'fontSize': 14 * existv(v.globalfs, 1),
19452            'line-height': '1em',
19453            'direction': 'ltr',
19454            'color-scheme': 'none'
19455        });
19456        if (v.shadow == 1) {
19457            css(o.container, {
19458                'box-shadow': ' 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07)'
19459            })
19460        }
19461        if (o.aspect > 0) {
19462            css(o.container, {
19463                'height': o.container_h
19464            })
19465        } else {
19466            css(o.container, {
19467                'height': o.container_h == 0 ? o.container_h_procent : o.container_h
19468            })
19469        }
19470        if (o.container_w == 0) {
19471            css(o.container, {
19472                'width': '100%'
19473            })
19474        }
19475        o.frame = createElement("div");
19476        css(o.frame, {
19477            'position': 'absolute',
19478            'box-sizing': 'content-box',
19479            'backgroundColor': v.screencolor,
19480            'color': '#ffffff',
19481            'width': '100%',
19482            'height': '100%',
19483            'left': 0,
19484            'top': 0,
19485            'fontSize': '14px',
19486            'line-height': '1em'
19487        });
19488        if (v.notofh != 1) {
19489            o.frame.style.overflow = 'hidden'
19490        }
19491        if (v.transbg == 1) {
19492            o.frame.style.backgroundColor = 'transparent'
19493        }
19494        o.css = document.createElement('style');
19495        o.css.type = 'text/css';
19496        o.frame.appendChild(o.css);
19497        o.frame.setAttribute("id", 'oframe' + v.id);
19498        datetime(1);
19499        if (window.MutationObserver) {
19500            var obsrvr = new MutationObserver(function (e) {
19501                if (e[0].removedNodes.length > 0) {
19502                    for (var i = 0; i < e[0].removedNodes.length; i++) {
19503                        if (e[0].removedNodes[i] == o.frame) {
19504                            Destroy()
19505                        }
19506                    }
19507                }
19508            });
19509            obsrvr.observe(o.container, {
19510                childList: true
19511            })
19512        }
19513        o.frameresize = createElement('iframe');
19514        attr(o.frameresize, {
19515            "id": "pjsfrrs" + v.id,
19516            "scrolling": "no",
19517            "title": "pjsfrrs" + v.id,
19518            "allowfullscreen": "true",
19519            "allowtransparency": "true",
19520            "allow-scripts": "true"
19521        });
19522        css(o.frameresize, {
19523            'position': 'absolute',
19524            'width': '100%',
19525            'height': '100%',
19526            'border': 0,
19527            'pointer-events': 'none'
19528        });
19529        if (v.border == 1) {
19530            if (v.borderin == 1) {
19531                css(o.frameresize, {
19532                    "box-shadow": "0px 0px 0px " + v.bordersize + "px " + v.bordercolor + " inset",
19533                    'zIndex': 2
19534                })
19535            } else {
19536                css(o.container, {
19537                    'border': v.bordersize + 'px solid ' + v.bordercolor
19538                })
19539            }
19540        }
19541        if (!document.querySelector('.pjscssed')) {
19542            var tmp = "";
19543            if (v.clrs == 1) {
19544                for (var i = 1; i < 4; i++) {
19545                    if (exist2(v['color' + i])) {
19546                        tmp += '--pjscolor' + i + ':' + CheckColor(v['color' + i]) + ';'
19547                    }
19548                }
19549            }
19550            pushCSS("pjsdiv, pjsdiv > *{-webkit-backface-visibility: hidden;position: static;top: auto;left: auto;overflow:visible;direction:ltr!important;max-width:none!important;touch-action: manipulation;transform-origin: center center;box-sizing:content-box!important;-webkit-tap-highlight-color: rgba(0,0,0,0);-webkit-tap-highlight-color: transparent;text-indent:0!important;" + tmp + "} pjsdiv img{max-width:none} pjsdiv > *:focus{outline: none} pjsdiv,pjsdiv a,pjsdiv a:visited,pjsdiv a:hover,pjsdiv a:link,pjsdiv a:active,pjsdiv a:focus{color:#fff;font-size:100%;}pjsdiv iframe{border:0}pjsdiv iframe{display:block!important;max-height:none!important;background:transparent}.pjscssed{}pjsdiv svg{margin:0}");
19551            o.frame.setAttribute('class', 'pjscssed')
19552        }
19553        o.frame.appendChild(o.frameresize);
19554        o.container.oncontextmenu = function ContextMenu(e) {
19555            o.rightclick++;
19556            if (o.rightclick == 5) {
19557                v.log = 1;
19558                log(o.version + ' ' + o.compilations + ' ' + o.playerid)
19559            }
19560            if (!e) var e = window.event;
19561            e.cancelBubble = true;
19562            if (e.stopPropagation) e.stopPropagation();
19563            var x = e.pageX - findLeft(o.frame);
19564            var y = e.pageY - findTop(o.frame);
19565            if (v.rc_custom == 1) {
19566                if (exist(v.rc_label)) {
19567                    if (trim(v.rc_label) != '') {
19568                        o.brand = v.rc_label;
19569                        exist(v.rc_labelurl) ? o.brandurl = v.rc_labelurl : '';
19570                        v.rc_label == 'none' ? o.brandurl = o.d : ''
19571                    }
19572                }
19573            }
19574            RightMenu(x, y);
19575            return false
19576        };
19577
19578        function RightMenu(x, y) {
19579            if (o.brandurl.indexOf(o.d) == -1 || v.rc_anyway == 1 || v.rightmenu == 1) {
19580                if (!exist(o.rightmenu)) {
19581                    !v.rmbgcolor ? v.rmbgcolor = "000000" : '';
19582                    !v.rmcolor ? v.rmcolor = "ffffff" : '';
19583                    o.rightmenu = createElement('div');
19584                    var tmp;
19585                    var n = 0;
19586                    for (var i = 0; i < 10; i++) {
19587                        if ((v['rm' + i] == 1 && v.rightmenu == 1) || i == 9) {
19588                            if ((exist(v['rm' + i + 't']) && exist(v['rm' + i + 'a']) || i == 9)) {
19589                                tmp = createElement("div2");
19590                                if (i == 9) {
19591                                    if (v.rc_nobrand != 1) {
19592                                        tmp.innerText = o.brand + (v.rc_version == 1 ? " " + o.version : '')
19593                                    } else {
19594                                        break
19595                                    }
19596                                } else {
19597                                    tmp.innerText = v['rm' + i + 't']
19598                                }
19599                                if (i != 9) {
19600                                    if (v['rm' + i + 'a'].indexOf(",0/1") > -1 || v['rm' + i + 'a'].indexOf(",1/0") > -1) {
19601                                        var z = v['rm' + i + 'a'].split(',');
19602                                        tmp.innerText += ' (' + (apiProcessor(z[0].substr(4)) == 1 ? Lang('on') : Lang('off')) + ')'
19603                                    }
19604                                    if (v['rm' + i + 'a'].indexOf("share") == 0) {
19605                                        o.shareme = true;
19606                                        !o.share ? o.controls.CrShr() : ''
19607                                    }
19608                                }
19609                                tmp.setAttribute("i", i);
19610                                RightCSS(tmp);
19611                                tmp.addEventListener("click", RightClick);
19612                                o.rightmenu.appendChild(tmp);
19613                                n++
19614                            }
19615                        }
19616                    }
19617                    css(o.rightmenu, {
19618                        "text-transform": "uppercase",
19619                        "line-height": "1",
19620                        "white-space": "nowrap",
19621                        "background": hex2rgb(v.rmbgcolor, 0.7)
19622                    });
19623                    if (n > 1) {
19624                        css(o.rightmenu, {
19625                            "padding": "5px"
19626                        })
19627                    }
19628                    o.rightmenu.style.zIndex = "99999";
19629                    o.rightmenu.onmousemove = RightMove;
19630                    o.frame.appendChild(o.rightmenu)
19631                } else {
19632                    show2(o.rightmenu)
19633                }
19634                css(o.rightmenu, {
19635                    "position": "absolute",
19636                    "top": y,
19637                    "left": x,
19638                    "text-align": "left"
19639                });
19640                var tmpr = false;
19641                if (o.screen_w - x < o.rightmenu.offsetWidth - 20 && v.notofh != 1) {
19642                    css(o.rightmenu, {
19643                        "left": x - o.rightmenu.offsetWidth
19644                    });
19645                    tmpr = true
19646                }
19647                if (v.rmright == 1 || tmpr) {
19648                    css(o.rightmenu, {
19649                        "text-align": "right"
19650                    })
19651                }
19652                o.right_x = x;
19653                o.right_y = y;
19654                clearTimeout(o.rightout);
19655                o.rightout = setTimeout(function () {
19656                    hide2(o.rightmenu)
19657                }, 2000)
19658            }
19659        }
19660
19661        function RightMove() {
19662            clearTimeout(o.rightout);
19663            o.rightout = setTimeout(function () {
19664                hide2(o.rightmenu)
19665            }, 2000)
19666        }
19667
19668        function RightClick(e) {
19669            var i = e.target.getAttribute("i");
19670            var y;
19671            var dont = false;
19672            if (i > 0) {
19673                if (i == 9) {
19674                    o.brandurl != '' ? window.open(o.brandurl) : ''
19675                } else {
19676                    var x = v['rm' + i + 'a'];
19677                    if (x) {
19678                        if (x.indexOf("api:") == 0) {
19679                            if (x.indexOf(",0/1") > -1 || x.indexOf(",1/0") > -1) {
19680                                var z = x.split(',');
19681                                var b = o.controls.butByS(x, "linkurl");
19682                                var u = apiProcessor(z[0].substr(4), z[1], b);
19683                                js(z, u);
19684                                reRightMenu();
19685                                RightMenu(o.right_x, o.right_y);
19686                                dont = true
19687                            } else {
19688                                y = x.split(",");
19689                                apiProcessor(y[0].substr(4), (exist(y[1]) ? y[1] : null))
19690                            }
19691                        }
19692                        if (x.indexOf("share:") == 0 && o.share) {
19693                            o.share.api(x.substr(6))
19694                        }
19695                        if (x.indexOf("js:") == 0) {
19696                            y = x.split(",");
19697                            eval(y[0].substr(3) + '(' + (exist(y[1]) ? '"' + y[1] + '"' : '') + (exist(y[2]) ? ',"' + y[2] + '"' : '') + ')')
19698                        }
19699                        if (x.indexOf("url:") == 0) {
19700                            x = x.replace(/\(url\)/g, Href());
19701                            x = x.replace(/\(ref\)/g, encodeURIComponent(exist(v.parent_domain) ? v.parent_domain : document.referrer));
19702                            x = x.replace(/\(title\)/g, o.titlestore);
19703                            x = x.replace(/\(label\)/g, v.label);
19704                            window.open(x.substr(4))
19705                        }
19706                    }
19707                }!dont ? hide2(o.rightmenu) : ''
19708            }
19709        }
19710
19711        function RightCSS(x) {
19712            css(x, {
19713                "padding": "4px 5px",
19714                "font-size": (v.rmsize ? v.rmsize : "55") * existv(v.globalfs, 1) + "%",
19715                "letter-spacing": "0.15em",
19716                "opacity": 0.9,
19717                "color": v.rmcolor
19718            });
19719            x.addEventListener("mouseover", RightOver);
19720            x.addEventListener("mouseout", RightOut)
19721        }
19722
19723        function RightOver(e) {
19724            css(e.target, {
19725                "opacity": 1
19726            });
19727            css(e.target, {
19728                "background": hex2rgb(v.rmbgcolor, 0.5)
19729            })
19730        }
19731
19732        function RightOut(e) {
19733            css(e.target, {
19734                "opacity": 0.9
19735            });
19736            css(e.target, {
19737                "background": "none"
19738            })
19739        }
19740        o.system = new System();
19741        if (o.system.ios) {
19742            var ioscss = (v.hidestartbutios == 1 ? '*::-webkit-media-controls-start-playback-button {display: none!important;-webkit-appearance: none;}' : '');
19743            if (v.nativecontrolsmobile == 1 && v.nativenotios != 1 && (v.nativenotiphone != 1 || !o.system.iphone) && (v.nativenotipad != 1 || !o.system.ipad)) {} else {
19744                if (o.system.ios && v.nativefullios == 1) {} else {
19745                    ioscss += 'video::-webkit-media-controls {display:none !important;}*::-webkit-media-controls-panel {display: none!important;-webkit-appearance: none;}*::--webkit-media-controls-play-button {display: none!important;-webkit-appearance: none;}'
19746                }
19747            }
19748            var tmp = document.createElement('style');
19749            tmp.type = 'text/css';
19750            tmp.appendChild(document.createTextNode(ioscss));
19751            o.frame.appendChild(tmp)
19752        }
19753        if (o.system.mobiletv) {
19754            v.autoplay == 1 && v.autoplaynomobiletv == 1 ? v.autoplay = 0 : ''
19755        }
19756        if (o.aspect == 0) {
19757            if (o.frame.offsetHeight == 15 && !o.container_h_procent && v.playerheight > 0) {
19758                css(o.container, {
19759                    "height": v.playerheight
19760                })
19761            }
19762        }
19763        if (exist(v.autonext)) {
19764            v.playlist.autoplaylist = v.autonext
19765        }
19766        if (exist(v.playlistloop)) {
19767            v.playlist.playlistrewind = v.playlistloop
19768        }
19769        if (exist(v.start)) {
19770            o.seekto = v.start
19771        }
19772        if (exist(window.requestAnimationFrame) && v.rafinit == 1) {
19773            window.requestAnimationFrame(Ready)
19774        } else {
19775            Ready()
19776        }
19777    }
19778
19779    function Ready() {
19780        log("Ready");
19781        o.actions = new Actions();
19782        if (!v.file) {
19783            v.file = "?"
19784        }
19785        if (v.pl) {
19786            v.file = v.pl + o.pltxt
19787        }
19788        o.sessid = randomstr();
19789        o.sesstime = 0;
19790        o.storage = StorageSupport();
19791        if (o.storage) {
19792            if (localStorage.getItem("pljsuserid") != null) {
19793                o.userid = localStorage.getItem("pljsuserid")
19794            } else {
19795                o.userid = randomstr();
19796                localStorage.setItem("pljsuserid", o.userid)
19797            }
19798            if (v.qualitystore == 1) {
19799                if (localStorage.getItem("pljsquality") != null) {
19800                    o.default_quality = localStorage.getItem("pljsquality");
19801                    if (exist2(v.forbidden_quality)) {
19802                        if (v.forbidden_quality.indexOf(o.default_quality) > -1) {
19803                            o.default_quality = null
19804                        }
19805                    }
19806                }
19807            }
19808            if (v.trackstore == 1) {
19809                if (localStorage.getItem("pljstrack") != null) {
19810                    v.default_audio = localStorage.getItem("pljstrack")
19811                }
19812            }
19813            for (var i = 0; i < o.vsts.length; i++) {
19814                if (v['vast_nofirst' + o.vsts[i]] == 1) {
19815                    if (localStorage.getItem("pljsfirst" + o.vsts[i]) != null) {} else {
19816                        v[o.vsts[i] + 's'] = 0
19817                    }
19818                }
19819            }
19820            SettingsTimers("sleeptimer0");
19821            SettingsTimers("offsettimerinit")
19822        }
19823        o.href2 = o.href.substr(o.href.indexOf("://") + 3);
19824        if (o.href2.indexOf("#") > 0) {
19825            o.href2 = o.href2.substr(0, o.href2.indexOf("#"))
19826        }
19827        if (o.storage && v.timestore == 1) {
19828            o.continue = new TimeStore()
19829        }
19830        if (v.observer == 1) {
19831            o.visibility = v.startvisibility;
19832            Visibility(o.container, "visibility", true)
19833        }
19834        v.minify == 1 && v.observer == 1 ? o.minify = new PluginMini() : '';
19835        v.ab == 1 ? PluginBlock() : '';
19836        if (v.quizes == 1) {
19837            o.quiz = new PluginQuiz();
19838            o.quiz.Start()
19839        }
19840        o.media = new Media(v.file);
19841        if (!o.system.mobile || v.desktop == 1) {
19842            o.frame.addEventListener("mouseenter", function () {
19843                o.mouseHere = true;
19844                o.mouseHere2 = true;
19845                o.controls ? o.controls.StageOver() : ''
19846            });
19847            o.frame.addEventListener("mouseleave", function (e) {
19848                if (!o.mouseDown) {
19849                    if (v.toolbar.hideleavetimeout > 0) {
19850                        clearTimeout(o.leavetimeout2);
19851                        o.leavetimeout2 = setTimeout(function () {
19852                            if (o.mouseHere != o.mouseHere2) {
19853                                o.mouseHere = o.mouseHere2;
19854                                o.controls.Review()
19855                            }
19856                        }, v.toolbar.hideleavetimeout * 1000)
19857                    } else {
19858                        o.mouseHere = false
19859                    }
19860                    o.mouseHere2 = false;
19861                    if (o.controls) {
19862                        o.controls.StageLeave()
19863                    }
19864                }
19865            })
19866        }
19867        if (!o.system.mobile) {
19868            o.frame.addEventListener("mousedown", function (e) {
19869                if (!o.touched) {
19870                    o.mouseDown = true
19871                }
19872            });
19873            o.frame.addEventListener("mouseup", function (e) {
19874                if (!o.touched) {
19875                    o.mouseDown = false;
19876                    if (!o.volumewheel) {
19877                        o.hidden_volume_over = false;
19878                        o.hidden_volume_over_process = false
19879                    }
19880                    if (o.system.touch && o.system.desktop && o.fullscreen) {
19881                        setTimeout(function () {
19882                            o.mouseHere = false;
19883                            o.controls.Review()
19884                        }, 500)
19885                    }
19886                    setTimeout(function () {
19887                        o.focus = true
19888                    }, 500);
19889                    if (o.system.mobile && o.controls.ToolbarHidden()) {} else {
19890                        o.controls ? o.controls.StageMouseUp(e.clientX, e.clientY) : ''
19891                    }
19892                    if (v.hidevideo == 1) {
19893                        if (o.controls.SettingsVisible()) {
19894                            o.controls.Settings()
19895                        }
19896                    }
19897                }
19898            });
19899            o.frame.addEventListener("mousemove", function (e) {
19900                if (!o.touched) {
19901                    if (exist(o.controls)) {
19902                        if (o.mouseDown) {
19903                            o.controls.StageMove(e.clientX, e.clientY)
19904                        } else {
19905                            o.controls.StageMove2()
19906                        }
19907                    }
19908                }
19909            })
19910        }
19911        if (o.system.mobile) {
19912            window.addEventListener("orientationchange", OrientationChange, false)
19913        }
19914        v.geo == 1 && typeof PluginGeo == 'function' ? o.geo = new PluginGeo() : '';
19915        o.mediacontainer.addEventListener("touchstart", function (e) {
19916            if (e.touches) {
19917                o.tchs = e.touches.length
19918            }
19919            o.mouseDown = true;
19920            o.mouseHere = true;
19921            o.mouseMove = false;
19922            Touch("start", e)
19923        }, {
19924            passive: true
19925        });
19926        o.mediacontainer.addEventListener("touchmove", function (e) {
19927            if (e.touches) {
19928                o.tchs = e.touches.length;
19929                if (o.tchs > 1) {
19930                    o.tchs2 = 1
19931                }
19932            }
19933            if (o.mouseDown) {
19934                o.mouseMove = true;
19935                Touch("move", e)
19936            }
19937        }, {
19938            passive: true
19939        });
19940        o.mediacontainer.addEventListener("touchend", function (e) {
19941            o.mouseDown = false;
19942            clearTimeout(o.leavetimeout2);
19943            o.leavetimeout2 = setTimeout(function () {
19944                o.mouseHere = false
19945            }, existv(v.toolbar.hideleavetimeout, 0.5) * 1000);
19946            if (v.click0timeout == 1) {
19947                var now = new Date().getTime();
19948                if (now - o.clicktime < (v.dclckto ? v.dclckto : 0.3) * 1000) {
19949                    DoubleClick(e)
19950                }
19951            }!o.mouseMove && o.tchs < 2 && o.tchs2 != 1 ? ScreenClick(e) : '';
19952            o.mouseMove = false;
19953            o.tchs = 0;
19954            if (e.touches.length == 0) {
19955                o.tchs = 0;
19956                o.tchs2 = 0
19957            }
19958            Touch("end", e)
19959        }, {
19960            passive: true
19961        });
19962        try {
19963            window.document.addEventListener("mouseup", function (e) {
19964                o.focus = false;
19965                if (!o.volumewheel) {
19966                    o.hidden_volume_over = false;
19967                    o.hidden_volume_over_process = false
19968                }
19969                if (o.mouseDown && o.controls) {
19970                    o.mouseDown = false;
19971                    o.controls.StageMouseUp(e.clientX, e.clientY);
19972                    o.controls.StageLeave()
19973                }
19974                if (!o.mouseHere && !o.system.mobile && !o.system.tv) {
19975                    o.controls.SettingsClose();
19976                    if (o.droplist) {
19977                        o.droplist.Close()
19978                    }
19979                    o.controls.closePl()
19980                }
19981            })
19982        } catch (err) {}
19983        window.document.addEventListener("mousemove", function (e) {
19984            if (o.controls) {
19985                if (o.mouseDown) {
19986                    o.controls.StageMove(e.clientX, e.clientY)
19987                } else {
19988                    o.system.mobile ? o.controls.StageMove2() : ''
19989                }
19990            }
19991        });
19992        if (!o.system.tv) {
19993            o.frame.addEventListener("touchstart", function (e) {
19994                o.touched = true;
19995                o.system.mobile = true;
19996                o.touch = true;
19997                o.mouseDown = true
19998            }, {
19999                passive: true
20000            });
20001            o.frame.addEventListener("touchend", function (e) {
20002                o.touch = false;
20003                o.mouseDown = false
20004            }, {
20005                passive: true
20006            });
20007            window.document.addEventListener("touchmove", function (e) {
20008                if (o.controls && o.touch) {
20009                    o.controls.StageMove(e.touches[0].pageX, e.touches[0].pageY)
20010                }
20011            }, {
20012                passive: true
20013            })
20014        }
20015        window.document.addEventListener("keyup", function (e) {
20016            var x = e.target.tagName.toLowerCase();
20017            if (x == 'input' || x == 'textarea' || x == 'pjsin') {
20018                return
20019            } else {
20020                o.controls ? o.controls.KeyUp(e) : ''
20021            }
20022        });
20023        window.document.addEventListener("keydown", function (e) {
20024            var x = e.target.tagName.toLowerCase();
20025            if (x == 'input' || x == 'textarea' || x == 'div' || x == 'pjsin') {
20026                return
20027            } else {
20028                o.controls ? o.controls.KeyDown(e) : ''
20029            }
20030        });
20031        if (o.parentIframe) {
20032            FSL(parent.document, ParentFS)
20033        }
20034        FSL(document, FullscreenChange);
20035
20036        function FSL(x, z) {
20037            var y = ['', 'moz', 'webkit', 'ms', 'MSFullscreenChange'];
20038            if (x) {
20039                for (var i = 0; i < y.length; i++) {
20040                    x.addEventListener(y[i] + (i < y.length - 1 ? "fullscreenchange" : ''), z, false)
20041                }
20042            }
20043        }
20044        if (!exist(o.frameresize.contentWindow)) {
20045            log("Local");
20046            return
20047        } else {
20048            o.frameresize.contentWindow.addEventListener('resize', FrameResizer, true)
20049        }
20050        if (!o.system.mobile) {
20051            o.mediacontainer.addEventListener("click", function (e) {
20052                !o.touched ? ScreenClick(e) : ''
20053            }, false);
20054            if (v.doubleclick == 1 && v.click0timeout == 1) {
20055                o.mediacontainer.addEventListener("dblclick", DoubleClick, false)
20056            }
20057        }
20058        MainUpdateSize();
20059        if (v.chromecast) {
20060            v.chromecast.on == 1 ? o.chromecast = new ChromeCast() : ''
20061        }
20062        v.effects == 1 ? o.effects = new PluginEffects() : '';
20063        v.mediatags == 1 ? o.mediatags = new PluginMediaTags() : '';
20064        o.controls = new Controls();
20065        if (v.control_title.templated) {
20066            o.title_template = v.control_title.template
20067        }
20068        Title();
20069        MainResize();
20070        if (o.storage) {
20071            if (v.volumestore == 1 && v.volume != 0 && !o.system.mobile) {
20072                if (localStorage.getItem("pljsvolume") != null) {
20073                    v.volume = localStorage.getItem("pljsvolume")
20074                }
20075                if (localStorage.getItem("pljsmute") == 1 && v.mutestore == 1) {
20076                    v.mute = 1
20077                }
20078            }
20079            if (v.speedstore == 1) {
20080                var sp = localStorage.getItem("pljsspeed");
20081                if (exist(sp)) {
20082                    if (sp.indexOf('.') > 0 && o.line_speed) {
20083                        o.actions.SetSpeed(sp, 1)
20084                    } else {
20085                        if (o.files_speed) {
20086                            var spd = indOf(o.files_speed, sp, true);
20087                            if (spd != -1 && o.controls.SettingsExist('speed')) {
20088                                o.current_speed = spd;
20089                                o.media.SetSpeed(o.files_speed[spd])
20090                            }
20091                            o.controls.SettingsSpeed()
20092                        }
20093                    }
20094                }
20095            }
20096            var substore = false;
20097            if (v.sub_designstore == 1) {
20098                for (var j = 0; j < o.sub_options.length; j++) {
20099                    if (localStorage.getItem("pljs" + o.sub_options[j]) != null) {
20100                        v[o.sub_options[j]] = localStorage.getItem("pljs" + o.sub_options[j]);
20101                        substore = true
20102                    }
20103                }
20104            }
20105            if (o.system.mobile) {
20106                if (!substore) {
20107                    exist2(v.sub_bottommob) ? v.sub_bottom = v.sub_bottommob : ''
20108                }
20109                if (exist(v.sub_sizemob)) {
20110                    v.sub_size = v.sub_sizemob;
20111                    exist2(v.sub_sizemobfull) ? v.sub_size_fullscreen = v.sub_sizemobfull : ''
20112                }
20113            }
20114        }
20115        if (o.continue) {
20116            var f = o.continue.flag();
20117            if (f.t && f.d) {
20118                o.controls.Played(f.t, f.d);
20119                o.controls.Duration(f.t, f.d);
20120                v.duration = f.d
20121            }
20122        }
20123        o.actions.Volume(v.volume);
20124        if (v.mute == 1) {
20125            o.actions.Mute();
20126            o.controls.refresh()
20127        }
20128        if (exist(v.default_speed)) {
20129            apiProcessor("speed", v.default_speed)
20130        }
20131        o.alert = new Alert();
20132        if (v.rounding > 0) {
20133            if (v.hidevideo == 1 || o.normal_h < 120) {
20134                css(o.container, {
20135                    "border-radius": (v.rounding + "px")
20136                });
20137                css(o.frame, {
20138                    "border-radius": (v.rounding + "px")
20139                })
20140            } else {
20141                PluginRounding()
20142            }
20143        }
20144        if (exist(v.midroll)) {
20145            str2obj("midroll")
20146        }
20147        if (exist(v.overlay)) {
20148            str2obj("overlay")
20149        }
20150        if (exist(o.playlist)) {
20151            js("playlist")
20152        }
20153        if (v.pass == 1 && v.passonstart == 1) {
20154            o.actions.Password()
20155        }
20156        for (var i = 2; i < 10; i++) {
20157            if (exist(v["design" + i])) {
20158                if (v["design" + i] == "mobile" && o.system.mobile) {
20159                    apiProcessor("design", i)
20160                }
20161            }
20162        }
20163        setTimeout(FrameResizer, 500, true);
20164        setTimeout(function () {
20165            js("init");
20166            if (v.ready) {
20167                if (typeof v.ready == 'function') {
20168                    v.ready = v.ready.name
20169                };
20170                eval(v.ready + (v.ready.indexOf('()') == -1 ? '("' + v.id + '")' : ''))
20171            }
20172        }, 1)
20173    }
20174
20175    function ScreenClick(e) {
20176        if (o.moving[o.mediacontainer] > 2) {
20177            return
20178        }
20179        o.acted = true;
20180        v.dclckto == 0 ? v.click0timeout = 1 : '';
20181        if (o.click_t && v.screenclick == 1 && !o.system.tv) {
20182            DoubleClick(e)
20183        } else {
20184            var t = (v.dclckto ? v.dclckto : 0.35) * 1000;
20185            ClearClick();
20186            clearTimeout(o.click_t2);
20187            o.click_t2 = setTimeout(function () {
20188                o.clicks = 0
20189            }, t + 200);
20190            if (v.click0timeout == 1 || (v.doubleclick == 0 && v.hotkey.seeksides != 1)) {
20191                ScreenClick2()
20192            } else {
20193                o.click_t = setTimeout(ScreenClick2, t)
20194            }
20195        }
20196        o.clicks++;
20197        JsClk()
20198    }
20199
20200    function ScreenClick2() {
20201        ClearClick();
20202        if (o.system.mobile) {
20203            if (o.controls.ToolbarHidden()) {
20204                o.controls.StageMove2();
20205                if (o.muted && v.unmuteonclick == 1) {
20206                    o.actions.Unmute();
20207                    v.unmuteonclick = 0
20208                }
20209                if (v.mobtch1 != 1) {
20210                    return
20211                }
20212            }
20213            if (o.nativefull) {
20214                if (v.nativefulldroid == 1 && v.nfscldr == 1 && o.system.android) {
20215                    return
20216                }
20217                if (v.nativefullios == 1 && v.nfsclios == 1 && o.system.ios) {
20218                    return
20219                }
20220            }
20221        }
20222        if (o.clicks > 1 && v.hotkey.seeksides == 1) {
20223            o.clicks = 0;
20224            return
20225        }
20226        o.clicks = 0;
20227        if (v.screenclick == 1) {
20228            o.system.mobile && v.nombclck == 1 ? '' : o.actions.ScreenClick()
20229        }
20230    }
20231
20232    function DoubleClick(e) {
20233        ClearClick();
20234        var y = false;
20235        if (v.hotkey.seeksides == 1) {
20236            if (e) {
20237                if (v.hotkey.seeksidesmob == 1 && !o.system.mobile) {} else {
20238                    var x;
20239                    if (o.system.mobile) {
20240                        x = e.layerX;
20241                        if (!x) {
20242                            if (e.changedTouches) {
20243                                x = e.changedTouches[0].pageX - findLeft(o.frame)
20244                            }
20245                        }
20246                    } else {
20247                        x = e.offsetX
20248                    }
20249                    if (o.fzoom > 1) {
20250                        x = x / o.fzoom
20251                    }
20252                    if (x) {
20253                        if (x < o.screen_w / 2) {
20254                            if (x < o.screen_w * 20 / 100) {
20255                                apiProcessor("seek", "-" + existv(v.hotkey.seeksidesec, 10) * o.clicks);
20256                                v.hotkey.icons == 1 && v.hotkey.seekicon == 1 ? PluginHotIcon('seek', 0) : '';
20257                                y = true
20258                            }
20259                        } else {
20260                            if (x > o.screen_w - o.screen_w * 20 / 100) {
20261                                apiProcessor("seek", "+" + existv(v.hotkey.seeksidesec, 10) * o.clicks);
20262                                v.hotkey.icons == 1 && v.hotkey.seekicon == 1 ? PluginHotIcon('seek', 1) : '';
20263                                y = true
20264                            }
20265                        }
20266                        if (y) {
20267                            if (e.stopPropagation) e.stopPropagation()
20268                        }
20269                    }
20270                }
20271            }
20272        }
20273        if (!y) {
20274            if (v.doubleclick == 1) {
20275                if (v.nativecontrolsmobile == 1 && o.system.mobile) {} else {
20276                    o.fullscreen ? o.actions.Normalscreen() : o.actions.Fullscreen()
20277                }
20278            }
20279        }
20280    }
20281
20282    function ClearClick() {
20283        clearTimeout(o.click_t);
20284        o.click_t = undefined
20285    }
20286
20287    function FrameResizer(x) {
20288        if (o.screen_lw != o.frame.offsetWidth) {
20289            x ? o.screen_lw = o.frame.offsetWidth : '';
20290            FrameResizer()
20291        } else {
20292            MainResize()
20293        }
20294    }
20295
20296    function MainResize() {
20297        var y = false;
20298        if (o.normal_w != o.frame.offsetWidth || o.normal_h != o.frame.offsetHeight) {
20299            y = true
20300        }
20301        MainUpdateSize();
20302        o.controls ? o.controls.resize() : '';
20303        o.media.resize();
20304        y && !o.fullscreen ? js("resize", o.normal_w + ',' + o.normal_h) : ''
20305    }
20306
20307    function MainUpdateSize() {
20308        var xw = o.frame.offsetWidth;
20309        var xh = o.frame.offsetHeight;
20310        if (o.controls) {
20311            if (v.change2playlist == 1) {
20312                if (v.playlist.position != "bottom") {
20313                    var x = o.controls.PlaylistG("scroll_height") + o.controls.PlaylistG("top") + 5 + o.controls.PlaylistG("margin_bottom") + existv(v.change2playlist_bottom, 0);
20314                    css(o.container, {
20315                        "height": x
20316                    })
20317                }
20318            }
20319        }
20320        if (o.aspect > 0 && !o.fullscreen && !o.fullscreen_start) {
20321            xh = xw / o.aspect + existv(v.screenmarginbottom, 0);
20322            css(o.container, {
20323                "height": xh
20324            })
20325        }
20326        if (!o.fullscreen && !o.fullscreen_start && !o.fullscreen_process) {
20327            o.normal_w = Math.round(xw);
20328            o.normal_h = Math.round(xh)
20329        }
20330        if (o.system.mobile && o.fullscreen && v.landfullmobile == 1 && screen.orientation) {
20331            if (o.aspect > 0) {
20332                if (o.aspect < 1 || o.media.ratio() < 1) {
20333                    var sp = screen.orientation.lock('portrait');
20334                    if (sp !== undefined) {
20335                        sp.then(function () {}).catch(function (e) {})
20336                    }
20337                } else {
20338                    var sp = screen.orientation.lock('landscape');
20339                    if (sp !== undefined) {
20340                        sp.then(function () {}).catch(function (e) {})
20341                    }
20342                }
20343            } else {
20344                var sp = screen.orientation.lock('landscape');
20345                if (sp !== undefined) {
20346                    sp.then(function () {}).catch(function (e) {})
20347                }
20348            }
20349        }
20350        o.screen_w = xw;
20351        o.screen_h = xh;
20352        if (exist(v.title) && o.controls) {
20353            v.title != '' ? o.controls.updateTitle() : ''
20354        }
20355        if (exist(o.custom_aspect)) {
20356            o.media.scale(o.custom_aspect)
20357        }
20358        if (o.vast && !o.fullscreen) {
20359            o.vast.Resize()
20360        }
20361        if (v.vast_ima == 1 && o.ima) {
20362            try {
20363                o.ima.Resize()
20364            } catch (e) {
20365                console.log(e)
20366            }
20367        }
20368        o.droplist ? o.droplist.Resize() : '';
20369        o.quiz ? o.quiz.Resize() : '';
20370        o.effects ? o.effects.api('resize') : '';
20371        o.rel ? o.rel.Resize() : ''
20372    }
20373
20374    function Title() {
20375        o.actions.TitleTemplate(v);
20376        for (var x in v) {
20377            if (v.hasOwnProperty(x)) {
20378                if (x.indexOf("title") == 0) {
20379                    if (v[x] != '') {
20380                        o.maintitle = v[x];
20381                        o.actions.Title(x)
20382                    }
20383                }
20384            }
20385        }
20386        o.mediatags ? o.mediatags.read() : ''
20387    }
20388
20389    function Poster(url, container, scale) {
20390        if (url) {
20391            if (url != '') {
20392                if (v.fplace == 1) {
20393                    url = fplace(url)
20394                }
20395                if (container == o.poster && url == o.currentposter) {} else {
20396                    if (url.indexOf("#" + v.enc2) == 0) {
20397                        url = o[o.fd[0]](url)
20398                    }
20399                    if (url.indexOf("#0") == 0) {
20400                        url = fd0(url)
20401                    }
20402                    url = checkBase64(url);
20403                    if (exist(v.preposter) && url.indexOf("//") == -1) {
20404                        url = v.preposter + url
20405                    }
20406                    var s = "contain";
20407                    if (scale == "fill") {
20408                        s = "cover"
20409                    }
20410                    if (scale == "none") {
20411                        s = "auto"
20412                    }
20413                    if (scale == "stretch") {
20414                        s = "100% 100%"
20415                    }
20416                    if (url.indexOf(' and ') > 0 && container == o.poster) {
20417                        o.pstrs = url.split(' and ');
20418                        clearInterval(o.pstrsin);
20419                        o.pstrsin = setInterval(Posters, existv(v.posterstime, 2) * 1000);
20420                        o.pstrsi = 0;
20421                        url = o.pstrs[0]
20422                    }
20423                    url = url.replace(/ or /g, '"),url("');
20424                    url = url.replace(/\s/g, '%20');
20425                    if (v.pstrvd == 1 && indOf([url], '.mp4')) {
20426                        var tmp = 'pjs' + v.id + '_vdpsrt';
20427                        container.innerHTML = '<video id="' + tmp + '" src="' + url + '" loop=1 playsinline=1 autoplay=1 muted=1 style="width:100%"></video>';
20428                        o.pstrv = document.getElementById(tmp)
20429                    } else {
20430                        o.pstrv = undefined;
20431                        container.innerHTML = '';
20432                        css(container, {
20433                            'background-image': 'url("' + url + '")',
20434                            'background-repeat': 'no-repeat',
20435                            'background-position': 'center',
20436                            'background-size': s
20437                        })
20438                    }
20439                    show(container);
20440                    container == o.poster ? o.currentposter = url : ''
20441                }
20442            }
20443        }
20444    };
20445
20446    function Posters() {
20447        if (exist(o.pstrs) && exist(o.pstrsi)) {
20448            o.pstrsi++;
20449            if (o.pstrsi >= o.pstrs.length) {
20450                o.pstrsi = 0
20451            }
20452            Poster(o.pstrs[o.pstrsi], o.poster, v.poster_scale)
20453        }
20454    }
20455
20456    function Logo(x) {
20457        if (x.on == 1 && exist(x.src)) {
20458            x.src = checkBase64(x.src);
20459            var y = createElement("div");
20460            if (x.src.indexOf("http") > -1 || x.src.indexOf("//") == 0) {
20461                var z = createElement("img");
20462                z.src = x.src;
20463                y.appendChild(z)
20464            }
20465            x = UpdateObject(x, v.logo);
20466            x = MarginPadding(x, 'margin', 'margin');
20467            css(y, {
20468                'position': 'absolute'
20469            });
20470            if (x.position.indexOf("bottom") > -1) {
20471                css(y, {
20472                    'bottom': x.marginbottom
20473                })
20474            }
20475            if (x.position.indexOf("right") > -1) {
20476                css(y, {
20477                    'right': x.marginright
20478                })
20479            }
20480            if (x.position.indexOf("top") > -1) {
20481                css(y, {
20482                    'top': x.margintop
20483                })
20484            }
20485            if (x.position.indexOf("left") > -1) {
20486                css(y, {
20487                    'left': x.marginleft
20488                })
20489            }
20490            o.container.appendChild(y)
20491        }
20492    };
20493
20494    function FullscreenChange() {
20495        if (o.fullscreen && !isFullscreen()) {
20496            o.actions.NormalscreenUI(true);
20497            o.system.ff ? MainResize() : ''
20498        } else {
20499            if (o.fullscreen_start || o.mouseHere) {
20500                isFullscreen() ? o.fullscreen = true : '';
20501                o.actions.FullscreenUI()
20502            }
20503        }
20504        log("fullscreen", o.fullscreen)
20505    }
20506
20507    function ParentFS() {
20508        if (v.observer == 1) {
20509            Visibility(o.container, "visibility", true)
20510        }
20511    }
20512
20513    function Orientation() {
20514        log("orientation " + screen.orientation.angle)
20515    }
20516
20517    function OrientationChange() {
20518        if (Math.abs(window.orientation) === 90) {
20519            log("landscape");
20520            if (v.landscapefull == 1) {
20521                var ok = true;
20522                if (v.lsfullstart == 1 && !o.start) {
20523                    ok = false
20524                }
20525                if (v.lsfullplay == 1 && !o.play) {
20526                    ok = false
20527                }
20528                if (o.ispipkit) {
20529                    ok = false
20530                }
20531                if (o.vast) {
20532                    ok = true
20533                }!o.fullscreen && ok ? o.actions.Fullscreen() : ''
20534            }
20535        } else {
20536            log("portrait");
20537            if (v.landscapefull == 1) {
20538                o.fullscreen && v.landfullmobile != 1 ? o.actions.Normalscreen() : ''
20539            }
20540        }
20541    }
20542
20543    function isFullscreen(x) {
20544        !x ? x = document : '';
20545        var y = false;
20546        try {
20547            y = !!(x.webkitFullscreenElement || x.webkitIsFullScreen || x.mozFullScreen || x.msFullscreenElement || (x.fullscreenElement != undefined))
20548        } catch (e) {
20549            y = false
20550        }
20551        return y
20552    }
20553
20554    function isHidden(x) {
20555        return x.offsetWidth == 0 && x.offsetHeight == 0
20556    };
20557
20558    function Destroy() {
20559        for (var x in o) {
20560            if (x.indexOf("Interval") > -1) {
20561                clearInterval(o[x])
20562            }
20563            if (x.indexOf("timeout") > -1) {
20564                clearTimeout(o[x])
20565            }
20566        }
20567        log("Destroyed")
20568    }
20569}! function t(e) {
20570    var r, i;
20571    r = this, i = function () {
20572        "use strict";
20573
20574        function r(t, e) {
20575            var r = Object.keys(t);
20576            if (Object.getOwnPropertySymbols) {
20577                var i = Object.getOwnPropertySymbols(t);
20578                e && (i = i.filter((function (e) {
20579                    return Object.getOwnPropertyDescriptor(t, e).enumerable
20580                }))), r.push.apply(r, i)
20581            }
20582            return r
20583        }
20584
20585        function i(t) {
20586            for (var e = 1; e < arguments.length; e++) {
20587                var i = null != arguments[e] ? arguments[e] : {};
vendor: 5,875 bytes, lines 20588-20726
20588                e % 2 ? r(Object(i), !0).forEach((function (e) {
20589                    var r, a, s;
20590                    r = t, a = e, s = i[e], (a = n(a)) in r ? Object.defineProperty(r, a, {
20591                        value: s,
20592                        enumerable: !0,
20593                        configurable: !0,
20594                        writable: !0
20595                    }) : r[a] = s
20596                })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : r(Object(i)).forEach((function (e) {
20597                    Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(i, e))
20598                }))
20599            }
20600            return t
20601        }
20602
20603        function n(t) {
20604            var e = function (t, e) {
20605                if ("object" != typeof t || !t) return t;
20606                var r = t[Symbol.toPrimitive];
20607                if (void 0 !== r) {
20608                    var i = r.call(t, e || "default");
20609                    if ("object" != typeof i) return i;
20610                    throw new TypeError("@@toPrimitive must return a primitive value.")
20611                }
20612                return ("string" === e ? String : Number)(t)
20613            }(t, "string");
20614            return "symbol" == typeof e ? e : String(e)
20615        }
20616
20617        function a(t, e) {
20618            for (var r = 0; r < e.length; r++) {
20619                var i = e[r];
20620                i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, n(i.key), i)
20621            }
20622        }
20623
20624        function s(t, e, r) {
20625            return e && a(t.prototype, e), r && a(t, r), Object.defineProperty(t, "prototype", {
20626                writable: !1
20627            }), t
20628        }
20629
20630        function o() {
20631            return o = Object.assign ? Object.assign.bind() : function (t) {
20632                for (var e = 1; e < arguments.length; e++) {
20633                    var r = arguments[e];
20634                    for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i])
20635                }
20636                return t
20637            }, o.apply(this, arguments)
20638        }
20639
20640        function l(t, e) {
20641            t.prototype = Object.create(e.prototype), t.prototype.constructor = t, h(t, e)
20642        }
20643
20644        function u(t) {
20645            return u = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
20646                return t.__proto__ || Object.getPrototypeOf(t)
20647            }, u(t)
20648        }
20649
20650        function h(t, e) {
20651            return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
20652                return t.__proto__ = e, t
20653            }, h(t, e)
20654        }
20655
20656        function d(t, e, r) {
20657            return d = function () {
20658                if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
20659                if (Reflect.construct.sham) return !1;
20660                if ("function" == typeof Proxy) return !0;
20661                try {
20662                    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function () {}))), !0
20663                } catch (t) {
20664                    return !1
20665                }
20666            }() ? Reflect.construct.bind() : function (t, e, r) {
20667                var i = [null];
20668                i.push.apply(i, e);
20669                var n = new(Function.bind.apply(t, i));
20670                return r && h(n, r.prototype), n
20671            }, d.apply(null, arguments)
20672        }
20673
20674        function c(t) {
20675            var e = "function" == typeof Map ? new Map : void 0;
20676            return c = function (t) {
20677                if (null === t || ! function (t) {
20678                        try {
20679                            return -1 !== Function.toString.call(t).indexOf("[native code]")
20680                        } catch (e) {
20681                            return "function" == typeof t
20682                        }
20683                    }(t)) return t;
20684                if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
20685                if (void 0 !== e) {
20686                    if (e.has(t)) return e.get(t);
20687                    e.set(t, r)
20688                }
20689
20690                function r() {
20691                    return d(t, arguments, u(this).constructor)
20692                }
20693                return r.prototype = Object.create(t.prototype, {
20694                    constructor: {
20695                        value: r,
20696                        enumerable: !1,
20697                        writable: !0,
20698                        configurable: !0
20699                    }
20700                }), h(r, t)
20701            }, c(t)
20702        }
20703
20704        function f(t, e) {
20705            (null == e || e > t.length) && (e = t.length);
20706            for (var r = 0, i = new Array(e); r < e; r++) i[r] = t[r];
20707            return i
20708        }
20709
20710        function g(t, e) {
20711            var r = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
20712            if (r) return (r = r.call(t)).next.bind(r);
20713            if (Array.isArray(t) || (r = function (t, e) {
20714                    if (t) {
20715                        if ("string" == typeof t) return f(t, e);
20716                        var r = Object.prototype.toString.call(t).slice(8, -1);
20717                        return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? f(t, e) : void 0
20718                    }
20719                }(t)) || e && t && "number" == typeof t.length) {
20720                r && (t = r);
20721                var i = 0;
20722                return function () {
20723                    return i >= t.length ? {
20724                        done: !0
20725                    } : {
20726                        done: !1,
vendor: 4,024 bytes, lines 20727-20804
20727                        value: t[i++]
20728                    }
20729                }
20730            }
20731            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
20732        }
20733
20734        function v(t) {
20735            return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t
20736        }
20737        var m = {
20738            exports: {}
20739        };
20740        ! function (t, e) {
20741            var r, i, n, a, s;
20742            r = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, i = /^(?=([^\/?#]*))\1([^]*)$/, n = /(?:\/|^)\.(?=\/)/g, a = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, s = {
20743                buildAbsoluteURL: function (t, e, r) {
20744                    if (r = r || {}, t = t.trim(), !(e = e.trim())) {
20745                        if (!r.alwaysNormalize) return t;
20746                        var n = s.parseURL(t);
20747                        if (!n) throw new Error("Error trying to parse base URL.");
20748                        return n.path = s.normalizePath(n.path), s.buildURLFromParts(n)
20749                    }
20750                    var a = s.parseURL(e);
20751                    if (!a) throw new Error("Error trying to parse relative URL.");
20752                    if (a.scheme) return r.alwaysNormalize ? (a.path = s.normalizePath(a.path), s.buildURLFromParts(a)) : e;
20753                    var o = s.parseURL(t);
20754                    if (!o) throw new Error("Error trying to parse base URL.");
20755                    if (!o.netLoc && o.path && "/" !== o.path[0]) {
20756                        var l = i.exec(o.path);
20757                        o.netLoc = l[1], o.path = l[2]
20758                    }
20759                    o.netLoc && !o.path && (o.path = "/");
20760                    var u = {
20761                        scheme: o.scheme,
20762                        netLoc: a.netLoc,
20763                        path: null,
20764                        params: a.params,
20765                        query: a.query,
20766                        fragment: a.fragment
20767                    };
20768                    if (!a.netLoc && (u.netLoc = o.netLoc, "/" !== a.path[0]))
20769                        if (a.path) {
20770                            var h = o.path,
20771                                d = h.substring(0, h.lastIndexOf("/") + 1) + a.path;
20772                            u.path = s.normalizePath(d)
20773                        } else u.path = o.path, a.params || (u.params = o.params, a.query || (u.query = o.query));
20774                    return null === u.path && (u.path = r.alwaysNormalize ? s.normalizePath(a.path) : a.path), s.buildURLFromParts(u)
20775                },
20776                parseURL: function (t) {
20777                    var e = r.exec(t);
20778                    return e ? {
20779                        scheme: e[1] || "",
20780                        netLoc: e[2] || "",
20781                        path: e[3] || "",
20782                        params: e[4] || "",
20783                        query: e[5] || "",
20784                        fragment: e[6] || ""
20785                    } : null
20786                },
20787                normalizePath: function (t) {
20788                    for (t = t.split("").reverse().join("").replace(n, ""); t.length !== (t = t.replace(a, "")).length;);
20789                    return t.split("").reverse().join("")
20790                },
20791                buildURLFromParts: function (t) {
20792                    return t.scheme + t.netLoc + t.path + t.params + t.query + t.fragment
20793                }
20794            }, t.exports = s
20795        }(m);
20796        var p = m.exports,
20797            y = Number.isFinite || function (t) {
20798                return "number" == typeof t && isFinite(t)
20799            },
20800            E = Number.isSafeInteger || function (t) {
20801                return "number" == typeof t && Math.abs(t) <= T
20802            },
20803            T = Number.MAX_SAFE_INTEGER || 9007199254740991,
20804            S = function (t) {
20805                return t.MEDIA_ATTACHING = "hlsMediaAttaching", t.MEDIA_ATTACHED = "hlsMediaAttached", t.MEDIA_DETACHING = "hlsMediaDetaching", t.MEDIA_DETACHED = "hlsMediaDetached", t.BUFFER_RESET = "hlsBufferReset", t.BUFFER_CODECS = "hlsBufferCodecs", t.BUFFER_CREATED = "hlsBufferCreated", t.BUFFER_APPENDING = "hlsBufferAppending", t.BUFFER_APPENDED = "hlsBufferAppended", t.BUFFER_EOS = "hlsBufferEos", t.BUFFER_FLUSHING = "hlsBufferFlushing", t.BUFFER_FLUSHED = "hlsBufferFlushed", t.MANIFEST_LOADING = "hlsManifestLoading", t.MANIFEST_LOADED = "hlsManifestLoaded", t.MANIFEST_PARSED = "hlsManifestParsed", t.LEVEL_SWITCHING = "hlsLevelSwitching", t.LEVEL_SWITCHED = "hlsLevelSwitched", t.LEVEL_LOADING = "hlsLevelLoading", t.LEVEL_LOADED = "hlsLevelLoaded", t.LEVEL_UPDATED = "hlsLevelUpdated", t.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated", t.LEVELS_UPDATED = "hlsLevelsUpdated", t.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated", t.AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching", t.AUDIO_TRACK_SWITCHED = "hlsAudioTrackSwitched", t.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading", t.AUDIO_TRACK_LOADED = "hlsAudioTrackLoaded", t.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated", t.SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared", t.SUBTITLE_TRACK_SWITCH = "hlsSubtitleTrackSwitch", t.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading", t.SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded", t.SUBTITLE_FRAG_PROCESSED = "hlsSubtitleFragProcessed", t.CUES_PARSED = "hlsCuesParsed", t.NON_NATIVE_TEXT_TRACKS_FOUND = "hlsNonNativeTextTracksFound", t.INIT_PTS_FOUND = "hlsInitPtsFound", t.FRAG_LOADING = "hlsFragLoading", t.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted", t.FRAG_LOADED = "hlsFragLoaded", t.FRAG_DECRYPTED = "hlsFragDecrypted", t.FRAG_PARSING_INIT_SEGMENT = "hlsFragParsingInitSegment", t.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata", t.FRAG_PARSING_METADATA = "hlsFragParsingMetadata", t.FRAG_PARSED = "hlsFragParsed", t.FRAG_BUFFERED = "hlsFragBuffered", t.FRAG_CHANGED = "hlsFragChanged", t.FPS_DROP = "hlsFpsDrop", t.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping", t.MAX_AUTO_LEVEL_UPDATED = "hlsMaxAutoLevelUpdated", t.ERROR = "hlsError", t.DESTROYING = "hlsDestroying", t.KEY_LOADING = "hlsKeyLoading", t.KEY_LOADED = "hlsKeyLoaded", t.LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached", t.BACK_BUFFER_REACHED = "hlsBackBufferReached", t.STEERING_MANIFEST_LOADED = "hlsSteeringManifestLoaded", t
20806            }({}),
20807            L = function (t) {
20808                return t.NETWORK_ERROR = "networkError", t.MEDIA_ERROR = "mediaError", t.KEY_SYSTEM_ERROR = "keySystemError", t.MUX_ERROR = "muxError", t.OTHER_ERROR = "otherError", t
20809            }({}),
20810            A = function (t) {
20811                return t.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys", t.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess", t.KEY_SYSTEM_NO_SESSION = "keySystemNoSession", t.KEY_SYSTEM_NO_CONFIGURED_LICENSE = "keySystemNoConfiguredLicense", t.KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed", t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED = "keySystemServerCertificateRequestFailed", t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED = "keySystemServerCertificateUpdateFailed", t.KEY_SYSTEM_SESSION_UPDATE_FAILED = "keySystemSessionUpdateFailed", t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED = "keySystemStatusOutputRestricted", t.KEY_SYSTEM_STATUS_INTERNAL_ERROR = "keySystemStatusInternalError", t.MANIFEST_LOAD_ERROR = "manifestLoadError", t.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut", t.MANIFEST_PARSING_ERROR = "manifestParsingError", t.MANIFEST_INCOMPATIBLE_CODECS_ERROR = "manifestIncompatibleCodecsError", t.LEVEL_EMPTY_ERROR = "levelEmptyError", t.LEVEL_LOAD_ERROR = "levelLoadError", t.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut", t.LEVEL_PARSING_ERROR = "levelParsingError", t.LEVEL_SWITCH_ERROR = "levelSwitchError", t.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError", t.AUDIO_TRACK_LOAD_TIMEOUT = "audioTrackLoadTimeOut", t.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError", t.SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut", t.FRAG_LOAD_ERROR = "fragLoadError", t.FRAG_LOAD_TIMEOUT = "fragLoadTimeOut", t.FRAG_DECRYPT_ERROR = "fragDecryptError", t.FRAG_PARSING_ERROR = "fragParsingError", t.FRAG_GAP = "fragGap", t.REMUX_ALLOC_ER
vendor: 15,929 bytes, lines 20811-21113
20811ROR = "remuxAllocError", t.KEY_LOAD_ERROR = "keyLoadError", t.KEY_LOAD_TIMEOUT = "keyLoadTimeOut", t.BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError", t.BUFFER_INCOMPATIBLE_CODECS_ERROR = "bufferIncompatibleCodecsError", t.BUFFER_APPEND_ERROR = "bufferAppendError", t.BUFFER_APPENDING_ERROR = "bufferAppendingError", t.BUFFER_STALLED_ERROR = "bufferStalledError", t.BUFFER_FULL_ERROR = "bufferFullError", t.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole", t.BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall", t.INTERNAL_EXCEPTION = "internalException", t.INTERNAL_ABORTED = "aborted", t.UNKNOWN = "unknown", t
20812            }({}),
20813            R = function () {},
20814            k = {
20815                trace: R,
20816                debug: R,
20817                log: R,
20818                warn: R,
20819                info: R,
20820                error: R
20821            },
20822            b = k;
20823
20824        function D(t) {
20825            for (var e = arguments.length, r = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) r[i - 1] = arguments[i];
20826            r.forEach((function (e) {
20827                b[e] = t[e] ? t[e].bind(t) : function (t) {
20828                    var e = self.console[t];
20829                    return e ? e.bind(self.console, "[" + t + "] >") : R
20830                }(e)
20831            }))
20832        }
20833
20834        function I(t, e) {
20835            if ("object" == typeof console && !0 === t || "object" == typeof t) {
20836                D(t, "debug", "log", "info", "warn", "error");
20837                try {
20838                    b.log('Debug logs enabled for "' + e + '" in hls.js version 1.5.9')
20839                } catch (t) {
20840                    b = k
20841                }
20842            } else b = k
20843        }
20844        var w = b,
20845            C = /^(\d+)x(\d+)$/,
20846            _ = /(.+?)=(".*?"|.*?)(?:,|$)/g,
20847            x = function () {
20848                function t(e) {
20849                    "string" == typeof e && (e = t.parseAttrList(e)), o(this, e)
20850                }
20851                var e = t.prototype;
20852                return e.decimalInteger = function (t) {
20853                    var e = parseInt(this[t], 10);
20854                    return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e
20855                }, e.hexadecimalInteger = function (t) {
20856                    if (this[t]) {
20857                        var e = (this[t] || "0x").slice(2);
20858                        e = (1 & e.length ? "0" : "") + e;
20859                        for (var r = new Uint8Array(e.length / 2), i = 0; i < e.length / 2; i++) r[i] = parseInt(e.slice(2 * i, 2 * i + 2), 16);
20860                        return r
20861                    }
20862                    return null
20863                }, e.hexadecimalIntegerAsNumber = function (t) {
20864                    var e = parseInt(this[t], 16);
20865                    return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e
20866                }, e.decimalFloatingPoint = function (t) {
20867                    return parseFloat(this[t])
20868                }, e.optionalFloat = function (t, e) {
20869                    var r = this[t];
20870                    return r ? parseFloat(r) : e
20871                }, e.enumeratedString = function (t) {
20872                    return this[t]
20873                }, e.bool = function (t) {
20874                    return "YES" === this[t]
20875                }, e.decimalResolution = function (t) {
20876                    var e = C.exec(this[t]);
20877                    if (null !== e) return {
20878                        width: parseInt(e[1], 10),
20879                        height: parseInt(e[2], 10)
20880                    }
20881                }, t.parseAttrList = function (t) {
20882                    var e, r = {};
20883                    for (_.lastIndex = 0; null !== (e = _.exec(t));) {
20884                        var i = e[2];
20885                        0 === i.indexOf('"') && i.lastIndexOf('"') === i.length - 1 && (i = i.slice(1, -1)), r[e[1].trim()] = i
20886                    }
20887                    return r
20888                }, s(t, [{
20889                    key: "clientAttrs",
20890                    get: function () {
20891                        return Object.keys(this).filter((function (t) {
20892                            return "X-" === t.substring(0, 2)
20893                        }))
20894                    }
20895                }]), t
20896            }();
20897
20898        function P(t) {
20899            return "SCTE35-OUT" === t || "SCTE35-IN" === t
20900        }
20901        var F = function () {
20902                function t(t, e) {
20903                    if (this.attr = void 0, this._startDate = void 0, this._endDate = void 0, this._badValueForSameId = void 0, e) {
20904                        var r = e.attr;
20905                        for (var i in r)
20906                            if (Object.prototype.hasOwnProperty.call(t, i) && t[i] !== r[i]) {
20907                                w.warn('DATERANGE tag attribute: "' + i + '" does not match for tags with ID: "' + t.ID + '"'), this._badValueForSameId = i;
20908                                break
20909                            } t = o(new x({}), r, t)
20910                    }
20911                    if (this.attr = t, this._startDate = new Date(t["START-DATE"]), "END-DATE" in this.attr) {
20912                        var n = new Date(this.attr["END-DATE"]);
20913                        y(n.getTime()) && (this._endDate = n)
20914                    }
20915                }
20916                return s(t, [{
20917                    key: "id",
20918                    get: function () {
20919                        return this.attr.ID
20920                    }
20921                }, {
20922                    key: "class",
20923                    get: function () {
20924                        return this.attr.CLASS
20925                    }
20926                }, {
20927                    key: "startDate",
20928                    get: function () {
20929                        return this._startDate
20930                    }
20931                }, {
20932                    key: "endDate",
20933                    get: function () {
20934                        if (this._endDate) return this._endDate;
20935                        var t = this.duration;
20936                        return null !== t ? new Date(this._startDate.getTime() + 1e3 * t) : null
20937                    }
20938                }, {
20939                    key: "duration",
20940                    get: function () {
20941                        if ("DURATION" in this.attr) {
20942                            var t = this.attr.decimalFloatingPoint("DURATION");
20943                            if (y(t)) return t
20944                        } else if (this._endDate) return (this._endDate.getTime() - this._startDate.getTime()) / 1e3;
20945                        return null
20946                    }
20947                }, {
20948                    key: "plannedDuration",
20949                    get: function () {
20950                        return "PLANNED-DURATION" in this.attr ? this.attr.decimalFloatingPoint("PLANNED-DURATION") : null
20951                    }
20952                }, {
20953                    key: "endOnNext",
20954                    get: function () {
20955                        return this.attr.bool("END-ON-NEXT")
20956                    }
20957                }, {
20958                    key: "isValid",
20959                    get: function () {
20960                        return !!this.id && !this._badValueForSameId && y(this.startDate.getTime()) && (null === this.duration || this.duration >= 0) && (!this.endOnNext || !!this.class)
20961                    }
20962                }]), t
20963            }(),
20964            M = function () {
20965                this.aborted = !1, this.loaded = 0, this.retry = 0, this.total = 0, this.chunkCount = 0, this.bwEstimate = 0, this.loading = {
20966                    start: 0,
20967                    first: 0,
20968                    end: 0
20969                }, this.parsing = {
20970                    start: 0,
20971                    end: 0
20972                }, this.buffering = {
20973                    start: 0,
20974                    first: 0,
20975                    end: 0
20976                }
20977            },
20978            O = "audio",
20979            N = "video",
20980            U = "audiovideo",
20981            B = function () {
20982                function t(t) {
20983                    var e;
20984                    this._byteRange = null, this._url = null, this.baseurl = void 0, this.relurl = void 0, this.elementaryStreams = ((e = {})[O] = null, e[N] = null, e[U] = null, e), this.baseurl = t
20985                }
20986                return t.prototype.setByteRange = function (t, e) {
20987                    var r, i = t.split("@", 2);
20988                    r = 1 === i.length ? (null == e ? void 0 : e.byteRangeEndOffset) || 0 : parseInt(i[1]), this._byteRange = [r, parseInt(i[0]) + r]
20989                }, s(t, [{
20990                    key: "byteRange",
20991                    get: function () {
20992                        return this._byteRange ? this._byteRange : []
20993                    }
20994                }, {
20995                    key: "byteRangeStartOffset",
20996                    get: function () {
20997                        return this.byteRange[0]
20998                    }
20999                }, {
21000                    key: "byteRangeEndOffset",
21001                    get: function () {
21002                        return this.byteRange[1]
21003                    }
21004                }, {
21005                    key: "url",
21006                    get: function () {
21007                        return !this._url && this.baseurl && this.relurl && (this._url = p.buildAbsoluteURL(this.baseurl, this.relurl, {
21008                            alwaysNormalize: !0
21009                        })), this._url || ""
21010                    },
21011                    set: function (t) {
21012                        this._url = t
21013                    }
21014                }]), t
21015            }(),
21016            G = function (t) {
21017                function e(e, r) {
21018                    var i;
21019                    return (i = t.call(this, r) || this)._decryptdata = null, i.rawProgramDateTime = null, i.programDateTime = null, i.tagList = [], i.duration = 0, i.sn = 0, i.levelkeys = void 0, i.type = void 0, i.loader = null, i.keyLoader = null, i.level = -1, i.cc = 0, i.startPTS = void 0, i.endPTS = void 0, i.startDTS = void 0, i.endDTS = void 0, i.start = 0, i.deltaPTS = void 0, i.maxStartPTS = void 0, i.minEndPTS = void 0, i.stats = new M, i.data = void 0, i.bitrateTest = !1, i.title = null, i.initSegment = null, i.endList = void 0, i.gap = void 0, i.urlId = 0, i.type = e, i
21020                }
21021                l(e, t);
21022                var r = e.prototype;
21023                return r.setKeyFormat = function (t) {
21024                    if (this.levelkeys) {
21025                        var e = this.levelkeys[t];
21026                        e && !this._decryptdata && (this._decryptdata = e.getDecryptData(this.sn))
21027                    }
21028                }, r.abortRequests = function () {
21029                    var t, e;
21030                    null == (t = this.loader) || t.abort(), null == (e = this.keyLoader) || e.abort()
21031                }, r.setElementaryStreamInfo = function (t, e, r, i, n, a) {
21032                    void 0 === a && (a = !1);
21033                    var s = this.elementaryStreams,
21034                        o = s[t];
21035                    o ? (o.startPTS = Math.min(o.startPTS, e), o.endPTS = Math.max(o.endPTS, r), o.startDTS = Math.min(o.startDTS, i), o.endDTS = Math.max(o.endDTS, n)) : s[t] = {
21036                        startPTS: e,
21037                        endPTS: r,
21038                        startDTS: i,
21039                        endDTS: n,
21040                        partial: a
21041                    }
21042                }, r.clearElementaryStreamInfo = function () {
21043                    var t = this.elementaryStreams;
21044                    t[O] = null, t[N] = null, t[U] = null
21045                }, s(e, [{
21046                    key: "decryptdata",
21047                    get: function () {
21048                        if (!this.levelkeys && !this._decryptdata) return null;
21049                        if (!this._decryptdata && this.levelkeys && !this.levelkeys.NONE) {
21050                            var t = this.levelkeys.identity;
21051                            if (t) this._decryptdata = t.getDecryptData(this.sn);
21052                            else {
21053                                var e = Object.keys(this.levelkeys);
21054                                if (1 === e.length) return this._decryptdata = this.levelkeys[e[0]].getDecryptData(this.sn)
21055                            }
21056                        }
21057                        return this._decryptdata
21058                    }
21059                }, {
21060                    key: "end",
21061                    get: function () {
21062                        return this.start + this.duration
21063                    }
21064                }, {
21065                    key: "endProgramDateTime",
21066                    get: function () {
21067                        if (null === this.programDateTime) return null;
21068                        if (!y(this.programDateTime)) return null;
21069                        var t = y(this.duration) ? this.duration : 0;
21070                        return this.programDateTime + 1e3 * t
21071                    }
21072                }, {
21073                    key: "encrypted",
21074                    get: function () {
21075                        var t;
21076                        if (null != (t = this._decryptdata) && t.encrypted) return !0;
21077                        if (this.levelkeys) {
21078                            var e = Object.keys(this.levelkeys),
21079                                r = e.length;
21080                            if (r > 1 || 1 === r && this.levelkeys[e[0]].encrypted) return !0
21081                        }
21082                        return !1
21083                    }
21084                }]), e
21085            }(B),
21086            K = function (t) {
21087                function e(e, r, i, n, a) {
21088                    var s;
21089                    (s = t.call(this, i) || this).fragOffset = 0, s.duration = 0, s.gap = !1, s.independent = !1, s.relurl = void 0, s.fragment = void 0, s.index = void 0, s.stats = new M, s.duration = e.decimalFloatingPoint("DURATION"), s.gap = e.bool("GAP"), s.independent = e.bool("INDEPENDENT"), s.relurl = e.enumeratedString("URI"), s.fragment = r, s.index = n;
21090                    var o = e.enumeratedString("BYTERANGE");
21091                    return o && s.setByteRange(o, a), a && (s.fragOffset = a.fragOffset + a.duration), s
21092                }
21093                return l(e, t), s(e, [{
21094                    key: "start",
21095                    get: function () {
21096                        return this.fragment.start + this.fragOffset
21097                    }
21098                }, {
21099                    key: "end",
21100                    get: function () {
21101                        return this.start + this.duration
21102                    }
21103                }, {
21104                    key: "loaded",
21105                    get: function () {
21106                        var t = this.elementaryStreams;
21107                        return !!(t.audio || t.video || t.audiovideo)
21108                    }
21109                }]), e
21110            }(B),
21111            H = function () {
21112                function t(t) {
21113                    this.PTSKnown = !1, this.alignedSliding = !1, this.averagetargetduration = void 0, this.endCC = 0, this.endSN = 0, this.fragments = void 0, this.fragmentHint = void 0, this.partList = null, this.dateRanges = void 0, this.live = !0, this.ageHeader = 0, this.advancedDateTime = void 0, this.updated = !0, this.advanced = !0, this.availabilityDelay = void 0, this.misses = 0, this.startCC = 0, this.startSN = 0, this.startTimeOffset = null, this.targetduration = 0, this.totalduration = 0, this.type = null, this.url = void 0, this.m3u8 = "", this.version = null, this.canBlockReload = !1, this.canSkipUntil = 0, this.canSkipDateRanges = !1, this.skippedSegments = 0, this.recentlyRemovedDateranges = void 0, this.partHoldBack = 0, this.holdBack = 0, this.partTarget = 0, this.preloadHint = void 0, this.renditionReports = void 0, this.tuneInGoal = 0, this.deltaUpdateFailed = void 0, this.drift
vendor: 10,514 bytes, lines 21113-21359
21113StartTime = 0, this.driftEndTime = 0, this.driftStart = 0, this.driftEnd = 0, this.encryptedFragments = void 0, this.playlistParsingError = null, this.variableList = null, this.hasVariableRefs = !1, this.fragments = [], this.encryptedFragments = [], this.dateRanges = {}, this.url = t
21114                }
21115                return t.prototype.reloaded = function (t) {
21116                    if (!t) return this.advanced = !0, void(this.updated = !0);
21117                    var e = this.lastPartSn - t.lastPartSn,
21118                        r = this.lastPartIndex - t.lastPartIndex;
21119                    this.updated = this.endSN !== t.endSN || !!r || !!e || !this.live, this.advanced = this.endSN > t.endSN || e > 0 || 0 === e && r > 0, this.updated || this.advanced ? this.misses = Math.floor(.6 * t.misses) : this.misses = t.misses + 1, this.availabilityDelay = t.availabilityDelay
21120                }, s(t, [{
21121                    key: "hasProgramDateTime",
21122                    get: function () {
21123                        return !!this.fragments.length && y(this.fragments[this.fragments.length - 1].programDateTime)
21124                    }
21125                }, {
21126                    key: "levelTargetDuration",
21127                    get: function () {
21128                        return this.averagetargetduration || this.targetduration || 10
21129                    }
21130                }, {
21131                    key: "drift",
21132                    get: function () {
21133                        var t = this.driftEndTime - this.driftStartTime;
21134                        return t > 0 ? 1e3 * (this.driftEnd - this.driftStart) / t : 1
21135                    }
21136                }, {
21137                    key: "edge",
21138                    get: function () {
21139                        return this.partEnd || this.fragmentEnd
21140                    }
21141                }, {
21142                    key: "partEnd",
21143                    get: function () {
21144                        var t;
21145                        return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].end : this.fragmentEnd
21146                    }
21147                }, {
21148                    key: "fragmentEnd",
21149                    get: function () {
21150                        var t;
21151                        return null != (t = this.fragments) && t.length ? this.fragments[this.fragments.length - 1].end : 0
21152                    }
21153                }, {
21154                    key: "age",
21155                    get: function () {
21156                        return this.advancedDateTime ? Math.max(Date.now() - this.advancedDateTime, 0) / 1e3 : 0
21157                    }
21158                }, {
21159                    key: "lastPartIndex",
21160                    get: function () {
21161                        var t;
21162                        return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].index : -1
21163                    }
21164                }, {
21165                    key: "lastPartSn",
21166                    get: function () {
21167                        var t;
21168                        return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].fragment.sn : this.endSN
21169                    }
21170                }]), t
21171            }();
21172
21173        function V(t) {
21174            return Uint8Array.from(atob(t), (function (t) {
21175                return t.charCodeAt(0)
21176            }))
21177        }
21178
21179        function Y(t) {
21180            var e, r, i = t.split(":"),
21181                n = null;
21182            if ("data" === i[0] && 2 === i.length) {
21183                var a = i[1].split(";"),
21184                    s = a[a.length - 1].split(",");
21185                if (2 === s.length) {
21186                    var o = "base64" === s[0],
21187                        l = s[1];
21188                    o ? (a.splice(-1, 1), n = V(l)) : (e = W(l).subarray(0, 16), (r = new Uint8Array(16)).set(e, 16 - e.length), n = r)
21189                }
21190            }
21191            return n
21192        }
21193
21194        function W(t) {
21195            return Uint8Array.from(unescape(encodeURIComponent(t)), (function (t) {
21196                return t.charCodeAt(0)
21197            }))
21198        }
21199        var j = "undefined" != typeof self ? self : void 0,
21200            q = {
21201                CLEARKEY: "org.w3.clearkey",
21202                FAIRPLAY: "com.apple.fps",
21203                PLAYREADY: "com.microsoft.playready",
21204                WIDEVINE: "com.widevine.alpha"
21205            },
21206            X = "org.w3.clearkey",
21207            z = "com.apple.streamingkeydelivery",
21208            Q = "com.microsoft.playready",
21209            J = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
21210
21211        function $(t) {
21212            switch (t) {
21213            case z:
21214                return q.FAIRPLAY;
21215            case Q:
21216                return q.PLAYREADY;
21217            case J:
21218                return q.WIDEVINE;
21219            case X:
21220                return q.CLEARKEY
21221            }
21222        }
21223        var Z = "edef8ba979d64acea3c827dcd51d21ed";
21224
21225        function tt(t) {
21226            switch (t) {
21227            case q.FAIRPLAY:
21228                return z;
21229            case q.PLAYREADY:
21230                return Q;
21231            case q.WIDEVINE:
21232                return J;
21233            case q.CLEARKEY:
21234                return X
21235            }
21236        }
21237
21238        function et(t) {
21239            var e = t.drmSystems,
21240                r = t.widevineLicenseUrl,
21241                i = e ? [q.FAIRPLAY, q.WIDEVINE, q.PLAYREADY, q.CLEARKEY].filter((function (t) {
21242                    return !!e[t]
21243                })) : [];
21244            return !i[q.WIDEVINE] && r && i.push(q.WIDEVINE), i
21245        }
21246        var rt, it = null != j && null != (rt = j.navigator) && rt.requestMediaKeySystemAccess ? self.navigator.requestMediaKeySystemAccess.bind(self.navigator) : null;
21247
21248        function nt(t, e, r) {
21249            return Uint8Array.prototype.slice ? t.slice(e, r) : new Uint8Array(Array.prototype.slice.call(t, e, r))
21250        }
21251        var at, st = function (t, e) {
21252                return e + 10 <= t.length && 73 === t[e] && 68 === t[e + 1] && 51 === t[e + 2] && t[e + 3] < 255 && t[e + 4] < 255 && t[e + 6] < 128 && t[e + 7] < 128 && t[e + 8] < 128 && t[e + 9] < 128
21253            },
21254            ot = function (t, e) {
21255                return e + 10 <= t.length && 51 === t[e] && 68 === t[e + 1] && 73 === t[e + 2] && t[e + 3] < 255 && t[e + 4] < 255 && t[e + 6] < 128 && t[e + 7] < 128 && t[e + 8] < 128 && t[e + 9] < 128
21256            },
21257            lt = function (t, e) {
21258                for (var r = e, i = 0; st(t, e);) i += 10, i += ut(t, e + 6), ot(t, e + 10) && (i += 10), e += i;
21259                if (i > 0) return t.subarray(r, r + i)
21260            },
21261            ut = function (t, e) {
21262                var r = 0;
21263                return r = (127 & t[e]) << 21, r |= (127 & t[e + 1]) << 14, r |= (127 & t[e + 2]) << 7, r |= 127 & t[e + 3]
21264            },
21265            ht = function (t, e) {
21266                return st(t, e) && ut(t, e + 6) + 10 <= t.length - e
21267            },
21268            dt = function (t) {
21269                for (var e = gt(t), r = 0; r < e.length; r++) {
21270                    var i = e[r];
21271                    if (ct(i)) return Et(i)
21272                }
21273            },
21274            ct = function (t) {
21275                return t && "PRIV" === t.key && "com.apple.streaming.transportStreamTimestamp" === t.info
21276            },
21277            ft = function (t) {
21278                var e = String.fromCharCode(t[0], t[1], t[2], t[3]),
21279                    r = ut(t, 4);
21280                return {
21281                    type: e,
21282                    size: r,
21283                    data: t.subarray(10, 10 + r)
21284                }
21285            },
21286            gt = function (t) {
21287                for (var e = 0, r = []; st(t, e);) {
21288                    for (var i = ut(t, e + 6), n = (e += 10) + i; e + 8 < n;) {
21289                        var a = ft(t.subarray(e)),
21290                            s = vt(a);
21291                        s && r.push(s), e += a.size + 10
21292                    }
21293                    ot(t, e) && (e += 10)
21294                }
21295                return r
21296            },
21297            vt = function (t) {
21298                return "PRIV" === t.type ? mt(t) : "W" === t.type[0] ? yt(t) : pt(t)
21299            },
21300            mt = function (t) {
21301                if (!(t.size < 2)) {
21302                    var e = Tt(t.data, !0),
21303                        r = new Uint8Array(t.data.subarray(e.length + 1));
21304                    return {
21305                        key: t.type,
21306                        info: e,
21307                        data: r.buffer
21308                    }
21309                }
21310            },
21311            pt = function (t) {
21312                if (!(t.size < 2)) {
21313                    if ("TXXX" === t.type) {
21314                        var e = 1,
21315                            r = Tt(t.data.subarray(e), !0);
21316                        e += r.length + 1;
21317                        var i = Tt(t.data.subarray(e));
21318                        return {
21319                            key: t.type,
21320                            info: r,
21321                            data: i
21322                        }
21323                    }
21324                    var n = Tt(t.data.subarray(1));
21325                    return {
21326                        key: t.type,
21327                        data: n
21328                    }
21329                }
21330            },
21331            yt = function (t) {
21332                if ("WXXX" === t.type) {
21333                    if (t.size < 2) return;
21334                    var e = 1,
21335                        r = Tt(t.data.subarray(e), !0);
21336                    e += r.length + 1;
21337                    var i = Tt(t.data.subarray(e));
21338                    return {
21339                        key: t.type,
21340                        info: r,
21341                        data: i
21342                    }
21343                }
21344                var n = Tt(t.data);
21345                return {
21346                    key: t.type,
21347                    data: n
21348                }
21349            },
21350            Et = function (t) {
21351                if (8 === t.data.byteLength) {
21352                    var e = new Uint8Array(t.data),
21353                        r = 1 & e[3],
21354                        i = (e[4] << 23) + (e[5] << 15) + (e[6] << 7) + e[7];
21355                    return i /= 45, r && (i += 47721858.84), Math.round(i)
21356                }
21357            },
21358            Tt = function (t, e) {
21359                void 0 === e && (e = !1);
21360                var r = St();
21361                if (r) {
21362                    var i = r.decode(t);
21363                    if (e) {
21364                        var n = i.indexOf("\0");
21365                        return -1 !== n ? i.substring(0, n) : i
21366                    }
21367                    return i.replace(/\0/g, "")
21368                }
21369                for (var a, s, o, l = t.length, u = "", h = 0; h < l;) {
21370                    if (0 === (a = t[h++]) && e) return u;
21371                    if (0 !== a && 3 !== a) switch (a >> 4) {
21372                    case 0:
21373                    case 1:
21374                    case 2:
21375                    case 3:
21376                    case 4:
21377                    case 5:
21378                    case 6:
21379                    case 7:
21380                        u += String.fromCharCode(a);
21381                        break;
21382                    case 12:
21383                    case 13:
21384                        s = t[h++], u += String.fromCharCode((31 & a) << 6 | 63 & s);
21385                        break;
21386                    case 14:
21387                        s = t[h++], o = t[h++], u += String.fromCharCode((15 & a) << 12 | (63 & s) << 6 | (63 & o) << 0)
21388                    }
21389                }
21390                return u
21391            };
21392
21393        function St() {
21394            if (!navigator.userAgent.includes("PlayStation 4")) return at || void 0 === self.TextDecoder || (at = new self.TextDecoder("utf-8")), at
21395        }
21396        var Lt = function (t) {
21397                for (var e = "", r = 0; r < t.length; r++) {
21398                    var i = t[r].toString(16);
21399                    i.length < 2 && (i = "0" + i), e += i
21400                }
21401                return e
21402            },
21403            At = Math.pow(2, 32) - 1,
21404            Rt = [].push,
21405            kt = {
21406                video: 1,
21407                audio: 2,
21408                id3: 3,
21409                text: 4
21410            };
21411
21412        function bt(t) {
21413            return String.fromCharCode.apply(null, t)
21414        }
21415
21416        function Dt(t, e) {
21417            var r = t[e] << 8 | t[e + 1];
21418            return r < 0 ? 65536 + r : r
21419        }
21420
21421        function It(t, e) {
21422            var r = Ct(t, e);
21423            return r < 0 ? 4294967296 + r : r
21424        }
21425
21426        function wt(t, e) {
21427            var r = It(t, e);
21428            return r *= Math.pow(2, 32), r += It(t, e + 4)
21429        }
21430
21431        function Ct(t, e) {
21432            return t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]
21433        }
21434
21435        function _t(t, e, r) {
21436            t[e] = r >> 24, t[e + 1] = r >> 16 & 255, t[e + 2] = r >> 8 & 255, t[e + 3] = 255 & r
21437        }
21438
21439        function xt(t, e) {
21440            var r = [];
21441            if (!e.length) return r;
21442            for (var i = t.byteLength, n = 0; n < i;) {
21443                var a = It(t, n),
21444                    s = a > 1 ? n + a : i;
21445                if (bt(t.subarray(n + 4, n + 8)) === e[0])
vendor: 7,311 bytes, lines 21446-21637
21446                    if (1 === e.length) r.push(t.subarray(n + 8, s));
21447                    else {
21448                        var o = xt(t.subarray(n + 8, s), e.slice(1));
21449                        o.length && Rt.apply(r, o)
21450                    } n = s
21451            }
21452            return r
21453        }
21454
21455        function Pt(t) {
21456            var e = [],
21457                r = t[0],
21458                i = 8,
21459                n = It(t, i);
21460            i += 4;
21461            var a = 0,
21462                s = 0;
21463            0 === r ? (a = It(t, i), s = It(t, i + 4), i += 8) : (a = wt(t, i), s = wt(t, i + 8), i += 16), i += 2;
21464            var o = t.length + s,
21465                l = Dt(t, i);
21466            i += 2;
21467            for (var u = 0; u < l; u++) {
21468                var h = i,
21469                    d = It(t, h);
21470                h += 4;
21471                var c = 2147483647 & d;
21472                if (1 == (2147483648 & d) >>> 31) return w.warn("SIDX has hierarchical references (not supported)"), null;
21473                var f = It(t, h);
21474                h += 4, e.push({
21475                    referenceSize: c,
21476                    subsegmentDuration: f,
21477                    info: {
21478                        duration: f / n,
21479                        start: o,
21480                        end: o + c - 1
21481                    }
21482                }), o += c, i = h += 4
21483            }
21484            return {
21485                earliestPresentationTime: a,
21486                timescale: n,
21487                version: r,
21488                referencesCount: l,
21489                references: e
21490            }
21491        }
21492
21493        function Ft(t) {
21494            for (var e = [], r = xt(t, ["moov", "trak"]), n = 0; n < r.length; n++) {
21495                var a = r[n],
21496                    s = xt(a, ["tkhd"])[0];
21497                if (s) {
21498                    var o = s[0],
21499                        l = It(s, 0 === o ? 12 : 20),
21500                        u = xt(a, ["mdia", "mdhd"])[0];
21501                    if (u) {
21502                        var h = It(u, 0 === (o = u[0]) ? 12 : 20),
21503                            d = xt(a, ["mdia", "hdlr"])[0];
21504                        if (d) {
21505                            var c = bt(d.subarray(8, 12)),
21506                                f = {
21507                                    soun: O,
21508                                    vide: N
21509                                } [c];
21510                            if (f) {
21511                                var g = Mt(xt(a, ["mdia", "minf", "stbl", "stsd"])[0]);
21512                                e[l] = {
21513                                    timescale: h,
21514                                    type: f
21515                                }, e[f] = i({
21516                                    timescale: h,
21517                                    id: l
21518                                }, g)
21519                            }
21520                        }
21521                    }
21522                }
21523            }
21524            return xt(t, ["moov", "mvex", "trex"]).forEach((function (t) {
21525                var r = It(t, 4),
21526                    i = e[r];
21527                i && (i.default = {
21528                    duration: It(t, 12),
21529                    flags: It(t, 20)
21530                })
21531            })), e
21532        }
21533
21534        function Mt(t) {
21535            var e = t.subarray(8),
21536                r = e.subarray(86),
21537                i = bt(e.subarray(4, 8)),
21538                n = i,
21539                a = "enca" === i || "encv" === i;
21540            if (a) {
21541                var s = xt(e, [i])[0];
21542                xt(s.subarray("enca" === i ? 28 : 78), ["sinf"]).forEach((function (t) {
21543                    var e = xt(t, ["schm"])[0];
21544                    if (e) {
21545                        var r = bt(e.subarray(4, 8));
21546                        if ("cbcs" === r || "cenc" === r) {
21547                            var i = xt(t, ["frma"])[0];
21548                            i && (n = bt(i))
21549                        }
21550                    }
21551                }))
21552            }
21553            switch (n) {
21554            case "avc1":
21555            case "avc2":
21556            case "avc3":
21557            case "avc4":
21558                var o = xt(r, ["avcC"])[0];
21559                n += "." + Nt(o[1]) + Nt(o[2]) + Nt(o[3]);
21560                break;
21561            case "mp4a":
21562                var l = xt(e, [i])[0],
21563                    u = xt(l.subarray(28), ["esds"])[0];
21564                if (u && u.length > 12) {
21565                    var h = 4;
21566                    if (3 !== u[h++]) break;
21567                    h = Ot(u, h), h += 2;
21568                    var d = u[h++];
21569                    if (128 & d && (h += 2), 64 & d && (h += u[h++]), 4 !== u[h++]) break;
21570                    h = Ot(u, h);
21571                    var c = u[h++];
21572                    if (64 !== c) break;
21573                    if (n += "." + Nt(c), h += 12, 5 !== u[h++]) break;
21574                    h = Ot(u, h);
21575                    var f = u[h++],
21576                        g = (248 & f) >> 3;
21577                    31 === g && (g += 1 + ((7 & f) << 3) + ((224 & u[h]) >> 5)), n += "." + g
21578                }
21579                break;
21580            case "hvc1":
21581            case "hev1":
21582                var v = xt(r, ["hvcC"])[0],
21583                    m = v[1],
21584                    p = ["", "A", "B", "C"][m >> 6],
21585                    y = 31 & m,
21586                    E = It(v, 2),
21587                    T = (32 & m) >> 5 ? "H" : "L",
21588                    S = v[12],
21589                    L = v.subarray(6, 12);
21590                n += "." + p + y, n += "." + E.toString(16).toUpperCase(), n += "." + T + S;
21591                for (var A = "", R = L.length; R--;) {
21592                    var k = L[R];
21593                    (k || A) && (A = "." + k.toString(16).toUpperCase() + A)
21594                }
21595                n += A;
21596                break;
21597            case "dvh1":
21598            case "dvhe":
21599                var b = xt(r, ["dvcC"])[0],
21600                    D = b[2] >> 1 & 127,
21601                    I = b[2] << 5 & 32 | b[3] >> 3 & 31;
21602                n += "." + Ut(D) + "." + Ut(I);
21603                break;
21604            case "vp09":
21605                var w = xt(r, ["vpcC"])[0],
21606                    C = w[4],
21607                    _ = w[5],
21608                    x = w[6] >> 4 & 15;
21609                n += "." + Ut(C) + "." + Ut(_) + "." + Ut(x);
21610                break;
21611            case "av01":
21612                var P = xt(r, ["av1C"])[0],
21613                    F = P[1] >>> 5,
21614                    M = 31 & P[1],
21615                    O = P[2] >>> 7 ? "H" : "M",
21616                    N = (64 & P[2]) >> 6,
21617                    U = (32 & P[2]) >> 5,
21618                    B = 2 === F && N ? U ? 12 : 10 : N ? 10 : 8,
21619                    G = (16 & P[2]) >> 4,
21620                    K = (8 & P[2]) >> 3,
21621                    H = (4 & P[2]) >> 2,
21622                    V = 3 & P[2];
21623                n += "." + F + "." + Ut(M) + O + "." + Ut(B) + "." + G + "." + K + H + V + "." + Ut(1) + "." + Ut(1) + "." + Ut(1) + ".0"
21624            }
21625            return {
21626                codec: n,
21627                encrypted: a
21628            }
21629        }
21630
21631        function Ot(t, e) {
21632            for (var r = e + 5; 128 & t[e++] && e < r;);
21633            return e
21634        }
21635
21636        function Nt(t) {
21637            return ("0" 
vendor: 45,252 bytes, lines 21637-22562
21637+ t.toString(16).toUpperCase()).slice(-2)
21638        }
21639
21640        function Ut(t) {
21641            return (t < 10 ? "0" : "") + t
21642        }
21643
21644        function Bt(t) {
21645            var e = xt(t, ["schm"])[0];
21646            if (e) {
21647                var r = bt(e.subarray(4, 8));
21648                if ("cbcs" === r || "cenc" === r) return xt(t, ["schi", "tenc"])[0]
21649            }
21650            return w.error("[eme] missing 'schm' box"), null
21651        }
21652
21653        function Gt(t) {
21654            var e = It(t, 0),
21655                r = 8;
21656            1 & e && (r += 4), 4 & e && (r += 4);
21657            for (var i = 0, n = It(t, 4), a = 0; a < n; a++) 256 & e && (i += It(t, r), r += 4), 512 & e && (r += 4), 1024 & e && (r += 4), 2048 & e && (r += 4);
21658            return i
21659        }
21660
21661        function Kt(t, e) {
21662            var r = new Uint8Array(t.length + e.length);
21663            return r.set(t), r.set(e, t.length), r
21664        }
21665
21666        function Ht(t, e) {
21667            var r = [],
21668                i = e.samples,
21669                n = e.timescale,
21670                a = e.id,
21671                s = !1;
21672            return xt(i, ["moof"]).map((function (o) {
21673                var l = o.byteOffset - 8;
21674                xt(o, ["traf"]).map((function (o) {
21675                    var u = xt(o, ["tfdt"]).map((function (t) {
21676                        var e = t[0],
21677                            r = It(t, 4);
21678                        return 1 === e && (r *= Math.pow(2, 32), r += It(t, 8)), r / n
21679                    }))[0];
21680                    return void 0 !== u && (t = u), xt(o, ["tfhd"]).map((function (u) {
21681                        var h = It(u, 4),
21682                            d = 16777215 & It(u, 0),
21683                            c = 0,
21684                            f = 0 != (16 & d),
21685                            g = 0,
21686                            v = 0 != (32 & d),
21687                            m = 8;
21688                        h === a && (0 != (1 & d) && (m += 8), 0 != (2 & d) && (m += 4), 0 != (8 & d) && (c = It(u, m), m += 4), f && (g = It(u, m), m += 4), v && (m += 4), "video" === e.type && (s = function (t) {
21689                            if (!t) return !1;
21690                            var e = t.indexOf("."),
21691                                r = e < 0 ? t : t.substring(0, e);
21692                            return "hvc1" === r || "hev1" === r || "dvh1" === r || "dvhe" === r
21693                        }(e.codec)), xt(o, ["trun"]).map((function (a) {
21694                            var o = a[0],
21695                                u = 16777215 & It(a, 0),
21696                                h = 0 != (1 & u),
21697                                d = 0,
21698                                f = 0 != (4 & u),
21699                                v = 0 != (256 & u),
21700                                m = 0,
21701                                p = 0 != (512 & u),
21702                                y = 0,
21703                                E = 0 != (1024 & u),
21704                                T = 0 != (2048 & u),
21705                                S = 0,
21706                                L = It(a, 4),
21707                                A = 8;
21708                            h && (d = It(a, A), A += 4), f && (A += 4);
21709                            for (var R = d + l, k = 0; k < L; k++) {
21710                                if (v ? (m = It(a, A), A += 4) : m = c, p ? (y = It(a, A), A += 4) : y = g, E && (A += 4), T && (S = 0 === o ? It(a, A) : Ct(a, A), A += 4), e.type === N)
21711                                    for (var b = 0; b < y;) {
21712                                        var D = It(i, R);
21713                                        Vt(s, i[R += 4]) && Yt(i.subarray(R, R + D), s ? 2 : 1, t + S / n, r), R += D, b += D + 4
21714                                    }
21715                                t += m / n
21716                            }
21717                        })))
21718                    }))
21719                }))
21720            })), r
21721        }
21722
21723        function Vt(t, e) {
21724            if (t) {
21725                var r = e >> 1 & 63;
21726                return 39 === r || 40 === r
21727            }
21728            return 6 == (31 & e)
21729        }
21730
21731        function Yt(t, e, r, i) {
21732            var n = Wt(t),
21733                a = 0;
21734            a += e;
21735            for (var s = 0, o = 0, l = 0; a < n.length;) {
21736                s = 0;
21737                do {
21738                    if (a >= n.length) break;
21739                    s += l = n[a++]
21740                } while (255 === l);
21741                o = 0;
21742                do {
21743                    if (a >= n.length) break;
21744                    o += l = n[a++]
21745                } while (255 === l);
21746                var u = n.length - a,
21747                    h = a;
21748                if (o < u) a += o;
21749                else if (o > u) {
21750                    w.error("Malformed SEI payload. " + o + " is too small, only " + u + " bytes left to parse.");
21751                    break
21752                }
21753                if (4 === s) {
21754                    if (181 === n[h++]) {
21755                        var d = Dt(n, h);
21756                        if (h += 2, 49 === d) {
21757                            var c = It(n, h);
21758                            if (h += 4, 1195456820 === c) {
21759                                var f = n[h++];
21760                                if (3 === f) {
21761                                    var g = n[h++],
21762                                        v = 64 & g,
21763                                        m = v ? 2 + 3 * (31 & g) : 0,
21764                                        p = new Uint8Array(m);
21765                                    if (v) {
21766                                        p[0] = g;
21767                                        for (var y = 1; y < m; y++) p[y] = n[h++]
21768                                    }
21769                                    i.push({
21770                                        type: f,
21771                                        payloadType: s,
21772                                        pts: r,
21773                                        bytes: p
21774                                    })
21775                                }
21776                            }
21777                        }
21778                    }
21779                } else if (5 === s && o > 16) {
21780                    for (var E = [], T = 0; T < 16; T++) {
21781                        var S = n[h++].toString(16);
21782                        E.push(1 == S.length ? "0" + S : S), 3 !== T && 5 !== T && 7 !== T && 9 !== T || E.push("-")
21783                    }
21784                    for (var L = o - 16, A = new Uint8Array(L), R = 0; R < L; R++) A[R] = n[h++];
21785                    i.push({
21786                        payloadType: s,
21787                        pts: r,
21788                        uuid: E.join(""),
21789                        userData: Tt(A),
21790                        userDataBytes: A
21791                    })
21792                }
21793            }
21794        }
21795
21796        function Wt(t) {
21797            for (var e = t.byteLength, r = [], i = 1; i < e - 2;) 0 === t[i] && 0 === t[i + 1] && 3 === t[i + 2] ? (r.push(i + 2), i += 2) : i++;
21798            if (0 === r.length) return t;
21799            var n = e - r.length,
21800                a = new Uint8Array(n),
21801                s = 0;
21802            for (i = 0; i < n; s++, i++) s === r[0] && (s++, r.shift()), a[i] = t[s];
21803            return a
21804        }
21805
21806        function jt(t, e, r) {
21807            if (16 !== t.byteLength) throw new RangeError("Invalid system id");
21808            var i, n, a;
21809            if (e) {
21810                i = 1, n = new Uint8Array(16 * e.length);
21811                for (var s = 0; s < e.length; s++) {
21812                    var o = e[s];
21813                    if (16 !== o.byteLength) throw new RangeError("Invalid key");
21814                    n.set(o, 16 * s)
21815                }
21816            } else i = 0, n = new Uint8Array;
21817            i > 0 ? (a = new Uint8Array(4), e.length > 0 && new DataView(a.buffer).setUint32(0, e.length, !1)) : a = new Uint8Array;
21818            var l = new Uint8Array(4);
21819            return r && r.byteLength > 0 && new DataView(l.buffer).setUint32(0, r.byteLength, !1),
21820                function (t) {
21821                    for (var e = arguments.length, r = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) r[i - 1] = arguments[i];
21822                    for (var n = r.length, a = 8, s = n; s--;) a += r[s].byteLength;
21823                    var o = new Uint8Array(a);
21824                    for (o[0] = a >> 24 & 255, o[1] = a >> 16 & 255, o[2] = a >> 8 & 255, o[3] = 255 & a, o.set(t, 4), s = 0, a = 8; s < n; s++) o.set(r[s], a), a += r[s].byteLength;
21825                    return o
21826                }([112, 115, 115, 104], new Uint8Array([i, 0, 0, 0]), t, a, n, l, r || new Uint8Array)
21827        }
21828        var qt = {},
21829            Xt = function () {
21830                function t(t, e, r, i, n) {
21831                    void 0 === i && (i = [1]), void 0 === n && (n = null), this.uri = void 0, this.method = void 0, this.keyFormat = void 0, this.keyFormatVersions = void 0, this.encrypted = void 0, this.isCommonEncryption = void 0, this.iv = null, this.key = null, this.keyId = null, this.pssh = null, this.method = t, this.uri = e, this.keyFormat = r, this.keyFormatVersions = i, this.iv = n, this.encrypted = !!t && "NONE" !== t, this.isCommonEncryption = this.encrypted && "AES-128" !== t
21832                }
21833                t.clearKeyUriToKeyIdMap = function () {
21834                    qt = {}
21835                };
21836                var e = t.prototype;
21837                return e.isSupported = function () {
21838                    if (this.method) {
21839                        if ("AES-128" === this.method || "NONE" === this.method) return !0;
21840                        if ("identity" === this.keyFormat) return "SAMPLE-AES" === this.method;
21841                        switch (this.keyFormat) {
21842                        case z:
21843                        case J:
21844                        case Q:
21845                        case X:
21846                            return -1 !== ["ISO-23001-7", "SAMPLE-AES", "SAMPLE-AES-CENC", "SAMPLE-AES-CTR"].indexOf(this.method)
21847                        }
21848                    }
21849                    return !1
21850                }, e.getDecryptData = function (e) {
21851                    if (!this.encrypted || !this.uri) return null;
21852                    if ("AES-128" === this.method && this.uri && !this.iv) {
21853                        "number" != typeof e && ("AES-128" !== this.method || this.iv || w.warn('missing IV for initialization segment with method="' + this.method + '" - compliance issue'), e = 0);
21854                        var r = function (t) {
21855                            for (var e = new Uint8Array(16), r = 12; r < 16; r++) e[r] = t >> 8 * (15 - r) & 255;
21856                            return e
21857                        }(e);
21858                        return new t(this.method, this.uri, "identity", this.keyFormatVersions, r)
21859                    }
21860                    var i = Y(this.uri);
21861                    if (i) switch (this.keyFormat) {
21862                    case J:
21863                        this.pssh = i, i.length >= 22 && (this.keyId = i.subarray(i.length - 22, i.length - 6));
21864                        break;
21865                    case Q:
21866                        var n = new Uint8Array([154, 4, 240, 121, 152, 64, 66, 134, 171, 146, 230, 91, 224, 136, 95, 149]);
21867                        this.pssh = jt(n, null, i);
21868                        var a = new Uint16Array(i.buffer, i.byteOffset, i.byteLength / 2),
21869                            s = String.fromCharCode.apply(null, Array.from(a)),
21870                            o = s.substring(s.indexOf("<"), s.length),
21871                            l = (new DOMParser).parseFromString(o, "text/xml").getElementsByTagName("KID")[0];
21872                        if (l) {
21873                            var u = l.childNodes[0] ? l.childNodes[0].nodeValue : l.getAttribute("VALUE");
21874                            if (u) {
21875                                var h = V(u).subarray(0, 16);
21876                                ! function (t) {
21877                                    var e = function (t, e, r) {
21878                                        var i = t[e];
21879                                        t[e] = t[r], t[r] = i
21880                                    };
21881                                    e(t, 0, 3), e(t, 1, 2), e(t, 4, 5), e(t, 6, 7)
21882                                }(h), this.keyId = h
21883                            }
21884                        }
21885                        break;
21886                    default:
21887                        var d = i.subarray(0, 16);
21888                        if (16 !== d.length) {
21889                            var c = new Uint8Array(16);
21890                            c.set(d, 16 - d.length), d = c
21891                        }
21892                        this.keyId = d
21893                    }
21894                    if (!this.keyId || 16 !== this.keyId.byteLength) {
21895                        var f = qt[this.uri];
21896                        if (!f) {
21897                            var g = Object.keys(qt).length % Number.MAX_SAFE_INTEGER;
21898                            f = new Uint8Array(16), new DataView(f.buffer, 12, 4).setUint32(0, g), qt[this.uri] = f
21899                        }
21900                        this.keyId = f
21901                    }
21902                    return this
21903                }, t
21904            }(),
21905            zt = /\{\$([a-zA-Z0-9-_]+)\}/g;
21906
21907        function Qt(t) {
21908            return zt.test(t)
21909        }
21910
21911        function Jt(t, e, r) {
21912            if (null !== t.variableList || t.hasVariableRefs)
21913                for (var i = r.length; i--;) {
21914                    var n = r[i],
21915                        a = e[n];
21916                    a && (e[n] = $t(t, a))
21917                }
21918        }
21919
21920        function $t(t, e) {
21921            if (null !== t.variableList || t.hasVariableRefs) {
21922                var r = t.variableList;
21923                return e.replace(zt, (function (e) {
21924                    var i = e.substring(2, e.length - 1),
21925                        n = null == r ? void 0 : r[i];
21926                    return void 0 === n ? (t.playlistParsingError || (t.playlistParsingError = new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "' + i + '"')), e) : n
21927                }))
21928            }
21929            return e
21930        }
21931
21932        function Zt(t, e, r) {
21933            var i, n, a = t.variableList;
21934            if (a || (t.variableList = a = {}), "QUERYPARAM" in e) {
21935                i = e.QUERYPARAM;
21936                try {
21937                    var s = new self.URL(r).searchParams;
21938                    if (!s.has(i)) throw new Error('"' + i + '" does not match any query parameter in URI: "' + r + '"');
21939                    n = s.get(i)
21940                } catch (e) {
21941                    t.playlistParsingError || (t.playlistParsingError = new Error("EXT-X-DEFINE QUERYPARAM: " + e.message))
21942                }
21943            } else i = e.NAME, n = e.VALUE;
21944            i in a ? t.playlistParsingError || (t.playlistParsingError = new Error('EXT-X-DEFINE duplicate Variable Name declarations: "' + i + '"')) : a[i] = n || ""
21945        }
21946
21947        function te(t, e, r) {
21948            var i = e.IMPORT;
21949            if (r && i in r) {
21950                var n = t.variableList;
21951                n || (t.variableList = n = {}), n[i] = r[i]
21952            } else t.playlistParsingError || (t.playlistParsingError = new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "' + i + '"'))
21953        }
21954
21955        function ee(t) {
21956            if (void 0 === t && (t = !0), "undefined" != typeof self) return (t || !self.MediaSource) && self.ManagedMediaSource || self.MediaSource || self.WebKitMediaSource
21957        }
21958        var re = {
21959            audio: {
21960                a3ds: 1,
21961                "ac-3": .95,
21962                "ac-4": 1,
21963                alac: .9,
21964                alaw: 1,
21965                dra1: 1,
21966                "dts+": 1,
21967                "dts-": 1,
21968                dtsc: 1,
21969                dtse: 1,
21970                dtsh: 1,
21971                "ec-3": .9,
21972                enca: 1,
21973                fLaC: .9,
21974                flac: .9,
21975                FLAC: .9,
21976                g719: 1,
21977                g726: 1,
21978                m4ae: 1,
21979                mha1: 1,
21980                mha2: 1,
21981                mhm1: 1,
21982                mhm2: 1,
21983                mlpa: 1,
21984                mp4a: 1,
21985                "raw ": 1,
21986                Opus: 1,
21987                opus: 1,
21988                samr: 1,
21989                sawb: 1,
21990                sawp: 1,
21991                sevc: 1,
21992                sqcp: 1,
21993                ssmv: 1,
21994                twos: 1,
21995                ulaw: 1
21996            },
21997            video: {
21998                avc1: 1,
21999                avc2: 1,
22000                avc3: 1,
22001                avc4: 1,
22002                avcp: 1,
22003                av01: .8,
22004                drac: 1,
22005                dva1: 1,
22006                dvav: 1,
22007                dvh1: .7,
22008                dvhe: .7,
22009                encv: 1,
22010                hev1: .75,
22011                hvc1: .75,
22012                mjp2: 1,
22013                mp4v: 1,
22014                mvc1: 1,
22015                mvc2: 1,
22016                mvc3: 1,
22017                mvc4: 1,
22018                resv: 1,
22019                rv60: 1,
22020                s263: 1,
22021                svc1: 1,
22022                svc2: 1,
22023                "vc-1": 1,
22024                vp08: 1,
22025                vp09: .9
22026            },
22027            text: {
22028                stpp: 1,
22029                wvtt: 1
22030            }
22031        };
22032
22033        function ie(t, e, r) {
22034            return void 0 === r && (r = !0), !t.split(",").some((function (t) {
22035                return !ne(t, e, r)
22036            }))
22037        }
22038
22039        function ne(t, e, r) {
22040            var i;
22041            void 0 === r && (r = !0);
22042            var n = ee(r);
22043            return null != (i = null == n ? void 0 : n.isTypeSupported(ae(t, e))) && i
22044        }
22045
22046        function ae(t, e) {
22047            return e + '/mp4;codecs="' + t + '"'
22048        }
22049
22050        function se(t) {
22051            if (t) {
22052                var e = t.substring(0, 4);
22053                return re.video[e]
22054            }
22055            return 2
22056        }
22057
22058        function oe(t) {
22059            return t.split(",").reduce((function (t, e) {
22060                var r = re.video[e];
22061                return r ? (2 * r + t) / (t ? 3 : 2) : (re.audio[e] + t) / (t ? 2 : 1)
22062            }), 0)
22063        }
22064        var le = {},
22065            ue = /flac|opus/i;
22066
22067        function he(t, e) {
22068            return void 0 === e && (e = !0), t.replace(ue, (function (t) {
22069                return function (t, e) {
22070                    if (void 0 === e && (e = !0), le[t]) return le[t];
22071                    for (var r = {
22072                            flac: ["flac", "fLaC", "FLAC"],
22073                            opus: ["opus", "Opus"]
22074                        } [t], i = 0; i < r.length; i++)
22075                        if (ne(r[i], "audio", e)) return le[t] = r[i], r[i];
22076                    return t
22077                }(t.toLowerCase(), e)
22078            }))
22079        }
22080
22081        function de(t, e) {
22082            return t && "mp4a" !== t ? t : e ? e.split(",")[0] : e
22083        }
22084        var ce = /#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,
22085            fe = /#EXT-X-MEDIA:(.*)/g,
22086            ge = /^#EXT(?:INF|-X-TARGETDURATION):/m,
22087            ve = new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, /(?!#) *(\S[^\r\n]*)/.source, /#EXT-X-BYTERANGE:*(.+)/.source, /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, /#.*/.source].join("|"), "g"),
22088            me = new RegExp([/#(EXTM3U)/.source, /#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source, /#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source, /#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source, /(#)([^:]*):(.*)/.source, /(#)(.*)(?:.*)\r?\n?/.source].join("|")),
22089            pe = function () {
22090                function t() {}
22091                return t.findGroup = function (t, e) {
22092                    for (var r = 0; r < t.length; r++) {
22093                        var i = t[r];
22094                        if (i.id === e) return i
22095                    }
22096                }, t.resolve = function (t, e) {
22097                    return p.buildAbsoluteURL(e, t, {
22098                        alwaysNormalize: !0
22099                    })
22100                }, t.isMediaPlaylist = function (t) {
22101                    return ge.test(t)
22102                }, t.parseMasterPlaylist = function (e, r) {
22103                    var i, n = {
22104                            contentSteering: null,
22105                            levels: [],
22106                            playlistParsingError: null,
22107                            sessionData: null,
22108                            sessionKeys: null,
22109                            startTimeOffset: null,
22110                            variableList: null,
22111                            hasVariableRefs: Qt(e)
22112                        },
22113                        a = [];
22114                    for (ce.lastIndex = 0; null != (i = ce.exec(e));)
22115                        if (i[1]) {
22116                            var s, o = new x(i[1]);
22117                            Jt(n, o, ["CODECS", "SUPPLEMENTAL-CODECS", "ALLOWED-CPC", "PATHWAY-ID", "STABLE-VARIANT-ID", "AUDIO", "VIDEO", "SUBTITLES", "CLOSED-CAPTIONS", "NAME"]);
22118                            var l = $t(n, i[2]),
22119                                u = {
22120                                    attrs: o,
22121                                    bitrate: o.decimalInteger("BANDWIDTH") || o.decimalInteger("AVERAGE-BANDWIDTH"),
22122                                    name: o.NAME,
22123                                    url: t.resolve(l, r)
22124                                },
22125                                h = o.decimalResolution("RESOLUTION");
22126                            h && (u.width = h.width, u.height = h.height), Te(o.CODECS, u), null != (s = u.unknownCodecs) && s.length || a.push(u), n.levels.push(u)
22127                        } else if (i[3]) {
22128                        var d = i[3],
22129                            c = i[4];
22130                        switch (d) {
22131                        case "SESSION-DATA":
22132                            var f = new x(c);
22133                            Jt(n, f, ["DATA-ID", "LANGUAGE", "VALUE", "URI"]);
22134                            var g = f["DATA-ID"];
22135                            g && (null === n.sessionData && (n.sessionData = {}), n.sessionData[g] = f);
22136                            break;
22137                        case "SESSION-KEY":
22138                            var v = ye(c, r, n);
22139                            v.encrypted && v.isSupported() ? (null === n.sessionKeys && (n.sessionKeys = []), n.sessionKeys.push(v)) : w.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "' + c + '"');
22140                            break;
22141                        case "DEFINE":
22142                            var m = new x(c);
22143                            Jt(n, m, ["NAME", "VALUE", "QUERYPARAM"]), Zt(n, m, r);
22144                            break;
22145                        case "CONTENT-STEERING":
22146                            var p = new x(c);
22147                            Jt(n, p, ["SERVER-URI", "PATHWAY-ID"]), n.contentSteering = {
22148                                uri: t.resolve(p["SERVER-URI"], r),
22149                                pathwayId: p["PATHWAY-ID"] || "."
22150                            };
22151                            break;
22152                        case "START":
22153                            n.startTimeOffset = Ee(c)
22154                        }
22155                    }
22156                    var y = a.length > 0 && a.length < n.levels.length;
22157                    return n.levels = y ? a : n.levels, 0 === n.levels.length && (n.playlistParsingError = new Error("no levels found in manifest")), n
22158                }, t.parseMasterPlaylistMedia = function (e, r, i) {
22159                    var n, a = {},
22160                        s = i.levels,
22161                        o = {
22162                            AUDIO: s.map((function (t) {
22163                                return {
22164                                    id: t.attrs.AUDIO,
22165                                    audioCodec: t.audioCodec
22166                                }
22167                            })),
22168                            SUBTITLES: s.map((function (t) {
22169                                return {
22170                                    id: t.attrs.SUBTITLES,
22171                                    textCodec: t.textCodec
22172                                }
22173                            })),
22174                            "CLOSED-CAPTIONS": []
22175                        },
22176                        l = 0;
22177                    for (fe.lastIndex = 0; null !== (n = fe.exec(e));) {
22178                        var u = new x(n[1]),
22179                            h = u.TYPE;
22180                        if (h) {
22181                            var d = o[h],
22182                                c = a[h] || [];
22183                            a[h] = c, Jt(i, u, ["URI", "GROUP-ID", "LANGUAGE", "ASSOC-LANGUAGE", "STABLE-RENDITION-ID", "NAME", "INSTREAM-ID", "CHARACTERISTICS", "CHANNELS"]);
22184                            var f = u.LANGUAGE,
22185                                g = u["ASSOC-LANGUAGE"],
22186                                v = u.CHANNELS,
22187                                m = u.CHARACTERISTICS,
22188                                p = u["INSTREAM-ID"],
22189                                y = {
22190                                    attrs: u,
22191                                    bitrate: 0,
22192                                    id: l++,
22193                                    groupId: u["GROUP-ID"] || "",
22194                                    name: u.NAME || f || "",
22195                                    type: h,
22196                                    default: u.bool("DEFAULT"),
22197                                    autoselect: u.bool("AUTOSELECT"),
22198                                    forced: u.bool("FORCED"),
22199                                    lang: f,
22200                                    url: u.URI ? t.resolve(u.URI, r) : ""
22201                                };
22202                            if (g && (y.assocLang = g), v && (y.channels = v), m && (y.characteristics = m), p && (y.instreamId = p), null != d && d.length) {
22203                                var E = t.findGroup(d, y.groupId) || d[0];
22204                                Se(y, E, "audioCodec"), Se(y, E, "textCodec")
22205                            }
22206                            c.push(y)
22207                        }
22208                    }
22209                    return a
22210                }, t.parseLevelPlaylist = function (t, e, r, i, n, a) {
22211                    var s, l, u, h = new H(e),
22212                        d = h.fragments,
22213                        c = null,
22214                        f = 0,
22215                        g = 0,
22216                        v = 0,
22217                        m = 0,
22218                        p = null,
22219                        E = new G(i, e),
22220                        T = -1,
22221                        S = !1,
22222                        L = null;
22223                    for (ve.lastIndex = 0, h.m3u8 = t, h.hasVariableRefs = Qt(t); null !== (s = ve.exec(t));) {
22224                        S && (S = !1, (E = new G(i, e)).start = v, E.sn = f, E.cc = m, E.level = r, c && (E.initSegment = c, E.rawProgramDateTime = c.rawProgramDateTime, c.rawProgramDateTime = null, L && (E.setByteRange(L), L = null)));
22225                        var A = s[1];
22226                        if (A) {
22227                            E.duration = parseFloat(A);
22228                            var R = (" " + s[2]).slice(1);
22229                            E.title = R || null, E.tagList.push(R ? ["INF", A, R] : ["INF", A])
22230                        } else if (s[3]) {
22231                            if (y(E.duration)) {
22232                                E.start = v, u && Re(E, u, h), E.sn = f, E.level = r, E.cc = m, d.push(E);
22233                                var k = (" " + s[3]).slice(1);
22234                                E.relurl = $t(h, k), Le(E, p), p = E, v += E.duration, f++, g = 0, S = !0
22235                            }
22236                        } else if (s[4]) {
22237                            var b = (" " + s[4]).slice(1);
22238                            p ? E.setByteRange(b, p) : E.setByteRange(b)
22239                        } else if (s[5]) E.rawProgramDateTime = (" " + s[5]).slice(1), E.tagList.push(["PROGRAM-DATE-TIME", E.rawProgramDateTime]), -1 === T && (T = d.length);
22240                        else {
22241                            if (!(s = s[0].match(me))) {
22242                                w.warn("No matches on slow regex match for level playlist!");
22243                                continue
22244                            }
22245                            for (l = 1; l < s.length && void 0 === s[l]; l++);
22246                            var D = (" " + s[l]).slice(1),
22247                                I = (" " + s[l + 1]).slice(1),
22248                                C = s[l + 2] ? (" " + s[l + 2]).slice(1) : "";
22249                            switch (D) {
22250                            case "PLAYLIST-TYPE":
22251                                h.type = I.toUpperCase();
22252                                break;
22253                            case "MEDIA-SEQUENCE":
22254                                f = h.startSN = parseInt(I);
22255                                break;
22256                            case "SKIP":
22257                                var _ = new x(I);
22258                                Jt(h, _, ["RECENTLY-REMOVED-DATERANGES"]);
22259                                var P = _.decimalInteger("SKIPPED-SEGMENTS");
22260                                if (y(P)) {
22261                                    h.skippedSegments = P;
22262                                    for (var M = P; M--;) d.unshift(null);
22263                                    f += P
22264                                }
22265                                var O = _.enumeratedString("RECENTLY-REMOVED-DATERANGES");
22266                                O && (h.recentlyRemovedDateranges = O.split("\t"));
22267                                break;
22268                            case "TARGETDURATION":
22269                                h.targetduration = Math.max(parseInt(I), 1);
22270                                break;
22271                            case "VERSION":
22272                                h.version = parseInt(I);
22273                                break;
22274                            case "INDEPENDENT-SEGMENTS":
22275                            case "EXTM3U":
22276                                break;
22277                            case "ENDLIST":
22278                                h.live = !1;
22279                                break;
22280                            case "#":
22281                                (I || C) && E.tagList.push(C ? [I, C] : [I]);
22282                                break;
22283                            case "DISCONTINUITY":
22284                                m++, E.tagList.push(["DIS"]);
22285                                break;
22286                            case "GAP":
22287                                E.gap = !0, E.tagList.push([D]);
22288                                break;
22289                            case "BITRATE":
22290                                E.tagList.push([D, I]);
22291                                break;
22292                            case "DATERANGE":
22293                                var N = new x(I);
22294                                Jt(h, N, ["ID", "CLASS", "START-DATE", "END-DATE", "SCTE35-CMD", "SCTE35-OUT", "SCTE35-IN"]), Jt(h, N, N.clientAttrs);
22295                                var U = new F(N, h.dateRanges[N.ID]);
22296                                U.isValid || h.skippedSegments ? h.dateRanges[U.id] = U : w.warn('Ignoring invalid DATERANGE tag: "' + I + '"'), E.tagList.push(["EXT-X-DATERANGE", I]);
22297                                break;
22298                            case "DEFINE":
22299                                var B = new x(I);
22300                                Jt(h, B, ["NAME", "VALUE", "IMPORT", "QUERYPARAM"]), "IMPORT" in B ? te(h, B, a) : Zt(h, B, e);
22301                                break;
22302                            case "DISCONTINUITY-SEQUENCE":
22303                                m = parseInt(I);
22304                                break;
22305                            case "KEY":
22306                                var V = ye(I, e, h);
22307                                if (V.isSupported()) {
22308                                    if ("NONE" === V.method) {
22309                                        u = void 0;
22310                                        break
22311                                    }
22312                                    u || (u = {}), u[V.keyFormat] && (u = o({}, u)), u[V.keyFormat] = V
22313                                } else w.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "' + I + '"');
22314                                break;
22315                            case "START":
22316                                h.startTimeOffset = Ee(I);
22317                                break;
22318                            case "MAP":
22319                                var Y = new x(I);
22320                                if (Jt(h, Y, ["BYTERANGE", "URI"]), E.duration) {
22321                                    var W = new G(i, e);
22322                                    Ae(W, Y, r, u), c = W, E.initSegment = c, c.rawProgramDateTime && !E.rawProgramDateTime && (E.rawProgramDateTime = c.rawProgramDateTime)
22323                                } else {
22324                                    var j = E.byteRangeEndOffset;
22325                                    if (j) {
22326                                        var q = E.byteRangeStartOffset;
22327                                        L = j - q + "@" + q
22328                                    } else L = null;
22329                                    Ae(E, Y, r, u), c = E, S = !0
22330                                }
22331                                break;
22332                            case "SERVER-CONTROL":
22333                                var X = new x(I);
22334                                h.canBlockReload = X.bool("CAN-BLOCK-RELOAD"), h.canSkipUntil = X.optionalFloat("CAN-SKIP-UNTIL", 0), h.canSkipDateRanges = h.canSkipUntil > 0 && X.bool("CAN-SKIP-DATERANGES"), h.partHoldBack = X.optionalFloat("PART-HOLD-BACK", 0), h.holdBack = X.optionalFloat("HOLD-BACK", 0);
22335                                break;
22336                            case "PART-INF":
22337                                var z = new x(I);
22338                                h.partTarget = z.decimalFloatingPoint("PART-TARGET");
22339                                break;
22340                            case "PART":
22341                                var Q = h.partList;
22342                                Q || (Q = h.partList = []);
22343                                var J = g > 0 ? Q[Q.length - 1] : void 0,
22344                                    $ = g++,
22345                                    Z = new x(I);
22346                                Jt(h, Z, ["BYTERANGE", "URI"]);
22347                                var tt = new K(Z, E, e, $, J);
22348                                Q.push(tt), E.duration += tt.duration;
22349                                break;
22350                            case "PRELOAD-HINT":
22351                                var et = new x(I);
22352                                Jt(h, et, ["URI"]), h.preloadHint = et;
22353                                break;
22354                            case "RENDITION-REPORT":
22355                                var rt = new x(I);
22356                                Jt(h, rt, ["URI"]), h.renditionReports = h.renditionReports || [], h.renditionReports.push(rt);
22357                                break;
22358                            default:
22359                                w.warn("line parsed but not handled: " + s)
22360                            }
22361                        }
22362                    }
22363                    p && !p.relurl ? (d.pop(), v -= p.duration, h.partList && (h.fragmentHint = p)) : h.partList && (Le(E, p), E.cc = m, h.fragmentHint = E, u && Re(E, u, h));
22364                    var it = d.length,
22365                        nt = d[0],
22366                        at = d[it - 1];
22367                    if ((v += h.skippedSegments * h.targetduration) > 0 && it && at) {
22368                        h.averagetargetduration = v / it;
22369                        var st = at.sn;
22370                        h.endSN = "initSegment" !== st ? st : 0, h.live || (at.endList = !0), nt && (h.startCC = nt.cc)
22371                    } else h.endSN = 0, h.startCC = 0;
22372                    return h.fragmentHint && (v += h.fragmentHint.duration), h.totalduration = v, h.endCC = m, T > 0 && function (t, e) {
22373                        for (var r = t[e], i = e; i--;) {
22374                            var n = t[i];
22375                            if (!n) return;
22376                            n.programDateTime = r.programDateTime - 1e3 * n.duration, r = n
22377                        }
22378                    }(d, T), h
22379                }, t
22380            }();
22381
22382        function ye(t, e, r) {
22383            var i, n, a = new x(t);
22384            Jt(r, a, ["KEYFORMAT", "KEYFORMATVERSIONS", "URI", "IV", "URI"]);
22385            var s = null != (i = a.METHOD) ? i : "",
22386                o = a.URI,
22387                l = a.hexadecimalInteger("IV"),
22388                u = a.KEYFORMATVERSIONS,
22389                h = null != (n = a.KEYFORMAT) ? n : "identity";
22390            o && a.IV && !l && w.error("Invalid IV: " + a.IV);
22391            var d = o ? pe.resolve(o, e) : "",
22392                c = (u || "1").split("/").map(Number).filter(Number.isFinite);
22393            return new Xt(s, d, h, c, l)
22394        }
22395
22396        function Ee(t) {
22397            var e = new x(t).decimalFloatingPoint("TIME-OFFSET");
22398            return y(e) ? e : null
22399        }
22400
22401        function Te(t, e) {
22402            var r = (t || "").split(/[ ,]+/).filter((function (t) {
22403                return t
22404            }));
22405            ["video", "audio", "text"].forEach((function (t) {
22406                var i = r.filter((function (e) {
22407                    return function (t, e) {
22408                        var r = re[e];
22409                        return !!r && !!r[t.slice(0, 4)]
22410                    }(e, t)
22411                }));
22412                i.length && (e[t + "Codec"] = i.join(","), r = r.filter((function (t) {
22413                    return -1 === i.indexOf(t)
22414                })))
22415            })), e.unknownCodecs = r
22416        }
22417
22418        function Se(t, e, r) {
22419            var i = e[r];
22420            i && (t[r] = i)
22421        }
22422
22423        function Le(t, e) {
22424            t.rawProgramDateTime ? t.programDateTime = Date.parse(t.rawProgramDateTime) : null != e && e.programDateTime && (t.programDateTime = e.endProgramDateTime), y(t.programDateTime) || (t.programDateTime = null, t.rawProgramDateTime = null)
22425        }
22426
22427        function Ae(t, e, r, i) {
22428            t.relurl = e.URI, e.BYTERANGE && t.setByteRange(e.BYTERANGE), t.level = r, t.sn = "initSegment", i && (t.levelkeys = i), t.initSegment = null
22429        }
22430
22431        function Re(t, e, r) {
22432            t.levelkeys = e;
22433            var i = r.encryptedFragments;
22434            i.length && i[i.length - 1].levelkeys === e || !Object.keys(e).some((function (t) {
22435                return e[t].isCommonEncryption
22436            })) || i.push(t)
22437        }
22438        var ke = "manifest",
22439            be = "level",
22440            De = "audioTrack",
22441            Ie = "subtitleTrack",
22442            we = "main",
22443            Ce = "audio",
22444            _e = "subtitle";
22445
22446        function xe(t) {
22447            switch (t.type) {
22448            case De:
22449                return Ce;
22450            case Ie:
22451                return _e;
22452            default:
22453                return we
22454            }
22455        }
22456
22457        function Pe(t, e) {
22458            var r = t.url;
22459            return void 0 !== r && 0 !== r.indexOf("data:") || (r = e.url), r
22460        }
22461        var Fe = function () {
22462            function t(t) {
22463                this.hls = void 0, this.loaders = Object.create(null), this.variableList = null, this.hls = t, this.registerListeners()
22464            }
22465            var e = t.prototype;
22466            return e.startLoad = function (t) {}, e.stopLoad = function () {
22467                this.destroyInternalLoaders()
22468            }, e.registerListeners = function () {
22469                var t = this.hls;
22470                t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.LEVEL_LOADING, this.onLevelLoading, this), t.on(S.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), t.on(S.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this)
22471            }, e.unregisterListeners = function () {
22472                var t = this.hls;
22473                t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.LEVEL_LOADING, this.onLevelLoading, this), t.off(S.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), t.off(S.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this)
22474            }, e.createInternalLoader = function (t) {
22475                var e = this.hls.config,
22476                    r = e.pLoader,
22477                    i = e.loader,
22478                    n = new(r || i)(e);
22479                return this.loaders[t.type] = n, n
22480            }, e.getInternalLoader = function (t) {
22481                return this.loaders[t.type]
22482            }, e.resetInternalLoader = function (t) {
22483                this.loaders[t] && delete this.loaders[t]
22484            }, e.destroyInternalLoaders = function () {
22485                for (var t in this.loaders) {
22486                    var e = this.loaders[t];
22487                    e && e.destroy(), this.resetInternalLoader(t)
22488                }
22489            }, e.destroy = function () {
22490                this.variableList = null, this.unregisterListeners(), this.destroyInternalLoaders()
22491            }, e.onManifestLoading = function (t, e) {
22492                var r = e.url;
22493                this.variableList = null, this.load({
22494                    id: null,
22495                    level: 0,
22496                    responseType: "text",
22497                    type: ke,
22498                    url: r,
22499                    deliveryDirectives: null
22500                })
22501            }, e.onLevelLoading = function (t, e) {
22502                var r = e.id,
22503                    i = e.level,
22504                    n = e.pathwayId,
22505                    a = e.url,
22506                    s = e.deliveryDirectives;
22507                this.load({
22508                    id: r,
22509                    level: i,
22510                    pathwayId: n,
22511                    responseType: "text",
22512                    type: be,
22513                    url: a,
22514                    deliveryDirectives: s
22515                })
22516            }, e.onAudioTrackLoading = function (t, e) {
22517                var r = e.id,
22518                    i = e.groupId,
22519                    n = e.url,
22520                    a = e.deliveryDirectives;
22521                this.load({
22522                    id: r,
22523                    groupId: i,
22524                    level: null,
22525                    responseType: "text",
22526                    type: De,
22527                    url: n,
22528                    deliveryDirectives: a
22529                })
22530            }, e.onSubtitleTrackLoading = function (t, e) {
22531                var r = e.id,
22532                    i = e.groupId,
22533                    n = e.url,
22534                    a = e.deliveryDirectives;
22535                this.load({
22536                    id: r,
22537                    groupId: i,
22538                    level: null,
22539                    responseType: "text",
22540                    type: Ie,
22541                    url: n,
22542                    deliveryDirectives: a
22543                })
22544            }, e.load = function (t) {
22545                var e, r, i, n = this,
22546                    a = this.hls.config,
22547                    s = this.getInternalLoader(t);
22548                if (s) {
22549                    var l = s.context;
22550                    if (l && l.url === t.url && l.level === t.level) return void w.trace("[playlist-loader]: playlist request ongoing");
22551                    w.log("[playlist-loader]: aborting previous loader for type: " + t.type), s.abort()
22552                }
22553                if (r = t.type === ke ? a.manifestLoadPolicy.default : o({}, a.playlistLoadPolicy.default, {
22554                        timeoutRetry: null,
22555                        errorRetry: null
22556                    }), s = this.createInternalLoader(t), y(null == (e = t.deliveryDirectives) ? void 0 : e.part) && (t.type === be && null !== t.level ? i = this.hls.levels[t.level].details : t.type === De && null !== t.id ? i = this.hls.audioTracks[t.id].details : t.type === Ie && null !== t.id && (i = this.hls.subtitleTracks[t.id].details), i)) {
22557                    var u = i.partTarget,
22558                        h = i.targetduration;
22559                    if (u && h) {
22560                        var d = 1e3 * Math.max(3 * u, .8 * h);
22561                        r = o({}, r, {
22562                  
vendor: 10,269 bytes, lines 22562-22785
22562          maxTimeToFirstByteMs: Math.min(d, r.maxTimeToFirstByteMs),
22563                            maxLoadTimeMs: Math.min(d, r.maxTimeToFirstByteMs)
22564                        })
22565                    }
22566                }
22567                var c = r.errorRetry || r.timeoutRetry || {},
22568                    f = {
22569                        loadPolicy: r,
22570                        timeout: r.maxLoadTimeMs,
22571                        maxRetry: c.maxNumRetry || 0,
22572                        retryDelay: c.retryDelayMs || 0,
22573                        maxRetryDelay: c.maxRetryDelayMs || 0
22574                    },
22575                    g = {
22576                        onSuccess: function (t, e, r, i) {
22577                            var a = n.getInternalLoader(r);
22578                            n.resetInternalLoader(r.type);
22579                            var s = t.data;
22580                            0 === s.indexOf("#EXTM3U") ? (e.parsing.start = performance.now(), pe.isMediaPlaylist(s) ? n.handleTrackOrLevelPlaylist(t, e, r, i || null, a) : n.handleMasterPlaylist(t, e, r, i)) : n.handleManifestParsingError(t, r, new Error("no EXTM3U delimiter"), i || null, e)
22581                        },
22582                        onError: function (t, e, r, i) {
22583                            n.handleNetworkError(e, r, !1, t, i)
22584                        },
22585                        onTimeout: function (t, e, r) {
22586                            n.handleNetworkError(e, r, !0, void 0, t)
22587                        }
22588                    };
22589                s.load(t, f, g)
22590            }, e.handleMasterPlaylist = function (t, e, r, i) {
22591                var n = this.hls,
22592                    a = t.data,
22593                    s = Pe(t, r),
22594                    o = pe.parseMasterPlaylist(a, s);
22595                if (o.playlistParsingError) this.handleManifestParsingError(t, r, o.playlistParsingError, i, e);
22596                else {
22597                    var l = o.contentSteering,
22598                        u = o.levels,
22599                        h = o.sessionData,
22600                        d = o.sessionKeys,
22601                        c = o.startTimeOffset,
22602                        f = o.variableList;
22603                    this.variableList = f;
22604                    var g = pe.parseMasterPlaylistMedia(a, s, o),
22605                        v = g.AUDIO,
22606                        m = void 0 === v ? [] : v,
22607                        p = g.SUBTITLES,
22608                        y = g["CLOSED-CAPTIONS"];
22609                    m.length && (m.some((function (t) {
22610                        return !t.url
22611                    })) || !u[0].audioCodec || u[0].attrs.AUDIO || (w.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"), m.unshift({
22612                        type: "main",
22613                        name: "main",
22614                        groupId: "main",
22615                        default: !1,
22616                        autoselect: !1,
22617                        forced: !1,
22618                        id: -1,
22619                        attrs: new x({}),
22620                        bitrate: 0,
22621                        url: ""
22622                    }))), n.trigger(S.MANIFEST_LOADED, {
22623                        levels: u,
22624                        audioTracks: m,
22625                        subtitles: p,
22626                        captions: y,
22627                        contentSteering: l,
22628                        url: s,
22629                        stats: e,
22630                        networkDetails: i,
22631                        sessionData: h,
22632                        sessionKeys: d,
22633                        startTimeOffset: c,
22634                        variableList: f
22635                    })
22636                }
22637            }, e.handleTrackOrLevelPlaylist = function (t, e, r, i, n) {
22638                var a = this.hls,
22639                    s = r.id,
22640                    o = r.level,
22641                    l = r.type,
22642                    u = Pe(t, r),
22643                    h = y(o) ? o : y(s) ? s : 0,
22644                    d = xe(r),
22645                    c = pe.parseLevelPlaylist(t.data, u, h, d, 0, this.variableList);
22646                if (l === ke) {
22647                    var f = {
22648                        attrs: new x({}),
22649                        bitrate: 0,
22650                        details: c,
22651                        name: "",
22652                        url: u
22653                    };
22654                    a.trigger(S.MANIFEST_LOADED, {
22655                        levels: [f],
22656                        audioTracks: [],
22657                        url: u,
22658                        stats: e,
22659                        networkDetails: i,
22660                        sessionData: null,
22661                        sessionKeys: null,
22662                        contentSteering: null,
22663                        startTimeOffset: null,
22664                        variableList: null
22665                    })
22666                }
22667                e.parsing.end = performance.now(), r.levelDetails = c, this.handlePlaylistLoaded(c, t, e, r, i, n)
22668            }, e.handleManifestParsingError = function (t, e, r, i, n) {
22669                this.hls.trigger(S.ERROR, {
22670                    type: L.NETWORK_ERROR,
22671                    details: A.MANIFEST_PARSING_ERROR,
22672                    fatal: e.type === ke,
22673                    url: t.url,
22674                    err: r,
22675                    error: r,
22676                    reason: r.message,
22677                    response: t,
22678                    context: e,
22679                    networkDetails: i,
22680                    stats: n
22681                })
22682            }, e.handleNetworkError = function (t, e, r, n, a) {
22683                void 0 === r && (r = !1);
22684                var s = "A network " + (r ? "timeout" : "error" + (n ? " (status " + n.code + ")" : "")) + " occurred while loading " + t.type;
22685                t.type === be ? s += ": " + t.level + " id: " + t.id : t.type !== De && t.type !== Ie || (s += " id: " + t.id + ' group-id: "' + t.groupId + '"');
22686                var o = new Error(s);
22687                w.warn("[playlist-loader]: " + s);
22688                var l = A.UNKNOWN,
22689                    u = !1,
22690                    h = this.getInternalLoader(t);
22691                switch (t.type) {
22692                case ke:
22693                    l = r ? A.MANIFEST_LOAD_TIMEOUT : A.MANIFEST_LOAD_ERROR, u = !0;
22694                    break;
22695                case be:
22696                    l = r ? A.LEVEL_LOAD_TIMEOUT : A.LEVEL_LOAD_ERROR, u = !1;
22697                    break;
22698                case De:
22699                    l = r ? A.AUDIO_TRACK_LOAD_TIMEOUT : A.AUDIO_TRACK_LOAD_ERROR, u = !1;
22700                    break;
22701                case Ie:
22702                    l = r ? A.SUBTITLE_TRACK_LOAD_TIMEOUT : A.SUBTITLE_LOAD_ERROR, u = !1
22703                }
22704                h && this.resetInternalLoader(t.type);
22705                var d = {
22706                    type: L.NETWORK_ERROR,
22707                    details: l,
22708                    fatal: u,
22709                    url: t.url,
22710                    loader: h,
22711                    context: t,
22712                    error: o,
22713                    networkDetails: e,
22714                    stats: a
22715                };
22716                if (n) {
22717                    var c = (null == e ? void 0 : e.url) || t.url;
22718                    d.response = i({
22719                        url: c,
22720                        data: void 0
22721                    }, n)
22722                }
22723                this.hls.trigger(S.ERROR, d)
22724            }, e.handlePlaylistLoaded = function (t, e, r, i, n, a) {
22725                var s = this.hls,
22726                    o = i.type,
22727                    l = i.level,
22728                    u = i.id,
22729                    h = i.groupId,
22730                    d = i.deliveryDirectives,
22731                    c = Pe(e, i),
22732                    f = xe(i),
22733                    g = "number" == typeof i.level && f === we ? l : void 0;
22734                if (t.fragments.length) {
22735                    t.targetduration || (t.playlistParsingError = new Error("Missing Target Duration"));
22736                    var v = t.playlistParsingError;
22737                    if (v) s.trigger(S.ERROR, {
22738                        type: L.NETWORK_ERROR,
22739                        details: A.LEVEL_PARSING_ERROR,
22740                        fatal: !1,
22741                        url: c,
22742                        error: v,
22743                        reason: v.message,
22744                        response: e,
22745                        context: i,
22746                        level: g,
22747                        parent: f,
22748                        networkDetails: n,
22749                        stats: r
22750                    });
22751                    else switch (t.live && a && (a.getCacheAge && (t.ageHeader = a.getCacheAge() || 0), a.getCacheAge && !isNaN(t.ageHeader) || (t.ageHeader = 0)), o) {
22752                    case ke:
22753                    case be:
22754                        s.trigger(S.LEVEL_LOADED, {
22755                            details: t,
22756                            level: g || 0,
22757                            id: u || 0,
22758                            stats: r,
22759                            networkDetails: n,
22760                            deliveryDirectives: d
22761                        });
22762                        break;
22763                    case De:
22764                        s.trigger(S.AUDIO_TRACK_LOADED, {
22765                            details: t,
22766                            id: u || 0,
22767                            groupId: h || "",
22768                            stats: r,
22769                            networkDetails: n,
22770                            deliveryDirectives: d
22771                        });
22772                        break;
22773                    case Ie:
22774                        s.trigger(S.SUBTITLE_TRACK_LOADED, {
22775                            details: t,
22776                            id: u || 0,
22777                            groupId: h || "",
22778                            stats: r,
22779                            networkDetails: n,
22780                            deliveryDirectives: d
22781                        })
22782                    }
22783                } else {
22784                    var m = new Error("No Segments found in Playlist");
22785                    s.trigger(S.ERROR, {
vendor: 20,499 bytes, lines 22786-23152
22786                        type: L.NETWORK_ERROR,
22787                        details: A.LEVEL_EMPTY_ERROR,
22788                        fatal: !1,
22789                        url: c,
22790                        error: m,
22791                        reason: m.message,
22792                        response: e,
22793                        context: i,
22794                        level: g,
22795                        parent: f,
22796                        networkDetails: n,
22797                        stats: r
22798                    })
22799                }
22800            }, t
22801        }();
22802
22803        function Me(t, e) {
22804            var r;
22805            try {
22806                r = new Event("addtrack")
22807            } catch (t) {
22808                (r = document.createEvent("Event")).initEvent("addtrack", !1, !1)
22809            }
22810            r.track = t, e.dispatchEvent(r)
22811        }
22812
22813        function Oe(t, e) {
22814            var r = t.mode;
22815            if ("disabled" === r && (t.mode = "hidden"), t.cues && !t.cues.getCueById(e.id)) try {
22816                if (t.addCue(e), !t.cues.getCueById(e.id)) throw new Error("addCue is failed for: " + e)
22817            } catch (r) {
22818                w.debug("[texttrack-utils]: " + r);
22819                try {
22820                    var i = new self.TextTrackCue(e.startTime, e.endTime, e.text);
22821                    i.id = e.id, t.addCue(i)
22822                } catch (t) {
22823                    w.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: " + t)
22824                }
22825            }
22826            "disabled" === r && (t.mode = r)
22827        }
22828
22829        function Ne(t) {
22830            var e = t.mode;
22831            if ("disabled" === e && (t.mode = "hidden"), t.cues)
22832                for (var r = t.cues.length; r--;) t.removeCue(t.cues[r]);
22833            "disabled" === e && (t.mode = e)
22834        }
22835
22836        function Ue(t, e, r, i) {
22837            var n = t.mode;
22838            if ("disabled" === n && (t.mode = "hidden"), t.cues && t.cues.length > 0)
22839                for (var a = function (t, e, r) {
22840                        var i = [],
22841                            n = function (t, e) {
22842                                if (e < t[0].startTime) return 0;
22843                                var r = t.length - 1;
22844                                if (e > t[r].endTime) return -1;
22845                                for (var i = 0, n = r; i <= n;) {
22846                                    var a = Math.floor((n + i) / 2);
22847                                    if (e < t[a].startTime) n = a - 1;
22848                                    else {
22849                                        if (!(e > t[a].startTime && i < r)) return a;
22850                                        i = a + 1
22851                                    }
22852                                }
22853                                return t[i].startTime - e < e - t[n].startTime ? i : n
22854                            }(t, e);
22855                        if (n > -1)
22856                            for (var a = n, s = t.length; a < s; a++) {
22857                                var o = t[a];
22858                                if (o.startTime >= e && o.endTime <= r) i.push(o);
22859                                else if (o.startTime > r) return i
22860                            }
22861                        return i
22862                    }(t.cues, e, r), s = 0; s < a.length; s++) i && !i(a[s]) || t.removeCue(a[s]);
22863            "disabled" === n && (t.mode = n)
22864        }
22865
22866        function Be(t) {
22867            for (var e = [], r = 0; r < t.length; r++) {
22868                var i = t[r];
22869                "subtitles" !== i.kind && "captions" !== i.kind || !i.label || e.push(t[r])
22870            }
22871            return e
22872        }
22873        var Ge = "org.id3",
22874            Ke = "com.apple.quicktime.HLS",
22875            He = "https://aomedia.org/emsg/ID3";
22876
22877        function Ve() {
22878            if ("undefined" != typeof self) return self.VTTCue || self.TextTrackCue
22879        }
22880
22881        function Ye(t, e, r, n, a) {
22882            var s = new t(e, r, "");
22883            try {
22884                s.value = n, a && (s.type = a)
22885            } catch (o) {
22886                s = new t(e, r, JSON.stringify(a ? i({
22887                    type: a
22888                }, n) : n))
22889            }
22890            return s
22891        }
22892        var We = function () {
22893            var t = Ve();
22894            try {
22895                t && new t(0, Number.POSITIVE_INFINITY, "")
22896            } catch (t) {
22897                return Number.MAX_VALUE
22898            }
22899            return Number.POSITIVE_INFINITY
22900        }();
22901
22902        function je(t, e) {
22903            return t.getTime() / 1e3 - e
22904        }
22905        var qe = function () {
22906                function t(t) {
22907                    this.hls = void 0, this.id3Track = null, this.media = null, this.dateRangeCuesAppended = {}, this.hls = t, this._registerListeners()
22908                }
22909                var e = t.prototype;
22910                return e.destroy = function () {
22911                    this._unregisterListeners(), this.id3Track = null, this.media = null, this.dateRangeCuesAppended = {}, this.hls = null
22912                }, e._registerListeners = function () {
22913                    var t = this.hls;
22914                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), t.on(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(S.LEVEL_UPDATED, this.onLevelUpdated, this)
22915                }, e._unregisterListeners = function () {
22916                    var t = this.hls;
22917                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), t.off(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(S.LEVEL_UPDATED, this.onLevelUpdated, this)
22918                }, e.onMediaAttached = function (t, e) {
22919                    this.media = e.media
22920                }, e.onMediaDetaching = function () {
22921                    this.id3Track && (Ne(this.id3Track), this.id3Track = null, this.media = null, this.dateRangeCuesAppended = {})
22922                }, e.onManifestLoading = function () {
22923                    this.dateRangeCuesAppended = {}
22924                }, e.createTrack = function (t) {
22925                    var e = this.getID3Track(t.textTracks);
22926                    return e.mode = "hidden", e
22927                }, e.getID3Track = function (t) {
22928                    if (this.media) {
22929                        for (var e = 0; e < t.length; e++) {
22930                            var r = t[e];
22931                            if ("metadata" === r.kind && "id3" === r.label) return Me(r, this.media), r
22932                        }
22933                        return this.media.addTextTrack("metadata", "id3")
22934                    }
22935                }, e.onFragParsingMetadata = function (t, e) {
22936                    if (this.media) {
22937                        var r = this.hls.config,
22938                            i = r.enableEmsgMetadataCues,
22939                            n = r.enableID3MetadataCues;
22940                        if (i || n) {
22941                            var a = e.samples;
22942                            this.id3Track || (this.id3Track = this.createTrack(this.media));
22943                            var s = Ve();
22944                            if (s)
22945                                for (var o = 0; o < a.length; o++) {
22946                                    var l = a[o].type;
22947                                    if ((l !== He || i) && n) {
22948                                        var u = gt(a[o].data);
22949                                        if (u) {
22950                                            var h = a[o].pts,
22951                                                d = h + a[o].duration;
22952                                            d > We && (d = We), d - h <= 0 && (d = h + .25);
22953                                            for (var c = 0; c < u.length; c++) {
22954                                                var f = u[c];
22955                                                if (!ct(f)) {
22956                                                    this.updateId3CueEnds(h, l);
22957                                                    var g = Ye(s, h, d, f, l);
22958                                                    g && this.id3Track.addCue(g)
22959                                                }
22960                                            }
22961                                        }
22962                                    }
22963                                }
22964                        }
22965                    }
22966                }, e.updateId3CueEnds = function (t, e) {
22967                    var r, i = null == (r = this.id3Track) ? void 0 : r.cues;
22968                    if (i)
22969                        for (var n = i.length; n--;) {
22970                            var a = i[n];
22971                            a.type === e && a.startTime < t && a.endTime === We && (a.endTime = t)
22972                        }
22973                }, e.onBufferFlushing = function (t, e) {
22974                    var r = e.startOffset,
22975                        i = e.endOffset,
22976                        n = e.type,
22977                        a = this.id3Track,
22978                        s = this.hls;
22979                    if (s) {
22980                        var o = s.config,
22981                            l = o.enableEmsgMetadataCues,
22982                            u = o.enableID3MetadataCues;
22983                        a && (l || u) && Ue(a, r, i, "audio" === n ? function (t) {
22984                            return t.type === Ge && u
22985                        } : "video" === n ? function (t) {
22986                            return t.type === He && l
22987                        } : function (t) {
22988                            return t.type === Ge && u || t.type === He && l
22989                        })
22990                    }
22991                }, e.onLevelUpdated = function (t, e) {
22992                    var r = this,
22993                        i = e.details;
22994                    if (this.media && i.hasProgramDateTime && this.hls.config.enableDateRangeMetadataCues) {
22995                        var n = this.dateRangeCuesAppended,
22996                            a = this.id3Track,
22997                            s = i.dateRanges,
22998                            o = Object.keys(s);
22999                        if (a)
23000                            for (var l = Object.keys(n).filter((function (t) {
23001                                    return !o.includes(t)
23002                                })), u = function () {
23003                                    var t = l[h];
23004                                    Object.keys(n[t].cues).forEach((function (e) {
23005                                        a.removeCue(n[t].cues[e])
23006                                    })), delete n[t]
23007                                }, h = l.length; h--;) u();
23008                        var d = i.fragments[i.fragments.length - 1];
23009                        if (0 !== o.length && y(null == d ? void 0 : d.programDateTime)) {
23010                            this.id3Track || (this.id3Track = this.createTrack(this.media));
23011                            for (var c = d.programDateTime / 1e3 - d.start, f = Ve(), g = function () {
23012                                    var t = o[v],
23013                                        e = s[t],
23014                                        i = je(e.startDate, c),
23015                                        a = n[t],
23016                                        l = (null == a ? void 0 : a.cues) || {},
23017                                        u = (null == a ? void 0 : a.durationKnown) || !1,
23018                                        h = We,
23019                                        d = e.endDate;
23020                                    if (d) h = je(d, c), u = !0;
23021                                    else if (e.endOnNext && !u) {
23022                                        var g = o.reduce((function (t, r) {
23023                                            if (r !== e.id) {
23024                                                var i = s[r];
23025                                                if (i.class === e.class && i.startDate > e.startDate && (!t || e.startDate < t.startDate)) return i
23026                                            }
23027                                            return t
23028                                        }), null);
23029                                        g && (h = je(g.startDate, c), u = !0)
23030                                    }
23031                                    for (var m, p, y = Object.keys(e.attr), E = 0; E < y.length; E++) {
23032                                        var T = y[E];
23033                                        if ("ID" !== (p = T) && "CLASS" !== p && "START-DATE" !== p && "DURATION" !== p && "END-DATE" !== p && "END-ON-NEXT" !== p) {
23034                                            var S = l[T];
23035                                            if (S) u && !a.durationKnown && (S.endTime = h);
23036                                            else if (f) {
23037                                                var L = e.attr[T];
23038                                                P(T) && (m = L, L = Uint8Array.from(m.replace(/^0x/, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" ")).buffer);
23039                                                var A = Ye(f, i, h, {
23040                                                    key: T,
23041                                                    data: L
23042                                                }, Ke);
23043                                                A && (A.id = t, r.id3Track.addCue(A), l[T] = A)
23044                                            }
23045                                        }
23046                                    }
23047                                    n[t] = {
23048                                        cues: l,
23049                                        dateRange: e,
23050                                        durationKnown: u
23051                                    }
23052                                }, v = 0; v < o.length; v++) g()
23053                        }
23054                    }
23055                }, t
23056            }(),
23057            Xe = function () {
23058                function t(t) {
23059                    var e = this;
23060                    this.hls = void 0, this.config = void 0, this.media = null, this.levelDetails = null, this.currentTime = 0, this.stallCount = 0, this._latency = null, this.timeupdateHandler = function () {
23061                        return e.timeupdate()
23062                    }, this.hls = t, this.config = t.config, this.registerListeners()
23063                }
23064                var e = t.prototype;
23065                return e.destroy = function () {
23066                    this.unregisterListeners(), this.onMediaDetaching(), this.levelDetails = null, this.hls = this.timeupdateHandler = null
23067                }, e.registerListeners = function () {
23068                    this.hls.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.on(S.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.on(S.LEVEL_UPDATED, this.onLevelUpdated, this), this.hls.on(S.ERROR, this.onError, this)
23069                }, e.unregisterListeners = function () {
23070                    this.hls.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.off(S.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.off(S.LEVEL_UPDATED, this.onLevelUpdated, this), this.hls.off(S.ERROR, this.onError, this)
23071                }, e.onMediaAttached = function (t, e) {
23072                    this.media = e.media, this.media.addEventListener("timeupdate", this.timeupdateHandler)
23073                }, e.onMediaDetaching = function () {
23074                    this.media && (this.media.removeEventListener("timeupdate", this.timeupdateHandler), this.media = null)
23075                }, e.onManifestLoading = function () {
23076                    this.levelDetails = null, this._latency = null, this.stallCount = 0
23077                }, e.onLevelUpdated = function (t, e) {
23078                    var r = e.details;
23079                    this.levelDetails = r, r.advanced && this.timeupdate(), !r.live && this.media && this.media.removeEventListener("timeupdate", this.timeupdateHandler)
23080                }, e.onError = function (t, e) {
23081                    var r;
23082                    e.details === A.BUFFER_STALLED_ERROR && (this.stallCount++, null != (r = this.levelDetails) && r.live && w.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))
23083                }, e.timeupdate = function () {
23084                    var t = this.media,
23085                        e = this.levelDetails;
23086                    if (t && e) {
23087                        this.currentTime = t.currentTime;
23088                        var r = this.computeLatency();
23089                        if (null !== r) {
23090                            this._latency = r;
23091                            var i = this.config,
23092                                n = i.lowLatencyMode,
23093                                a = i.maxLiveSyncPlaybackRate;
23094                            if (n && 1 !== a && e.live) {
23095                                var s = this.targetLatency;
23096                                if (null !== s) {
23097                                    var o = r - s;
23098                                    if (o < Math.min(this.maxLatency, s + e.targetduration) && o > .05 && this.forwardBufferLength > 1) {
23099                                        var l = Math.min(2, Math.max(1, a)),
23100                                            u = Math.round(2 / (1 + Math.exp(-.75 * o - this.edgeStalled)) * 20) / 20;
23101                                        t.playbackRate = Math.min(l, Math.max(1, u))
23102                                    } else 1 !== t.playbackRate && 0 !== t.playbackRate && (t.playbackRate = 1)
23103                                }
23104                            }
23105                        }
23106                    }
23107                }, e.estimateLiveEdge = function () {
23108                    var t = this.levelDetails;
23109                    return null === t ? null : t.edge + t.age
23110                }, e.computeLatency = function () {
23111                    var t = this.estimateLiveEdge();
23112                    return null === t ? null : t - this.currentTime
23113                }, s(t, [{
23114                    key: "latency",
23115                    get: function () {
23116                        return this._latency || 0
23117                    }
23118                }, {
23119                    key: "maxLatency",
23120                    get: function () {
23121                        var t = this.config,
23122                            e = this.levelDetails;
23123                        return void 0 !== t.liveMaxLatencyDuration ? t.liveMaxLatencyDuration : e ? t.liveMaxLatencyDurationCount * e.targetduration : 0
23124                    }
23125                }, {
23126                    key: "targetLatency",
23127                    get: function () {
23128                        var t = this.levelDetails;
23129                        if (null === t) return null;
23130                        var e = t.holdBack,
23131                            r = t.partHoldBack,
23132                            i = t.targetduration,
23133                            n = this.config,
23134                            a = n.liveSyncDuration,
23135                            s = n.liveSyncDurationCount,
23136                            o = n.lowLatencyMode,
23137                            l = this.hls.userConfig,
23138                            u = o && r || e;
23139                        (l.liveSyncDuration || l.liveSyncDurationCount || 0 === u) && (u = void 0 !== a ? a : s * i);
23140                        var h = i;
23141                        return u + Math.min(1 * this.stallCount, h)
23142                    }
23143                }, {
23144                    key: "liveSyncPosition",
23145                    get: function () {
23146                        var t = this.estimateLiveEdge(),
23147                            e = this.targetLatency,
23148                            r = this.levelDetails;
23149                        if (null === t || null === e || null === r) return null;
23150                        var i = r.edge,
23151                            n = t - e - this.edgeStalled,
23152                            a = i - r.totalduration,
vendor: 11,188 bytes, lines 23153-23363
23153                            s = i - (this.config.lowLatencyMode && r.partTarget || r.targetduration);
23154                        return Math.min(Math.max(a, n), s)
23155                    }
23156                }, {
23157                    key: "drift",
23158                    get: function () {
23159                        var t = this.levelDetails;
23160                        return null === t ? 1 : t.drift
23161                    }
23162                }, {
23163                    key: "edgeStalled",
23164                    get: function () {
23165                        var t = this.levelDetails;
23166                        if (null === t) return 0;
23167                        var e = 3 * (this.config.lowLatencyMode && t.partTarget || t.targetduration);
23168                        return Math.max(t.age - e, 0)
23169                    }
23170                }, {
23171                    key: "forwardBufferLength",
23172                    get: function () {
23173                        var t = this.media,
23174                            e = this.levelDetails;
23175                        if (!t || !e) return 0;
23176                        var r = t.buffered.length;
23177                        return (r ? t.buffered.end(r - 1) : e.edge) - this.currentTime
23178                    }
23179                }]), t
23180            }(),
23181            ze = ["NONE", "TYPE-0", "TYPE-1", null],
23182            Qe = ["SDR", "PQ", "HLG"],
23183            Je = "",
23184            $e = "YES",
23185            Ze = "v2";
23186
23187        function tr(t) {
23188            var e = t.canSkipUntil,
23189                r = t.canSkipDateRanges,
23190                i = t.age;
23191            return e && i < e / 2 ? r ? Ze : $e : Je
23192        }
23193        var er = function () {
23194                function t(t, e, r) {
23195                    this.msn = void 0, this.part = void 0, this.skip = void 0, this.msn = t, this.part = e, this.skip = r
23196                }
23197                return t.prototype.addDirectives = function (t) {
23198                    var e = new self.URL(t);
23199                    return void 0 !== this.msn && e.searchParams.set("_HLS_msn", this.msn.toString()), void 0 !== this.part && e.searchParams.set("_HLS_part", this.part.toString()), this.skip && e.searchParams.set("_HLS_skip", this.skip), e.href
23200                }, t
23201            }(),
23202            rr = function () {
23203                function t(t) {
23204                    this._attrs = void 0, this.audioCodec = void 0, this.bitrate = void 0, this.codecSet = void 0, this.url = void 0, this.frameRate = void 0, this.height = void 0, this.id = void 0, this.name = void 0, this.videoCodec = void 0, this.width = void 0, this.details = void 0, this.fragmentError = 0, this.loadError = 0, this.loaded = void 0, this.realBitrate = 0, this.supportedPromise = void 0, this.supportedResult = void 0, this._avgBitrate = 0, this._audioGroups = void 0, this._subtitleGroups = void 0, this._urlId = 0, this.url = [t.url], this._attrs = [t.attrs], this.bitrate = t.bitrate, t.details && (this.details = t.details), this.id = t.id || 0, this.name = t.name, this.width = t.width || 0, this.height = t.height || 0, this.frameRate = t.attrs.optionalFloat("FRAME-RATE", 0), this._avgBitrate = t.attrs.decimalInteger("AVERAGE-BANDWIDTH"), this.audioCodec = t.audioCodec, this.videoCodec = t.videoCodec, this.codecSet = [t.videoCodec, t.audioCodec].filter((function (t) {
23205                        return !!t
23206                    })).map((function (t) {
23207                        return t.substring(0, 4)
23208                    })).join(","), this.addGroupId("audio", t.attrs.AUDIO), this.addGroupId("text", t.attrs.SUBTITLES)
23209                }
23210                var e = t.prototype;
23211                return e.hasAudioGroup = function (t) {
23212                    return ir(this._audioGroups, t)
23213                }, e.hasSubtitleGroup = function (t) {
23214                    return ir(this._subtitleGroups, t)
23215                }, e.addGroupId = function (t, e) {
23216                    if (e)
23217                        if ("audio" === t) {
23218                            var r = this._audioGroups;
23219                            r || (r = this._audioGroups = []), -1 === r.indexOf(e) && r.push(e)
23220                        } else if ("text" === t) {
23221                        var i = this._subtitleGroups;
23222                        i || (i = this._subtitleGroups = []), -1 === i.indexOf(e) && i.push(e)
23223                    }
23224                }, e.addFallback = function () {}, s(t, [{
23225                    key: "maxBitrate",
23226                    get: function () {
23227                        return Math.max(this.realBitrate, this.bitrate)
23228                    }
23229                }, {
23230                    key: "averageBitrate",
23231                    get: function () {
23232                        return this._avgBitrate || this.realBitrate || this.bitrate
23233                    }
23234                }, {
23235                    key: "attrs",
23236                    get: function () {
23237                        return this._attrs[0]
23238                    }
23239                }, {
23240                    key: "codecs",
23241                    get: function () {
23242                        return this.attrs.CODECS || ""
23243                    }
23244                }, {
23245                    key: "pathwayId",
23246                    get: function () {
23247                        return this.attrs["PATHWAY-ID"] || "."
23248                    }
23249                }, {
23250                    key: "videoRange",
23251                    get: function () {
23252                        return this.attrs["VIDEO-RANGE"] || "SDR"
23253                    }
23254                }, {
23255                    key: "score",
23256                    get: function () {
23257                        return this.attrs.optionalFloat("SCORE", 0)
23258                    }
23259                }, {
23260                    key: "uri",
23261                    get: function () {
23262                        return this.url[0] || ""
23263                    }
23264                }, {
23265                    key: "audioGroups",
23266                    get: function () {
23267                        return this._audioGroups
23268                    }
23269                }, {
23270                    key: "subtitleGroups",
23271                    get: function () {
23272                        return this._subtitleGroups
23273                    }
23274                }, {
23275                    key: "urlId",
23276                    get: function () {
23277                        return 0
23278                    },
23279                    set: function (t) {}
23280                }, {
23281                    key: "audioGroupIds",
23282                    get: function () {
23283                        return this.audioGroups ? [this.audioGroupId] : void 0
23284                    }
23285                }, {
23286                    key: "textGroupIds",
23287                    get: function () {
23288                        return this.subtitleGroups ? [this.textGroupId] : void 0
23289                    }
23290                }, {
23291                    key: "audioGroupId",
23292                    get: function () {
23293                        var t;
23294                        return null == (t = this.audioGroups) ? void 0 : t[0]
23295                    }
23296                }, {
23297                    key: "textGroupId",
23298                    get: function () {
23299                        var t;
23300                        return null == (t = this.subtitleGroups) ? void 0 : t[0]
23301                    }
23302                }]), t
23303            }();
23304
23305        function ir(t, e) {
23306            return !(!e || !t) && -1 !== t.indexOf(e)
23307        }
23308
23309        function nr(t, e) {
23310            var r = e.startPTS;
23311            if (y(r)) {
23312                var i, n = 0;
23313                e.sn > t.sn ? (n = r - t.start, i = t) : (n = t.start - r, i = e), i.duration !== n && (i.duration = n)
23314            } else e.sn > t.sn ? t.cc === e.cc && t.minEndPTS ? e.start = t.start + (t.minEndPTS - t.start) : e.start = t.start + t.duration : e.start = Math.max(t.start - e.duration, 0)
23315        }
23316
23317        function ar(t, e, r, i, n, a) {
23318            i - r <= 0 && (w.warn("Fragment should have a positive duration", e), i = r + e.duration, a = n + e.duration);
23319            var s = r,
23320                o = i,
23321                l = e.startPTS,
23322                u = e.endPTS;
23323            if (y(l)) {
23324                var h = Math.abs(l - r);
23325                y(e.deltaPTS) ? e.deltaPTS = Math.max(h, e.deltaPTS) : e.deltaPTS = h, s = Math.max(r, l), r = Math.min(r, l), n = Math.min(n, e.startDTS), o = Math.min(i, u), i = Math.max(i, u), a = Math.max(a, e.endDTS)
23326            }
23327            var d = r - e.start;
23328            0 !== e.start && (e.start = r), e.duration = i - e.start, e.startPTS = r, e.maxStartPTS = s, e.startDTS = n, e.endPTS = i, e.minEndPTS = o, e.endDTS = a;
23329            var c, f = e.sn;
23330            if (!t || f < t.startSN || f > t.endSN) return 0;
23331            var g = f - t.startSN,
23332                v = t.fragments;
23333            for (v[g] = e, c = g; c > 0; c--) nr(v[c], v[c - 1]);
23334            for (c = g; c < v.length - 1; c++) nr(v[c], v[c + 1]);
23335            return t.fragmentHint && nr(v[v.length - 1], t.fragmentHint), t.PTSKnown = t.alignedSliding = !0, d
23336        }
23337
23338        function sr(t, e) {
23339            for (var r = null, i = t.fragments, n = i.length - 1; n >= 0; n--) {
23340                var a = i[n].initSegment;
23341                if (a) {
23342                    r = a;
23343                    break
23344                }
23345            }
23346            t.fragmentHint && delete t.fragmentHint.endPTS;
23347            var s, l, u, h, d, c = 0;
23348            if (function (t, e, r) {
23349                    for (var i = e.skippedSegments, n = Math.max(t.startSN, e.startSN) - e.startSN, a = (t.fragmentHint ? 1 : 0) + (i ? e.endSN : Math.min(t.endSN, e.endSN)) - e.startSN, s = e.startSN - t.startSN, o = e.fragmentHint ? e.fragments.concat(e.fragmentHint) : e.fragments, l = t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments, u = n; u <= a; u++) {
23350                        var h = l[s + u],
23351                            d = o[u];
23352                        i && !d && u < i && (d = e.fragments[u] = h), h && d && r(h, d)
23353                    }
23354                }(t, e, (function (t, i) {
23355                    t.relurl && (c = t.cc - i.cc), y(t.startPTS) && y(t.endPTS) && (i.start = i.startPTS = t.startPTS, i.startDTS = t.startDTS, i.maxStartPTS = t.maxStartPTS, i.endPTS = t.endPTS, i.endDTS = t.endDTS, i.minEndPTS = t.minEndPTS, i.duration = t.endPTS - t.startPTS, i.duration && (s = i), e.PTSKnown = e.alignedSliding = !0), i.elementaryStreams = t.elementaryStreams, i.loader = t.loader, i.stats = t.stats, t.initSegment && (i.initSegment = t.initSegment, r = t.initSegment)
23356                })), r && (e.fragmentHint ? e.fragments.concat(e.fragmentHint) : e.fragments).forEach((function (t) {
23357                    var e;
23358                    !t || t.initSegment && t.initSegment.relurl !== (null == (e = r) ? void 0 : e.relurl) || (t.initSegment = r)
23359                })), e.skippedSegments)
23360                if (e.deltaUpdateFailed = e.fragments.some((function (t) {
23361                        return !t
23362                    })), e.deltaUpdateFailed) {
23363                    w.warn("[level-helper] Previous playlist missing segments ski
vendor: 10,544 bytes, lines 23363-23573
23363pped in delta playlist");
23364                    for (var f = e.skippedSegments; f--;) e.fragments.shift();
23365                    e.startSN = e.fragments[0].sn, e.startCC = e.fragments[0].cc
23366                } else e.canSkipDateRanges && (e.dateRanges = (l = t.dateRanges, u = e.dateRanges, h = e.recentlyRemovedDateranges, d = o({}, l), h && h.forEach((function (t) {
23367                    delete d[t]
23368                })), Object.keys(u).forEach((function (t) {
23369                    var e = new F(u[t].attr, d[t]);
23370                    e.isValid ? d[t] = e : w.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "' + JSON.stringify(u[t].attr) + '"')
23371                })), d));
23372            var g = e.fragments;
23373            if (c) {
23374                w.warn("discontinuity sliding from playlist, take drift into account");
23375                for (var v = 0; v < g.length; v++) g[v].cc += c
23376            }
23377            e.skippedSegments && (e.startCC = e.fragments[0].cc),
23378                function (t, e, r) {
23379                    if (t && e)
23380                        for (var i = 0, n = 0, a = t.length; n <= a; n++) {
23381                            var s = t[n],
23382                                o = e[n + i];
23383                            s && o && s.index === o.index && s.fragment.sn === o.fragment.sn ? r(s, o) : i--
23384                        }
23385                }(t.partList, e.partList, (function (t, e) {
23386                    e.elementaryStreams = t.elementaryStreams, e.stats = t.stats
23387                })), s ? ar(e, s, s.startPTS, s.endPTS, s.startDTS, s.endDTS) : or(t, e), g.length && (e.totalduration = e.edge - g[0].start), e.driftStartTime = t.driftStartTime, e.driftStart = t.driftStart;
23388            var m = e.advancedDateTime;
23389            if (e.advanced && m) {
23390                var p = e.edge;
23391                e.driftStart || (e.driftStartTime = m, e.driftStart = p), e.driftEndTime = m, e.driftEnd = p
23392            } else e.driftEndTime = t.driftEndTime, e.driftEnd = t.driftEnd, e.advancedDateTime = t.advancedDateTime
23393        }
23394
23395        function or(t, e) {
23396            var r = e.startSN + e.skippedSegments - t.startSN,
23397                i = t.fragments;
23398            r < 0 || r >= i.length || lr(e, i[r].start)
23399        }
23400
23401        function lr(t, e) {
23402            if (e) {
23403                for (var r = t.fragments, i = t.skippedSegments; i < r.length; i++) r[i].start += e;
23404                t.fragmentHint && (t.fragmentHint.start += e)
23405            }
23406        }
23407
23408        function ur(t, e, r) {
23409            var i;
23410            return null != t && t.details ? hr(null == (i = t.details) ? void 0 : i.partList, e, r) : null
23411        }
23412
23413        function hr(t, e, r) {
23414            if (t)
23415                for (var i = t.length; i--;) {
23416                    var n = t[i];
23417                    if (n.index === r && n.fragment.sn === e) return n
23418                }
23419            return null
23420        }
23421
23422        function dr(t) {
23423            t.forEach((function (t, e) {
23424                var r = t.details;
23425                null != r && r.fragments && r.fragments.forEach((function (t) {
23426                    t.level = e
23427                }))
23428            }))
23429        }
23430
23431        function cr(t) {
23432            switch (t.details) {
23433            case A.FRAG_LOAD_TIMEOUT:
23434            case A.KEY_LOAD_TIMEOUT:
23435            case A.LEVEL_LOAD_TIMEOUT:
23436            case A.MANIFEST_LOAD_TIMEOUT:
23437                return !0
23438            }
23439            return !1
23440        }
23441
23442        function fr(t, e) {
23443            var r = cr(e);
23444            return t.default[(r ? "timeout" : "error") + "Retry"]
23445        }
23446
23447        function gr(t, e) {
23448            var r = "linear" === t.backoff ? 1 : Math.pow(2, e);
23449            return Math.min(r * t.retryDelayMs, t.maxRetryDelayMs)
23450        }
23451
23452        function vr(t) {
23453            return i(i({}, t), {
23454                errorRetry: null,
23455                timeoutRetry: null
23456            })
23457        }
23458
23459        function mr(t, e, r, i) {
23460            if (!t) return !1;
23461            var n = null == i ? void 0 : i.code,
23462                a = e < t.maxNumRetry && (function (t) {
23463                    return 0 === t && !1 === navigator.onLine || !!t && (t < 400 || t > 499)
23464                }(n) || !!r);
23465            return t.shouldRetry ? t.shouldRetry(t, e, r, i, a) : a
23466        }
23467        var pr = function (t, e) {
23468            for (var r = 0, i = t.length - 1, n = null, a = null; r <= i;) {
23469                var s = e(a = t[n = (r + i) / 2 | 0]);
23470                if (s > 0) r = n + 1;
23471                else {
23472                    if (!(s < 0)) return a;
23473                    i = n - 1
23474                }
23475            }
23476            return null
23477        };
23478
23479        function yr(t, e, r, i) {
23480            void 0 === r && (r = 0), void 0 === i && (i = 0);
23481            var n = null;
23482            if (t) {
23483                n = e[t.sn - e[0].sn + 1] || null;
23484                var a = t.endDTS - r;
23485                a > 0 && a < 15e-7 && (r += 15e-7)
23486            } else 0 === r && 0 === e[0].start && (n = e[0]);
23487            if (n && (!t || t.level === n.level) && 0 === Er(r, i, n)) return n;
23488            var s = pr(e, Er.bind(null, r, i));
23489            return !s || s === t && n ? n : s
23490        }
23491
23492        function Er(t, e, r) {
23493            if (void 0 === t && (t = 0), void 0 === e && (e = 0), r.start <= t && r.start + r.duration > t) return 0;
23494            var i = Math.min(e, r.duration + (r.deltaPTS ? r.deltaPTS : 0));
23495            return r.start + r.duration - i <= t ? 1 : r.start - i > t && r.start ? -1 : 0
23496        }
23497
23498        function Tr(t, e, r) {
23499            var i = 1e3 * Math.min(e, r.duration + (r.deltaPTS ? r.deltaPTS : 0));
23500            return (r.endProgramDateTime || 0) - i > t
23501        }
23502        var Sr = 0,
23503            Lr = 2,
23504            Ar = 3,
23505            Rr = 5,
23506            kr = 0,
23507            br = 1,
23508            Dr = 2,
23509            Ir = function () {
23510                function t(t) {
23511                    this.hls = void 0, this.playlistError = 0, this.penalizedRenditions = {}, this.log = void 0, this.warn = void 0, this.error = void 0, this.hls = t, this.log = w.log.bind(w, "[info]:"), this.warn = w.warn.bind(w, "[warning]:"), this.error = w.error.bind(w, "[error]:"), this.registerListeners()
23512                }
23513                var e = t.prototype;
23514                return e.registerListeners = function () {
23515                    var t = this.hls;
23516                    t.on(S.ERROR, this.onError, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.LEVEL_UPDATED, this.onLevelUpdated, this)
23517                }, e.unregisterListeners = function () {
23518                    var t = this.hls;
23519                    t && (t.off(S.ERROR, this.onError, this), t.off(S.ERROR, this.onErrorOut, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.LEVEL_UPDATED, this.onLevelUpdated, this))
23520                }, e.destroy = function () {
23521                    this.unregisterListeners(), this.hls = null, this.penalizedRenditions = {}
23522                }, e.startLoad = function (t) {}, e.stopLoad = function () {
23523                    this.playlistError = 0
23524                }, e.getVariantLevelIndex = function (t) {
23525                    return (null == t ? void 0 : t.type) === we ? t.level : this.hls.loadLevel
23526                }, e.onManifestLoading = function () {
23527                    this.playlistError = 0, this.penalizedRenditions = {}
23528                }, e.onLevelUpdated = function () {
23529                    this.playlistError = 0
23530                }, e.onError = function (t, e) {
23531                    var r, i;
23532                    if (!e.fatal) {
23533                        var n = this.hls,
23534                            a = e.context;
23535                        switch (e.details) {
23536                        case A.FRAG_LOAD_ERROR:
23537                        case A.FRAG_LOAD_TIMEOUT:
23538                        case A.KEY_LOAD_ERROR:
23539                        case A.KEY_LOAD_TIMEOUT:
23540                            return void(e.errorAction = this.getFragRetryOrSwitchAction(e));
23541                        case A.FRAG_PARSING_ERROR:
23542                            if (null != (r = e.frag) && r.gap) return void(e.errorAction = {
23543                                action: Sr,
23544                                flags: kr
23545                            });
23546                        case A.FRAG_GAP:
23547                        case A.FRAG_DECRYPT_ERROR:
23548                            return e.errorAction = this.getFragRetryOrSwitchAction(e), void(e.errorAction.action = Lr);
23549                        case A.LEVEL_EMPTY_ERROR:
23550                        case A.LEVEL_PARSING_ERROR:
23551                            var s, o, l = e.parent === we ? e.level : n.loadLevel;
23552                            return void(e.details === A.LEVEL_EMPTY_ERROR && null != (s = e.context) && null != (o = s.levelDetails) && o.live ? e.errorAction = this.getPlaylistRetryOrSwitchAction(e, l) : (e.levelRetry = !1, e.errorAction = this.getLevelSwitchAction(e, l)));
23553                        case A.LEVEL_LOAD_ERROR:
23554                        case A.LEVEL_LOAD_TIMEOUT:
23555                            return void("number" == typeof (null == a ? void 0 : a.level) && (e.errorAction = this.getPlaylistRetryOrSwitchAction(e, a.level)));
23556                        case A.AUDIO_TRACK_LOAD_ERROR:
23557                        case A.AUDIO_TRACK_LOAD_TIMEOUT:
23558                        case A.SUBTITLE_LOAD_ERROR:
23559                        case A.SUBTITLE_TRACK_LOAD_TIMEOUT:
23560                            if (a) {
23561                                var u = n.levels[n.loadLevel];
23562                                if (u && (a.type === De && u.hasAudioGroup(a.groupId) || a.type === Ie && u.hasSubtitleGroup(a.groupId))) return e.errorAction = this.getPlaylistRetryOrSwitchAction(e, n.loadLevel), e.errorAction.action = Lr, void(e.errorAction.flags = br)
23563                            }
23564                            return;
23565                        case A.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:
23566                            var h = n.levels[n.loadLevel],
23567                                d = null == h ? void 0 : h.attrs["HDCP-LEVEL"];
23568                            return void(d ? e.errorAction = {
23569                                action: Lr,
23570                                flags: Dr,
23571                                hdcpLevel: d
23572                            } : this.keySystemError(e));
23573                        case A.BUFFER_ADD_CODEC_ERROR:
vendor: 3,997 bytes, lines 23574-23642
23574                        case A.REMUX_ALLOC_ERROR:
23575                        case A.BUFFER_APPEND_ERROR:
23576                            return void(e.errorAction = this.getLevelSwitchAction(e, null != (i = e.level) ? i : n.loadLevel));
23577                        case A.INTERNAL_EXCEPTION:
23578                        case A.BUFFER_APPENDING_ERROR:
23579                        case A.BUFFER_FULL_ERROR:
23580                        case A.LEVEL_SWITCH_ERROR:
23581                        case A.BUFFER_STALLED_ERROR:
23582                        case A.BUFFER_SEEK_OVER_HOLE:
23583                        case A.BUFFER_NUDGE_ON_STALL:
23584                            return void(e.errorAction = {
23585                                action: Sr,
23586                                flags: kr
23587                            })
23588                        }
23589                        e.type === L.KEY_SYSTEM_ERROR && this.keySystemError(e)
23590                    }
23591                }, e.keySystemError = function (t) {
23592                    var e = this.getVariantLevelIndex(t.frag);
23593                    t.levelRetry = !1, t.errorAction = this.getLevelSwitchAction(t, e)
23594                }, e.getPlaylistRetryOrSwitchAction = function (t, e) {
23595                    var r = fr(this.hls.config.playlistLoadPolicy, t),
23596                        i = this.playlistError++;
23597                    if (mr(r, i, cr(t), t.response)) return {
23598                        action: Rr,
23599                        flags: kr,
23600                        retryConfig: r,
23601                        retryCount: i
23602                    };
23603                    var n = this.getLevelSwitchAction(t, e);
23604                    return r && (n.retryConfig = r, n.retryCount = i), n
23605                }, e.getFragRetryOrSwitchAction = function (t) {
23606                    var e = this.hls,
23607                        r = this.getVariantLevelIndex(t.frag),
23608                        i = e.levels[r],
23609                        n = e.config,
23610                        a = n.fragLoadPolicy,
23611                        s = n.keyLoadPolicy,
23612                        o = fr(t.details.startsWith("key") ? s : a, t),
23613                        l = e.levels.reduce((function (t, e) {
23614                            return t + e.fragmentError
23615                        }), 0);
23616                    if (i && (t.details !== A.FRAG_GAP && i.fragmentError++, mr(o, l, cr(t), t.response))) return {
23617                        action: Rr,
23618                        flags: kr,
23619                        retryConfig: o,
23620                        retryCount: l
23621                    };
23622                    var u = this.getLevelSwitchAction(t, r);
23623                    return o && (u.retryConfig = o, u.retryCount = l), u
23624                }, e.getLevelSwitchAction = function (t, e) {
23625                    var r = this.hls;
23626                    null == e && (e = r.loadLevel);
23627                    var i = this.hls.levels[e];
23628                    if (i) {
23629                        var n, a, s = t.details;
23630                        i.loadError++, s === A.BUFFER_APPEND_ERROR && i.fragmentError++;
23631                        var o = -1,
23632                            l = r.levels,
23633                            u = r.loadLevel,
23634                            h = r.minAutoLevel,
23635                            d = r.maxAutoLevel;
23636                        r.autoLevelEnabled || (r.loadLevel = -1);
23637                        for (var c, f = null == (n = t.frag) ? void 0 : n.type, g = (f === Ce && s === A.FRAG_PARSING_ERROR || "audio" === t.sourceBufferName && (s === A.BUFFER_ADD_CODEC_ERROR || s === A.BUFFER_APPEND_ERROR)) && l.some((function (t) {
23638                                var e = t.audioCodec;
23639                                return i.audioCodec !== e
23640                            })), v = "video" === t.sourceBufferName && (s === A.BUFFER_ADD_CODEC_ERROR || s === A.BUFFER_APPEND_ERROR) && l.some((function (t) {
23641                                var e = t.codecSet,
23642                                    r = t.audioCodec;
vendor: 14,227 bytes, lines 23643-23857
23643                                return i.codecSet !== e && i.audioCodec === r
23644                            })), m = null != (a = t.context) ? a : {}, p = m.type, y = m.groupId, E = function () {
23645                                var e = (T + u) % l.length;
23646                                if (e !== u && e >= h && e <= d && 0 === l[e].loadError) {
23647                                    var r, n, a = l[e];
23648                                    if (s === A.FRAG_GAP && t.frag) {
23649                                        var c = l[e].details;
23650                                        if (c) {
23651                                            var m = yr(t.frag, c.fragments, t.frag.start);
23652                                            if (null != m && m.gap) return 0
23653                                        }
23654                                    } else {
23655                                        if (p === De && a.hasAudioGroup(y) || p === Ie && a.hasSubtitleGroup(y)) return 0;
23656                                        if (f === Ce && null != (r = i.audioGroups) && r.some((function (t) {
23657                                                return a.hasAudioGroup(t)
23658                                            })) || f === _e && null != (n = i.subtitleGroups) && n.some((function (t) {
23659                                                return a.hasSubtitleGroup(t)
23660                                            })) || g && i.audioCodec === a.audioCodec || !g && i.audioCodec !== a.audioCodec || v && i.codecSet === a.codecSet) return 0
23661                                    }
23662                                    return o = e, 1
23663                                }
23664                            }, T = l.length; T-- && (0 === (c = E()) || 1 !== c););
23665                        if (o > -1 && r.loadLevel !== o) return t.levelRetry = !0, this.playlistError = 0, {
23666                            action: Lr,
23667                            flags: kr,
23668                            nextAutoLevel: o
23669                        }
23670                    }
23671                    return {
23672                        action: Lr,
23673                        flags: br
23674                    }
23675                }, e.onErrorOut = function (t, e) {
23676                    var r;
23677                    switch (null == (r = e.errorAction) ? void 0 : r.action) {
23678                    case Sr:
23679                        break;
23680                    case Lr:
23681                        this.sendAlternateToPenaltyBox(e), e.errorAction.resolved || e.details === A.FRAG_GAP ? /MediaSource readyState: ended/.test(e.error.message) && (this.warn('MediaSource ended after "' + e.sourceBufferName + '" sourceBuffer append error. Attempting to recover from media error.'), this.hls.recoverMediaError()) : e.fatal = !0
23682                    }
23683                    e.fatal && this.hls.stopLoad()
23684                }, e.sendAlternateToPenaltyBox = function (t) {
23685                    var e = this.hls,
23686                        r = t.errorAction;
23687                    if (r) {
23688                        var i = r.flags,
23689                            n = r.hdcpLevel,
23690                            a = r.nextAutoLevel;
23691                        switch (i) {
23692                        case kr:
23693                            this.switchLevel(t, a);
23694                            break;
23695                        case Dr:
23696                            n && (e.maxHdcpLevel = ze[ze.indexOf(n) - 1], r.resolved = !0), this.warn('Restricting playback to HDCP-LEVEL of "' + e.maxHdcpLevel + '" or lower')
23697                        }
23698                        r.resolved || this.switchLevel(t, a)
23699                    }
23700                }, e.switchLevel = function (t, e) {
23701                    void 0 !== e && t.errorAction && (this.warn("switching to level " + e + " after " + t.details), this.hls.nextAutoLevel = e, t.errorAction.resolved = !0, this.hls.nextLoadLevel = this.hls.nextAutoLevel)
23702                }, t
23703            }(),
23704            wr = function () {
23705                function t(t, e) {
23706                    this.hls = void 0, this.timer = -1, this.requestScheduled = -1, this.canLoad = !1, this.log = void 0, this.warn = void 0, this.log = w.log.bind(w, e + ":"), this.warn = w.warn.bind(w, e + ":"), this.hls = t
23707                }
23708                var e = t.prototype;
23709                return e.destroy = function () {
23710                    this.clearTimer(), this.hls = this.log = this.warn = null
23711                }, e.clearTimer = function () {
23712                    -1 !== this.timer && (self.clearTimeout(this.timer), this.timer = -1)
23713                }, e.startLoad = function () {
23714                    this.canLoad = !0, this.requestScheduled = -1, this.loadPlaylist()
23715                }, e.stopLoad = function () {
23716                    this.canLoad = !1, this.clearTimer()
23717                }, e.switchParams = function (t, e, r) {
23718                    var i = null == e ? void 0 : e.renditionReports;
23719                    if (i) {
23720                        for (var n = -1, a = 0; a < i.length; a++) {
23721                            var s = i[a],
23722                                o = void 0;
23723                            try {
23724                                o = new self.URL(s.URI, e.url).href
23725                            } catch (t) {
23726                                w.warn("Could not construct new URL for Rendition Report: " + t), o = s.URI || ""
23727                            }
23728                            if (o === t) {
23729                                n = a;
23730                                break
23731                            }
23732                            o === t.substring(0, o.length) && (n = a)
23733                        }
23734                        if (-1 !== n) {
23735                            var l = i[n],
23736                                u = parseInt(l["LAST-MSN"]) || (null == e ? void 0 : e.lastPartSn),
23737                                h = parseInt(l["LAST-PART"]) || (null == e ? void 0 : e.lastPartIndex);
23738                            if (this.hls.config.lowLatencyMode) {
23739                                var d = Math.min(e.age - e.partTarget, e.targetduration);
23740                                h >= 0 && d > e.partTarget && (h += 1)
23741                            }
23742                            var c = r && tr(r);
23743                            return new er(u, h >= 0 ? h : void 0, c)
23744                        }
23745                    }
23746                }, e.loadPlaylist = function (t) {
23747                    -1 === this.requestScheduled && (this.requestScheduled = self.performance.now())
23748                }, e.shouldLoadPlaylist = function (t) {
23749                    return this.canLoad && !!t && !!t.url && (!t.details || t.details.live)
23750                }, e.shouldReloadPlaylist = function (t) {
23751                    return -1 === this.timer && -1 === this.requestScheduled && this.shouldLoadPlaylist(t)
23752                }, e.playlistLoaded = function (t, e, r) {
23753                    var i = this,
23754                        n = e.details,
23755                        a = e.stats,
23756                        s = self.performance.now(),
23757                        o = a.loading.first ? Math.max(0, s - a.loading.first) : 0;
23758                    if (n.advancedDateTime = Date.now() - o, n.live || null != r && r.live) {
23759                        if (n.reloaded(r), r && this.log("live playlist " + t + " " + (n.advanced ? "REFRESHED " + n.lastPartSn + "-" + n.lastPartIndex : n.updated ? "UPDATED" : "MISSED")), r && n.fragments.length > 0 && sr(r, n), !this.canLoad || !n.live) return;
23760                        var l, u = void 0,
23761                            h = void 0;
23762                        if (n.canBlockReload && n.endSN && n.advanced) {
23763                            var d = this.hls.config.lowLatencyMode,
23764                                c = n.lastPartSn,
23765                                f = n.endSN,
23766                                g = n.lastPartIndex,
23767                                v = c === f; - 1 !== g ? (u = v ? f + 1 : c, h = v ? d ? 0 : g : g + 1) : u = f + 1;
23768                            var m = n.age,
23769                                p = m + n.ageHeader,
23770                                y = Math.min(p - n.partTarget, 1.5 * n.targetduration);
23771                            if (y > 0) {
23772                                if (r && y > r.tuneInGoal) this.warn("CDN Tune-in goal increased from: " + r.tuneInGoal + " to: " + y + " with playlist age: " + n.age), y = 0;
23773                                else {
23774                                    var E = Math.floor(y / n.targetduration);
23775                                    u += E, void 0 !== h && (h += Math.round(y % n.targetduration / n.partTarget)), this.log("CDN Tune-in age: " + n.ageHeader + "s last advanced " + m.toFixed(2) + "s goal: " + y + " skip sn " + E + " to part " + h)
23776                                }
23777                                n.tuneInGoal = y
23778                            }
23779                            if (l = this.getDeliveryDirectives(n, e.deliveryDirectives, u, h), d || !v) return void this.loadPlaylist(l)
23780                        } else(n.canBlockReload || n.canSkipUntil) && (l = this.getDeliveryDirectives(n, e.deliveryDirectives, u, h));
23781                        var T = this.hls.mainForwardBufferInfo,
23782                            S = T ? T.end - T.len : 0,
23783                            L = function (t, e) {
23784                                void 0 === e && (e = 1 / 0);
23785                                var r = 1e3 * t.targetduration;
23786                                if (t.updated) {
23787                                    var i = t.fragments;
23788                                    if (i.length && 4 * r > e) {
23789                                        var n = 1e3 * i[i.length - 1].duration;
23790                                        n < r && (r = n)
23791                                    }
23792                                } else r /= 2;
23793                                return Math.round(r)
23794                            }(n, 1e3 * (n.edge - S));
23795                        n.updated && s > this.requestScheduled + L && (this.requestScheduled = a.loading.start), void 0 !== u && n.canBlockReload ? this.requestScheduled = a.loading.first + L - (1e3 * n.partTarget || 1e3) : -1 === this.requestScheduled || this.requestScheduled + L < s ? this.requestScheduled = s : this.requestScheduled - s <= 0 && (this.requestScheduled += L);
23796                        var A = this.requestScheduled - s;
23797                        A = Math.max(0, A), this.log("reload live playlist " + t + " in " + Math.round(A) + " ms"), this.timer = self.setTimeout((function () {
23798                            return i.loadPlaylist(l)
23799                        }), A)
23800                    } else this.clearTimer()
23801                }, e.getDeliveryDirectives = function (t, e, r, i) {
23802                    var n = tr(t);
23803                    return null != e && e.skip && t.deltaUpdateFailed && (r = e.msn, i = e.part, n = Je), new er(r, i, n)
23804                }, e.checkRetry = function (t) {
23805                    var e = this,
23806                        r = t.details,
23807                        i = cr(t),
23808                        n = t.errorAction,
23809                        a = n || {},
23810                        s = a.action,
23811                        o = a.retryCount,
23812                        l = void 0 === o ? 0 : o,
23813                        u = a.retryConfig,
23814                        h = !!n && !!u && (s === Rr || !n.resolved && s === Lr);
23815                    if (h) {
23816                        var d;
23817                        if (this.requestScheduled = -1, l >= u.maxNumRetry) return !1;
23818                        if (i && null != (d = t.context) && d.deliveryDirectives) this.warn("Retrying playlist loading " + (l + 1) + "/" + u.maxNumRetry + ' after "' + r + '" without delivery-directives'), this.loadPlaylist();
23819                        else {
23820                            var c = gr(u, l);
23821                            this.timer = self.setTimeout((function () {
23822                                return e.loadPlaylist()
23823                            }), c), this.warn("Retrying playlist loading " + (l + 1) + "/" + u.maxNumRetry + ' after "' + r + '" in ' + c + "ms")
23824                        }
23825                        t.levelRetry = !0, n.resolved = !0
23826                    }
23827                    return h
23828                }, t
23829            }(),
23830            Cr = function () {
23831                function t(t, e, r) {
23832                    void 0 === e && (e = 0), void 0 === r && (r = 0), this.halfLife = void 0, this.alpha_ = void 0, this.estimate_ = void 0, this.totalWeight_ = void 0, this.halfLife = t, this.alpha_ = t ? Math.exp(Math.log(.5) / t) : 0, this.estimate_ = e, this.totalWeight_ = r
23833                }
23834                var e = t.prototype;
23835                return e.sample = function (t, e) {
23836                    var r = Math.pow(this.alpha_, t);
23837                    this.estimate_ = e * (1 - r) + r * this.estimate_, this.totalWeight_ += t
23838                }, e.getTotalWeight = function () {
23839                    return this.totalWeight_
23840                }, e.getEstimate = function () {
23841                    if (this.alpha_) {
23842                        var t = 1 - Math.pow(this.alpha_, this.totalWeight_);
23843                        if (t) return this.estimate_ / t
23844                    }
23845                    return this.estimate_
23846                }, t
23847            }(),
23848            _r = function () {
23849                function t(t, e, r, i) {
23850                    void 0 === i && (i = 100), this.defaultEstimate_ = void 0, this.minWeight_ = void 0, this.minDelayMs_ = void 0, this.slow_ = void 0, this.fast_ = void 0, this.defaultTTFB_ = void 0, this.ttfb_ = void 0, this.defaultEstimate_ = r, this.minWeight_ = .001, this.minDelayMs_ = 50, this.slow_ = new Cr(t), this.fast_ = new Cr(e), this.defaultTTFB_ = i, this.ttfb_ = new Cr(t)
23851                }
23852                var e = t.prototype;
23853                return e.update = function (t, e) {
23854                    var r = this.slow_,
23855                        i = this.fast_,
23856                        n = this.ttfb_;
23857                    r.halfLife !== t && (this.slow_ = new Cr(t, r.getEstimate(), r.getTotalWeight(
vendor: 7,314 bytes, lines 23857-24019
23857))), i.halfLife !== e && (this.fast_ = new Cr(e, i.getEstimate(), i.getTotalWeight())), n.halfLife !== t && (this.ttfb_ = new Cr(t, n.getEstimate(), n.getTotalWeight()))
23858                }, e.sample = function (t, e) {
23859                    var r = (t = Math.max(t, this.minDelayMs_)) / 1e3,
23860                        i = 8 * e / r;
23861                    this.fast_.sample(r, i), this.slow_.sample(r, i)
23862                }, e.sampleTTFB = function (t) {
23863                    var e = t / 1e3,
23864                        r = Math.sqrt(2) * Math.exp(-Math.pow(e, 2) / 2);
23865                    this.ttfb_.sample(r, Math.max(t, 5))
23866                }, e.canEstimate = function () {
23867                    return this.fast_.getTotalWeight() >= this.minWeight_
23868                }, e.getEstimate = function () {
23869                    return this.canEstimate() ? Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()) : this.defaultEstimate_
23870                }, e.getEstimateTTFB = function () {
23871                    return this.ttfb_.getTotalWeight() >= this.minWeight_ ? this.ttfb_.getEstimate() : this.defaultTTFB_
23872                }, e.destroy = function () {}, t
23873            }(),
23874            xr = {
23875                supported: !0,
23876                configurations: [],
23877                decodingInfoResults: [{
23878                    supported: !0,
23879                    powerEfficient: !0,
23880                    smooth: !0
23881                }]
23882            },
23883            Pr = {};
23884
23885        function Fr(t, e, r) {
23886            var n = t.videoCodec,
23887                a = t.audioCodec;
23888            if (!n || !a || !r) return Promise.resolve(xr);
23889            var s = {
23890                    width: t.width,
23891                    height: t.height,
23892                    bitrate: Math.ceil(Math.max(.9 * t.bitrate, t.averageBitrate)),
23893                    framerate: t.frameRate || 30
23894                },
23895                o = t.videoRange;
23896            "SDR" !== o && (s.transferFunction = o.toLowerCase());
23897            var l = n.split(",").map((function (t) {
23898                return {
23899                    type: "media-source",
23900                    video: i(i({}, s), {}, {
23901                        contentType: ae(t, "video")
23902                    })
23903                }
23904            }));
23905            return a && t.audioGroups && t.audioGroups.forEach((function (t) {
23906                var r;
23907                t && (null == (r = e.groups[t]) || r.tracks.forEach((function (e) {
23908                    if (e.groupId === t) {
23909                        var r = e.channels || "",
23910                            i = parseFloat(r);
23911                        y(i) && i > 2 && l.push.apply(l, a.split(",").map((function (t) {
23912                            return {
23913                                type: "media-source",
23914                                audio: {
23915                                    contentType: ae(t, "audio"),
23916                                    channels: "" + i
23917                                }
23918                            }
23919                        })))
23920                    }
23921                })))
23922            })), Promise.all(l.map((function (t) {
23923                var e = function (t) {
23924                    var e = t.audio,
23925                        r = t.video,
23926                        i = r || e;
23927                    if (i) {
23928                        var n = i.contentType.split('"')[1];
23929                        if (r) return "r" + r.height + "x" + r.width + "f" + Math.ceil(r.framerate) + (r.transferFunction || "sd") + "_" + n + "_" + Math.ceil(r.bitrate / 1e5);
23930                        if (e) return "c" + e.channels + (e.spatialRendering ? "s" : "n") + "_" + n
23931                    }
23932                    return ""
23933                }(t);
23934                return Pr[e] || (Pr[e] = r.decodingInfo(t))
23935            }))).then((function (t) {
23936                return {
23937                    supported: !t.some((function (t) {
23938                        return !t.supported
23939                    })),
23940                    configurations: l,
23941                    decodingInfoResults: t
23942                }
23943            })).catch((function (t) {
23944                return {
23945                    supported: !1,
23946                    configurations: l,
23947                    decodingInfoResults: [],
23948                    error: t
23949                }
23950            }))
23951        }
23952
23953        function Mr(t, e) {
23954            var r = !1,
23955                i = [];
23956            return t && (r = "SDR" !== t, i = [t]), e && (i = e.allowedVideoRanges || Qe.slice(0), i = (r = void 0 !== e.preferHDR ? e.preferHDR : function () {
23957                if ("function" == typeof matchMedia) {
23958                    var t = matchMedia("(dynamic-range: high)"),
23959                        e = matchMedia("bad query");
23960                    if (t.media !== e.media) return !0 === t.matches
23961                }
23962                return !1
23963            }()) ? i.filter((function (t) {
23964                return "SDR" !== t
23965            })) : ["SDR"]), {
23966                preferHDR: r,
23967                allowedVideoRanges: i
23968            }
23969        }
23970
23971        function Or(t, e) {
23972            w.log('[abr] start candidates with "' + t + '" ignored because ' + e)
23973        }
23974
23975        function Nr(t, e, r) {
23976            if ("attrs" in t) {
23977                var i = e.indexOf(t);
23978                if (-1 !== i) return i
23979            }
23980            for (var n = 0; n < e.length; n++)
23981                if (Ur(t, e[n], r)) return n;
23982            return -1
23983        }
23984
23985        function Ur(t, e, r) {
23986            var i = t.groupId,
23987                n = t.name,
23988                a = t.lang,
23989                s = t.assocLang,
23990                o = t.characteristics,
23991                l = t.default,
23992                u = t.forced;
23993            return (void 0 === i || e.groupId === i) && (void 0 === n || e.name === n) && (void 0 === a || e.lang === a) && (void 0 === a || e.assocLang === s) && (void 0 === l || e.default === l) && (void 0 === u || e.forced === u) && (void 0 === o || function (t, e) {
23994                void 0 === e && (e = "");
23995                var r = t.split(","),
23996                    i = e.split(",");
23997                return r.length === i.length && !r.some((function (t) {
23998                    return -1 === i.indexOf(t)
23999                }))
24000            }(o, e.characteristics)) && (void 0 === r || r(t, e))
24001        }
24002
24003        function Br(t, e) {
24004            var r = t.audioCodec,
24005                i = t.channels;
24006            return !(void 0 !== r && (e.audioCodec || "").substring(0, 4) !== r.substring(0, 4) || void 0 !== i && i !== (e.channels || "2"))
24007        }
24008
24009        function Gr(t, e, r) {
24010            for (var i = e; i; i--)
24011                if (r(t[i])) return i;
24012            for (var n = e + 1; n < t.length; n++)
24013                if (r(t[n])) return n;
24014            return -1
24015        }
24016        var Kr = function () {
24017                function t(t) {
24018                    var e = this;
24019                    this.hls = void 0, this.lastLevelLoadSec = 0, this.lastLoadedFragLevel = -1, this.firstSelection = -1, this._nextAutoLevel = -1, this.nextAutoLevelKey = "", this.audioTracksByGroup = null, this.codecTiers = null, this.timer = -1, this.fragCurrent = null, this.partCurrent = null, this.bitrateTestDelay 
vendor: 10,945 bytes, lines 24019-24156
24019= 0, this.bwEstimator = void 0, this._abandonRulesCheck = function () {
24020                        var t = e.fragCurrent,
24021                            r = e.partCurrent,
24022                            i = e.hls,
24023                            n = i.autoLevelEnabled,
24024                            a = i.media;
24025                        if (t && a) {
24026                            var s = performance.now(),
24027                                o = r ? r.stats : t.stats,
24028                                l = r ? r.duration : t.duration,
24029                                u = s - o.loading.start,
24030                                h = i.minAutoLevel;
24031                            if (o.aborted || o.loaded && o.loaded === o.total || t.level <= h) return e.clearTimer(), void(e._nextAutoLevel = -1);
24032                            if (n && !a.paused && a.playbackRate && a.readyState) {
24033                                var d = i.mainForwardBufferInfo;
24034                                if (null !== d) {
24035                                    var c = e.bwEstimator.getEstimateTTFB(),
24036                                        f = Math.abs(a.playbackRate);
24037                                    if (!(u <= Math.max(c, l / (2 * f) * 1e3))) {
24038                                        var g = d.len / f,
24039                                            v = o.loading.first ? o.loading.first - o.loading.start : -1,
24040                                            m = o.loaded && v > -1,
24041                                            p = e.getBwEstimate(),
24042                                            E = i.levels,
24043                                            T = E[t.level],
24044                                            L = o.total || Math.max(o.loaded, Math.round(l * T.averageBitrate / 8)),
24045                                            A = m ? u - v : u;
24046                                        A < 1 && m && (A = Math.min(u, 8 * o.loaded / p));
24047                                        var R = m ? 1e3 * o.loaded / A : 0,
24048                                            k = R ? (L - o.loaded) / R : 8 * L / p + c / 1e3;
24049                                        if (!(k <= g)) {
24050                                            var b, D = R ? 8 * R : p,
24051                                                I = Number.POSITIVE_INFINITY;
24052                                            for (b = t.level - 1; b > h; b--) {
24053                                                var C = E[b].maxBitrate;
24054                                                if ((I = e.getTimeToLoadFrag(c / 1e3, D, l * C, !E[b].details)) < g) break
24055                                            }
24056                                            if (!(I >= k || I > 10 * l)) {
24057                                                i.nextLoadLevel = i.nextAutoLevel = b, m ? e.bwEstimator.sample(u - Math.min(c, v), o.loaded) : e.bwEstimator.sampleTTFB(u);
24058                                                var _ = E[b].maxBitrate;
24059                                                e.getBwEstimate() * e.hls.config.abrBandWidthUpFactor > _ && e.resetEstimator(_), e.clearTimer(), w.warn("[abr] Fragment " + t.sn + (r ? " part " + r.index : "") + " of level " + t.level + " is loading too slowly;\n      Time to underbuffer: " + g.toFixed(3) + " s\n      Estimated load time for current fragment: " + k.toFixed(3) + " s\n      Estimated load time for down switch fragment: " + I.toFixed(3) + " s\n      TTFB estimate: " + (0 | v) + " ms\n      Current BW estimate: " + (y(p) ? 0 | p : "Unknown") + " bps\n      New BW estimate: " + (0 | e.getBwEstimate()) + " bps\n      Switching to level " + b + " @ " + (0 | _) + " bps"), i.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED, {
24060                                                    frag: t,
24061                                                    part: r,
24062                                                    stats: o
24063                                                })
24064                                            }
24065                                        }
24066                                    }
24067                                }
24068                            }
24069                        }
24070                    }, this.hls = t, this.bwEstimator = this.initEstimator(), this.registerListeners()
24071                }
24072                var e = t.prototype;
24073                return e.resetEstimator = function (t) {
24074                    t && (w.log("setting initial bwe to " + t), this.hls.config.abrEwmaDefaultEstimate = t), this.firstSelection = -1, this.bwEstimator = this.initEstimator()
24075                }, e.initEstimator = function () {
24076                    var t = this.hls.config;
24077                    return new _r(t.abrEwmaSlowVoD, t.abrEwmaFastVoD, t.abrEwmaDefaultEstimate)
24078                }, e.registerListeners = function () {
24079                    var t = this.hls;
24080                    t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.FRAG_LOADING, this.onFragLoading, this), t.on(S.FRAG_LOADED, this.onFragLoaded, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this), t.on(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(S.LEVEL_LOADED, this.onLevelLoaded, this), t.on(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(S.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this), t.on(S.ERROR, this.onError, this)
24081                }, e.unregisterListeners = function () {
24082                    var t = this.hls;
24083                    t && (t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.FRAG_LOADING, this.onFragLoading, this), t.off(S.FRAG_LOADED, this.onFragLoaded, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this), t.off(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(S.LEVEL_LOADED, this.onLevelLoaded, this), t.off(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(S.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this), t.off(S.ERROR, this.onError, this))
24084                }, e.destroy = function () {
24085                    this.unregisterListeners(), this.clearTimer(), this.hls = this._abandonRulesCheck = null, this.fragCurrent = this.partCurrent = null
24086                }, e.onManifestLoading = function (t, e) {
24087                    this.lastLoadedFragLevel = -1, this.firstSelection = -1, this.lastLevelLoadSec = 0, this.fragCurrent = this.partCurrent = null, this.onLevelsUpdated(), this.clearTimer()
24088                }, e.onLevelsUpdated = function () {
24089                    this.lastLoadedFragLevel > -1 && this.fragCurrent && (this.lastLoadedFragLevel = this.fragCurrent.level), this._nextAutoLevel = -1, this.onMaxAutoLevelUpdated(), this.codecTiers = null, this.audioTracksByGroup = null
24090                }, e.onMaxAutoLevelUpdated = function () {
24091                    this.firstSelection = -1, this.nextAutoLevelKey = ""
24092                }, e.onFragLoading = function (t, e) {
24093                    var r, i = e.frag;
24094                    this.ignoreFragment(i) || (i.bitrateTest || (this.fragCurrent = i, this.partCurrent = null != (r = e.part) ? r : null), this.clearTimer(), this.timer = self.setInterval(this._abandonRulesCheck, 100))
24095                }, e.onLevelSwitching = function (t, e) {
24096                    this.clearTimer()
24097                }, e.onError = function (t, e) {
24098                    if (!e.fatal) switch (e.details) {
24099                    case A.BUFFER_ADD_CODEC_ERROR:
24100                    case A.BUFFER_APPEND_ERROR:
24101                        this.lastLoadedFragLevel = -1, this.firstSelection = -1;
24102                        break;
24103                    case A.FRAG_LOAD_TIMEOUT:
24104                        var r = e.frag,
24105                            i = this.fragCurrent,
24106                            n = this.partCurrent;
24107                        if (r && i && r.sn === i.sn && r.level === i.level) {
24108                            var a = performance.now(),
24109                                s = n ? n.stats : r.stats,
24110                                o = a - s.loading.start,
24111                                l = s.loading.first ? s.loading.first - s.loading.start : -1;
24112                            if (s.loaded && l > -1) {
24113                                var u = this.bwEstimator.getEstimateTTFB();
24114                                this.bwEstimator.sample(o - Math.min(u, l), s.loaded)
24115                            } else this.bwEstimator.sampleTTFB(o)
24116                        }
24117                    }
24118                }, e.getTimeToLoadFrag = function (t, e, r, i) {
24119                    return t + r / e + (i ? this.lastLevelLoadSec : 0)
24120                }, e.onLevelLoaded = function (t, e) {
24121                    var r = this.hls.config,
24122                        i = e.stats.loading,
24123                        n = i.end - i.start;
24124                    y(n) && (this.lastLevelLoadSec = n / 1e3), e.details.live ? this.bwEstimator.update(r.abrEwmaSlowLive, r.abrEwmaFastLive) : this.bwEstimator.update(r.abrEwmaSlowVoD, r.abrEwmaFastVoD)
24125                }, e.onFragLoaded = function (t, e) {
24126                    var r = e.frag,
24127                        i = e.part,
24128                        n = i ? i.stats : r.stats;
24129                    if (r.type === we && this.bwEstimator.sampleTTFB(n.loading.first - n.loading.start), !this.ignoreFragment(r)) {
24130                        if (this.clearTimer(), r.level === this._nextAutoLevel && (this._nextAutoLevel = -1), this.firstSelection = -1, this.hls.config.abrMaxWithRealBitrate) {
24131                            var a = i ? i.duration : r.duration,
24132                                s = this.hls.levels[r.level],
24133                                o = (s.loaded ? s.loaded.bytes : 0) + n.loaded,
24134                                l = (s.loaded ? s.loaded.duration : 0) + a;
24135                            s.loaded = {
24136                                bytes: o,
24137                                duration: l
24138                            }, s.realBitrate = Math.round(8 * o / l)
24139                        }
24140                        if (r.bitrateTest) {
24141                            var u = {
24142                                stats: n,
24143                                frag: r,
24144                                part: i,
24145                                id: r.type
24146                            };
24147                            this.onFragBuffered(S.FRAG_BUFFERED, u), r.bitrateTest = !1
24148                        } else this.lastLoadedFragLevel = r.level
24149                    }
24150                }, e.onFragBuffered = function (t, e) {
24151                    var r = e.frag,
24152                        i = e.part,
24153                        n = null != i && i.stats.loaded ? i.stats : r.stats;
24154                    if (!n.aborted && !this.ignoreFragment(r)) {
24155                        var a = n.parsing.end - n.loading.start - Math.min(n.loading.first - n.loading.start, this.bwEstimator.getEstimateTTFB());
24156                        this.bwEstimator.sample(a, n.loaded), n.bwEstimate = this.getBwEstimate(), r.bitrateTest ? this.bitrateTestDelay 
vendor: 22,483 bytes, lines 24156-24470
24156= a / 1e3 : this.bitrateTestDelay = 0
24157                    }
24158                }, e.ignoreFragment = function (t) {
24159                    return t.type !== we || "initSegment" === t.sn
24160                }, e.clearTimer = function () {
24161                    this.timer > -1 && (self.clearInterval(this.timer), this.timer = -1)
24162                }, e.getAutoLevelKey = function () {
24163                    return this.getBwEstimate() + "_" + this.getStarvationDelay().toFixed(2)
24164                }, e.getNextABRAutoLevel = function () {
24165                    var t = this.fragCurrent,
24166                        e = this.partCurrent,
24167                        r = this.hls,
24168                        i = r.maxAutoLevel,
24169                        n = r.config,
24170                        a = r.minAutoLevel,
24171                        s = e ? e.duration : t ? t.duration : 0,
24172                        o = this.getBwEstimate(),
24173                        l = this.getStarvationDelay(),
24174                        u = n.abrBandWidthFactor,
24175                        h = n.abrBandWidthUpFactor;
24176                    if (l) {
24177                        var d = this.findBestLevel(o, a, i, l, 0, u, h);
24178                        if (d >= 0) return d
24179                    }
24180                    var c = s ? Math.min(s, n.maxStarvationDelay) : n.maxStarvationDelay;
24181                    if (!l) {
24182                        var f = this.bitrateTestDelay;
24183                        f && (c = (s ? Math.min(s, n.maxLoadingDelay) : n.maxLoadingDelay) - f, w.info("[abr] bitrate test took " + Math.round(1e3 * f) + "ms, set first fragment max fetchDuration to " + Math.round(1e3 * c) + " ms"), u = h = 1)
24184                    }
24185                    var g = this.findBestLevel(o, a, i, l, c, u, h);
24186                    if (w.info("[abr] " + (l ? "rebuffering expected" : "buffer is empty") + ", optimal quality level " + g), g > -1) return g;
24187                    var v = r.levels[a],
24188                        m = r.levels[r.loadLevel];
24189                    return (null == v ? void 0 : v.bitrate) < (null == m ? void 0 : m.bitrate) ? a : r.loadLevel
24190                }, e.getStarvationDelay = function () {
24191                    var t = this.hls,
24192                        e = t.media;
24193                    if (!e) return 1 / 0;
24194                    var r = e && 0 !== e.playbackRate ? Math.abs(e.playbackRate) : 1,
24195                        i = t.mainForwardBufferInfo;
24196                    return (i ? i.len : 0) / r
24197                }, e.getBwEstimate = function () {
24198                    return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate
24199                }, e.findBestLevel = function (t, e, r, i, n, a, s) {
24200                    var o, l = this,
24201                        u = i + n,
24202                        h = this.lastLoadedFragLevel,
24203                        d = -1 === h ? this.hls.firstLevel : h,
24204                        c = this.fragCurrent,
24205                        f = this.partCurrent,
24206                        g = this.hls,
24207                        v = g.levels,
24208                        m = g.allAudioTracks,
24209                        p = g.loadLevel,
24210                        E = g.config;
24211                    if (1 === v.length) return 0;
24212                    var T, S = v[d],
24213                        L = !(null == S || null == (o = S.details) || !o.live),
24214                        A = -1 === p || -1 === h,
24215                        R = "SDR",
24216                        k = (null == S ? void 0 : S.frameRate) || 0,
24217                        b = E.audioPreference,
24218                        D = E.videoPreference,
24219                        I = this.audioTracksByGroup || (this.audioTracksByGroup = function (t) {
24220                            return t.reduce((function (t, e) {
24221                                var r = t.groups[e.groupId];
24222                                r || (r = t.groups[e.groupId] = {
24223                                    tracks: [],
24224                                    channels: {
24225                                        2: 0
24226                                    },
24227                                    hasDefault: !1,
24228                                    hasAutoSelect: !1
24229                                }), r.tracks.push(e);
24230                                var i = e.channels || "2";
24231                                return r.channels[i] = (r.channels[i] || 0) + 1, r.hasDefault = r.hasDefault || e.default, r.hasAutoSelect = r.hasAutoSelect || e.autoselect, r.hasDefault && (t.hasDefaultAudio = !0), r.hasAutoSelect && (t.hasAutoSelectAudio = !0), t
24232                            }), {
24233                                hasDefaultAudio: !1,
24234                                hasAutoSelectAudio: !1,
24235                                groups: {}
24236                            })
24237                        }(m));
24238                    if (A) {
24239                        if (-1 !== this.firstSelection) return this.firstSelection;
24240                        var C = this.codecTiers || (this.codecTiers = function (t, e, r, i) {
24241                                return t.slice(r, i + 1).reduce((function (t, r) {
24242                                    if (!r.codecSet) return t;
24243                                    var i = r.audioGroups,
24244                                        n = t[r.codecSet];
24245                                    n || (t[r.codecSet] = n = {
24246                                        minBitrate: 1 / 0,
24247                                        minHeight: 1 / 0,
24248                                        minFramerate: 1 / 0,
24249                                        maxScore: 0,
24250                                        videoRanges: {
24251                                            SDR: 0
24252                                        },
24253                                        channels: {
24254                                            2: 0
24255                                        },
24256                                        hasDefaultAudio: !i,
24257                                        fragmentError: 0
24258                                    }), n.minBitrate = Math.min(n.minBitrate, r.bitrate);
24259                                    var a = Math.min(r.height, r.width);
24260                                    return n.minHeight = Math.min(n.minHeight, a), n.minFramerate = Math.min(n.minFramerate, r.frameRate), n.maxScore = Math.max(n.maxScore, r.score), n.fragmentError += r.fragmentError, n.videoRanges[r.videoRange] = (n.videoRanges[r.videoRange] || 0) + 1, i && i.forEach((function (t) {
24261                                        if (t) {
24262                                            var r = e.groups[t];
24263                                            r && (n.hasDefaultAudio = n.hasDefaultAudio || e.hasDefaultAudio ? r.hasDefault : r.hasAutoSelect || !e.hasDefaultAudio && !e.hasAutoSelectAudio, Object.keys(r.channels).forEach((function (t) {
24264                                                n.channels[t] = (n.channels[t] || 0) + r.channels[t]
24265                                            })))
24266                                        }
24267                                    })), t
24268                                }), {})
24269                            }(v, I, e, r)),
24270                            _ = function (t, e, r, i, n) {
24271                                for (var a = Object.keys(t), s = null == i ? void 0 : i.channels, o = null == i ? void 0 : i.audioCodec, l = s && 2 === parseInt(s), u = !0, h = !1, d = 1 / 0, c = 1 / 0, f = 1 / 0, g = 0, v = [], m = Mr(e, n), p = m.preferHDR, E = m.allowedVideoRanges, T = function () {
24272                                        var e = t[a[S]];
24273                                        u = e.channels[2] > 0, d = Math.min(d, e.minHeight), c = Math.min(c, e.minFramerate), f = Math.min(f, e.minBitrate);
24274                                        var r = E.filter((function (t) {
24275                                            return e.videoRanges[t] > 0
24276                                        }));
24277                                        r.length > 0 && (h = !0, v = r)
24278                                    }, S = a.length; S--;) T();
24279                                d = y(d) ? d : 0, c = y(c) ? c : 0;
24280                                var L = Math.max(1080, d),
24281                                    A = Math.max(30, c);
24282                                return f = y(f) ? f : r, r = Math.max(f, r), h || (e = void 0, v = []), {
24283                                    codecSet: a.reduce((function (e, i) {
24284                                        var n = t[i];
24285                                        if (i === e) return e;
24286                                        if (n.minBitrate > r) return Or(i, "min bitrate of " + n.minBitrate + " > current estimate of " + r), e;
24287                                        if (!n.hasDefaultAudio) return Or(i, "no renditions with default or auto-select sound found"), e;
24288                                        if (o && i.indexOf(o.substring(0, 4)) % 5 != 0) return Or(i, 'audio codec preference "' + o + '" not found'), e;
24289                                        if (s && !l) {
24290                                            if (!n.channels[s]) return Or(i, "no renditions with " + s + " channel sound found (channels options: " + Object.keys(n.channels) + ")"), e
24291                                        } else if ((!o || l) && u && 0 === n.channels[2]) return Or(i, "no renditions with stereo sound found"), e;
24292                                        return n.minHeight > L ? (Or(i, "min resolution of " + n.minHeight + " > maximum of " + L), e) : n.minFramerate > A ? (Or(i, "min framerate of " + n.minFramerate + " > maximum of " + A), e) : v.some((function (t) {
24293                                            return n.videoRanges[t] > 0
24294                                        })) ? n.maxScore < g ? (Or(i, "max score of " + n.maxScore + " < selected max of " + g), e) : e && (oe(i) >= oe(e) || n.fragmentError > t[e].fragmentError) ? e : (g = n.maxScore, i) : (Or(i, "no variants with VIDEO-RANGE of " + JSON.stringify(v) + " found"), e)
24295                                    }), void 0),
24296                                    videoRanges: v,
24297                                    preferHDR: p,
24298                                    minFramerate: c,
24299                                    minBitrate: f
24300                                }
24301                            }(C, R, t, b, D),
24302                            x = _.codecSet,
24303                            P = _.videoRanges,
24304                            F = _.minFramerate,
24305                            M = _.minBitrate,
24306                            O = _.preferHDR;
24307                        T = x, R = O ? P[P.length - 1] : P[0], k = F, t = Math.max(t, M), w.log("[abr] picked start tier " + JSON.stringify(_))
24308                    } else T = null == S ? void 0 : S.codecSet, R = null == S ? void 0 : S.videoRange;
24309                    for (var N, U = f ? f.duration : c ? c.duration : 0, B = this.bwEstimator.getEstimateTTFB() / 1e3, G = [], K = function () {
24310                            var e, o = v[H],
24311                                c = H > d;
24312                            if (!o) return 0;
24313                            if (E.useMediaCapabilities && !o.supportedResult && !o.supportedPromise) {
24314                                var g = navigator.mediaCapabilities;
24315                                "function" == typeof (null == g ? void 0 : g.decodingInfo) && function (t, e, r, i, n, a) {
24316                                    var s = t.audioCodec ? t.audioGroups : null,
24317                                        o = null == a ? void 0 : a.audioCodec,
24318                                        l = null == a ? void 0 : a.channels,
24319                                        u = l ? parseInt(l) : o ? 1 / 0 : 2,
24320                                        h = null;
24321                                    if (null != s && s.length) try {
24322                                        h = 1 === s.length && s[0] ? e.groups[s[0]].channels : s.reduce((function (t, r) {
24323                                            if (r) {
24324                                                var i = e.groups[r];
24325                                                if (!i) throw new Error("Audio track group " + r + " not found");
24326                                                Object.keys(i.channels).forEach((function (e) {
24327                                                    t[e] = (t[e] || 0) + i.channels[e]
24328                                                }))
24329                                            }
24330                                            return t
24331                                        }), {
24332                                            2: 0
24333                                        })
24334                                    } catch (t) {
24335                                        return !0
24336                                    }
24337                                    return void 0 !== t.videoCodec && (t.width > 1920 && t.height > 1088 || t.height > 1920 && t.width > 1088 || t.frameRate > Math.max(i, 30) || "SDR" !== t.videoRange && t.videoRange !== r || t.bitrate > Math.max(n, 8e6)) || !!h && y(u) && Object.keys(h).some((function (t) {
24338                                        return parseInt(t) > u
24339                                    }))
24340                                }(o, I, R, k, t, b) ? (o.supportedPromise = Fr(o, I, g), o.supportedPromise.then((function (t) {
24341                                    if (l.hls) {
24342                                        o.supportedResult = t;
24343                                        var e = l.hls.levels,
24344                                            r = e.indexOf(o);
24345                                        t.error ? w.warn('[abr] MediaCapabilities decodingInfo error: "' + t.error + '" for level ' + r + " " + JSON.stringify(t)) : t.supported || (w.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level " + r + " " + JSON.stringify(t)), r > -1 && e.length > 1 && (w.log("[abr] Removing unsupported level " + r), l.hls.removeLevel(r)))
24346                                    }
24347                                }))) : o.supportedResult = xr
24348                            }
24349                            if (T && o.codecSet !== T || R && o.videoRange !== R || c && k > o.frameRate || !c && k > 0 && k < o.frameRate || o.supportedResult && (null == (e = o.supportedResult.decodingInfoResults) || !e[0].smooth)) return G.push(H), 0;
24350                            var m, D = o.details,
24351                                C = (f ? null == D ? void 0 : D.partTarget : null == D ? void 0 : D.averagetargetduration) || U;
24352                            m = c ? s * t : a * t;
24353                            var _ = U && i >= 2 * U && 0 === n ? v[H].averageBitrate : v[H].maxBitrate,
24354                                x = l.getTimeToLoadFrag(B, m, _ * C, void 0 === D);
24355                            if (m >= _ && (H === h || 0 === o.loadError && 0 === o.fragmentError) && (x <= B || !y(x) || L && !l.bitrateTestDelay || x < u)) {
24356                                var P = l.forcedAutoLevel;
24357                                return H === p || -1 !== P && P === p || (G.length && w.trace("[abr] Skipped level(s) " + G.join(",") + " of " + r + ' max with CODECS and VIDEO-RANGE:"' + v[G[0]].codecs + '" ' + v[G[0]].videoRange + '; not compatible with "' + S.codecs + '" ' + R), w.info("[abr] switch candidate:" + d + "->" + H + " adjustedbw(" + Math.round(m) + ")-bitrate=" + Math.round(m - _) + " ttfb:" + B.toFixed(1) + " avgDuration:" + C.toFixed(1) + " maxFetchDuration:" + u.toFixed(1) + " fetchDuration:" + x.toFixed(1) + " firstSelection:" + A + " codecSet:" + T + " videoRange:" + R + " hls.loadLevel:" + p)), A && (l.firstSelection = H), {
24358                                    v: H
24359                                }
24360                            }
24361                        }, H = r; H >= e; H--)
24362                        if (0 !== (N = K()) && N) return N.v;
24363                    return -1
24364                }, s(t, [{
24365                    key: "firstAutoLevel",
24366                    get: function () {
24367                        var t = this.hls,
24368                            e = t.maxAutoLevel,
24369                            r = t.minAutoLevel,
24370                            i = this.getBwEstimate(),
24371                            n = this.hls.config.maxStarvationDelay,
24372                            a = this.findBestLevel(i, r, e, 0, n, 1, 1);
24373                        if (a > -1) return a;
24374                        var s = this.hls.firstLevel,
24375                            o = Math.min(Math.max(s, r), e);
24376                        return w.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist " + s + " clamped to " + o), o
24377                    }
24378                }, {
24379                    key: "forcedAutoLevel",
24380                    get: function () {
24381                        return this.nextAutoLevelKey ? -1 : this._nextAutoLevel
24382                    }
24383                }, {
24384                    key: "nextAutoLevel",
24385                    get: function () {
24386                        var t = this.forcedAutoLevel,
24387                            e = this.bwEstimator.canEstimate(),
24388                            r = this.lastLoadedFragLevel > -1;
24389                        if (!(-1 === t || e && r && this.nextAutoLevelKey !== this.getAutoLevelKey())) return t;
24390                        var i = e && r ? this.getNextABRAutoLevel() : this.firstAutoLevel;
24391                        if (-1 !== t) {
24392                            var n = this.hls.levels;
24393                            if (n.length > Math.max(t, i) && n[t].loadError <= n[i].loadError) return t
24394                        }
24395                        return this._nextAutoLevel = i, this.nextAutoLevelKey = this.getAutoLevelKey(), i
24396                    },
24397                    set: function (t) {
24398                        var e = this.hls,
24399                            r = e.maxAutoLevel,
24400                            i = e.minAutoLevel,
24401                            n = Math.min(Math.max(t, i), r);
24402                        this._nextAutoLevel !== n && (this.nextAutoLevelKey = "", this._nextAutoLevel = n)
24403                    }
24404                }]), t
24405            }(),
24406            Hr = function () {
24407                function t() {
24408                    this._boundTick = void 0, this._tickTimer = null, this._tickInterval = null, this._tickCallCount = 0, this._boundTick = this.tick.bind(this)
24409                }
24410                var e = t.prototype;
24411                return e.destroy = function () {
24412                    this.onHandlerDestroying(), this.onHandlerDestroyed()
24413                }, e.onHandlerDestroying = function () {
24414                    this.clearNextTick(), this.clearInterval()
24415                }, e.onHandlerDestroyed = function () {}, e.hasInterval = function () {
24416                    return !!this._tickInterval
24417                }, e.hasNextTick = function () {
24418                    return !!this._tickTimer
24419                }, e.setInterval = function (t) {
24420                    return !this._tickInterval && (this._tickCallCount = 0, this._tickInterval = self.setInterval(this._boundTick, t), !0)
24421                }, e.clearInterval = function () {
24422                    return !!this._tickInterval && (self.clearInterval(this._tickInterval), this._tickInterval = null, !0)
24423                }, e.clearNextTick = function () {
24424                    return !!this._tickTimer && (self.clearTimeout(this._tickTimer), this._tickTimer = null, !0)
24425                }, e.tick = function () {
24426                    this._tickCallCount++, 1 === this._tickCallCount && (this.doTick(), this._tickCallCount > 1 && this.tickImmediate(), this._tickCallCount = 0)
24427                }, e.tickImmediate = function () {
24428                    this.clearNextTick(), this._tickTimer = self.setTimeout(this._boundTick, 0)
24429                }, e.doTick = function () {}, t
24430            }(),
24431            Vr = "NOT_LOADED",
24432            Yr = "APPENDING",
24433            Wr = "PARTIAL",
24434            jr = "OK",
24435            qr = function () {
24436                function t(t) {
24437                    this.activePartLists = Object.create(null), this.endListFragments = Object.create(null), this.fragments = Object.create(null), this.timeRanges = Object.create(null), this.bufferPadding = .2, this.hls = void 0, this.hasGaps = !1, this.hls = t, this._registerListeners()
24438                }
24439                var e = t.prototype;
24440                return e._registerListeners = function () {
24441                    var t = this.hls;
24442                    t.on(S.BUFFER_APPENDED, this.onBufferAppended, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this), t.on(S.FRAG_LOADED, this.onFragLoaded, this)
24443                }, e._unregisterListeners = function () {
24444                    var t = this.hls;
24445                    t.off(S.BUFFER_APPENDED, this.onBufferAppended, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this), t.off(S.FRAG_LOADED, this.onFragLoaded, this)
24446                }, e.destroy = function () {
24447                    this._unregisterListeners(), this.fragments = this.activePartLists = this.endListFragments = this.timeRanges = null
24448                }, e.getAppendedFrag = function (t, e) {
24449                    var r = this.activePartLists[e];
24450                    if (r)
24451                        for (var i = r.length; i--;) {
24452                            var n = r[i];
24453                            if (!n) break;
24454                            var a = n.end;
24455                            if (n.start <= t && null !== a && t <= a) return n
24456                        }
24457                    return this.getBufferedFrag(t, e)
24458                }, e.getBufferedFrag = function (t, e) {
24459                    for (var r = this.fragments, i = Object.keys(r), n = i.length; n--;) {
24460                        var a = r[i[n]];
24461                        if ((null == a ? void 0 : a.body.type) === e && a.buffered) {
24462                            var s = a.body;
24463                            if (s.start <= t && t <= s.end) return s
24464                        }
24465                    }
24466                    return null
24467                }, e.detectEvictedFragments = function (t, e, r, i) {
24468                    var n = this;
24469                    this.timeRanges && (this.timeRanges[t] = e);
24470                    var a = (null == i ? void 0 : i.fragment.sn) || -1;
vendor: 5,923 bytes, lines 24471-24581
24471                    Object.keys(this.fragments).forEach((function (i) {
24472                        var s = n.fragments[i];
24473                        if (s && !(a >= s.body.sn))
24474                            if (s.buffered || s.loaded) {
24475                                var o = s.range[t];
24476                                o && o.time.some((function (t) {
24477                                    var r = !n.isTimeBuffered(t.startPTS, t.endPTS, e);
24478                                    return r && n.removeFragment(s.body), r
24479                                }))
24480                            } else s.body.type === r && n.removeFragment(s.body)
24481                    }))
24482                }, e.detectPartialFragments = function (t) {
24483                    var e = this,
24484                        r = this.timeRanges,
24485                        i = t.frag,
24486                        n = t.part;
24487                    if (r && "initSegment" !== i.sn) {
24488                        var a = zr(i),
24489                            s = this.fragments[a];
24490                        if (!(!s || s.buffered && i.gap)) {
24491                            var o = !i.relurl;
24492                            Object.keys(r).forEach((function (t) {
24493                                var a = i.elementaryStreams[t];
24494                                if (a) {
24495                                    var l = r[t],
24496                                        u = o || !0 === a.partial;
24497                                    s.range[t] = e.getBufferedTimes(i, n, u, l)
24498                                }
24499                            })), s.loaded = null, Object.keys(s.range).length ? (s.buffered = !0, (s.body.endList = i.endList || s.body.endList) && (this.endListFragments[s.body.type] = s), Xr(s) || this.removeParts(i.sn - 1, i.type)) : this.removeFragment(s.body)
24500                        }
24501                    }
24502                }, e.removeParts = function (t, e) {
24503                    var r = this.activePartLists[e];
24504                    r && (this.activePartLists[e] = r.filter((function (e) {
24505                        return e.fragment.sn >= t
24506                    })))
24507                }, e.fragBuffered = function (t, e) {
24508                    var r = zr(t),
24509                        i = this.fragments[r];
24510                    !i && e && (i = this.fragments[r] = {
24511                        body: t,
24512                        appendedPTS: null,
24513                        loaded: null,
24514                        buffered: !1,
24515                        range: Object.create(null)
24516                    }, t.gap && (this.hasGaps = !0)), i && (i.loaded = null, i.buffered = !0)
24517                }, e.getBufferedTimes = function (t, e, r, i) {
24518                    for (var n = {
24519                            time: [],
24520                            partial: r
24521                        }, a = t.start, s = t.end, o = t.minEndPTS || s, l = t.maxStartPTS || a, u = 0; u < i.length; u++) {
24522                        var h = i.start(u) - this.bufferPadding,
24523                            d = i.end(u) + this.bufferPadding;
24524                        if (l >= h && o <= d) {
24525                            n.time.push({
24526                                startPTS: Math.max(a, i.start(u)),
24527                                endPTS: Math.min(s, i.end(u))
24528                            });
24529                            break
24530                        }
24531                        if (a < d && s > h) {
24532                            var c = Math.max(a, i.start(u)),
24533                                f = Math.min(s, i.end(u));
24534                            f > c && (n.partial = !0, n.time.push({
24535                                startPTS: c,
24536                                endPTS: f
24537                            }))
24538                        } else if (s <= h) break
24539                    }
24540                    return n
24541                }, e.getPartialFragment = function (t) {
24542                    var e, r, i, n = null,
24543                        a = 0,
24544                        s = this.bufferPadding,
24545                        o = this.fragments;
24546                    return Object.keys(o).forEach((function (l) {
24547                        var u = o[l];
24548                        u && Xr(u) && (r = u.body.start - s, i = u.body.end + s, t >= r && t <= i && (e = Math.min(t - r, i - t), a <= e && (n = u.body, a = e)))
24549                    })), n
24550                }, e.isEndListAppended = function (t) {
24551                    var e = this.endListFragments[t];
24552                    return void 0 !== e && (e.buffered || Xr(e))
24553                }, e.getState = function (t) {
24554                    var e = zr(t),
24555                        r = this.fragments[e];
24556                    return r ? r.buffered ? Xr(r) ? Wr : jr : Yr : Vr
24557                }, e.isTimeBuffered = function (t, e, r) {
24558                    for (var i, n, a = 0; a < r.length; a++) {
24559                        if (i = r.start(a) - this.bufferPadding, n = r.end(a) + this.bufferPadding, t >= i && e <= n) return !0;
24560                        if (e <= i) return !1
24561                    }
24562                    return !1
24563                }, e.onFragLoaded = function (t, e) {
24564                    var r = e.frag,
24565                        i = e.part;
24566                    if ("initSegment" !== r.sn && !r.bitrateTest) {
24567                        var n = i ? null : e,
24568                            a = zr(r);
24569                        this.fragments[a] = {
24570                            body: r,
24571                            appendedPTS: null,
24572                            loaded: n,
24573                            buffered: !1,
24574                            range: Object.create(null)
24575                        }
24576                    }
24577                }, e.onBufferAppended = function (t, e) {
24578                    var r = this,
24579                        i = e.frag,
24580                        n = e.part,
24581                        a = e.timeRanges;
vendor: 12,090 bytes, lines 24582-24842
24582                    if ("initSegment" !== i.sn) {
24583                        var s = i.type;
24584                        if (n) {
24585                            var o = this.activePartLists[s];
24586                            o || (this.activePartLists[s] = o = []), o.push(n)
24587                        }
24588                        this.timeRanges = a, Object.keys(a).forEach((function (t) {
24589                            var e = a[t];
24590                            r.detectEvictedFragments(t, e, s, n)
24591                        }))
24592                    }
24593                }, e.onFragBuffered = function (t, e) {
24594                    this.detectPartialFragments(e)
24595                }, e.hasFragment = function (t) {
24596                    var e = zr(t);
24597                    return !!this.fragments[e]
24598                }, e.hasParts = function (t) {
24599                    var e;
24600                    return !(null == (e = this.activePartLists[t]) || !e.length)
24601                }, e.removeFragmentsInRange = function (t, e, r, i, n) {
24602                    var a = this;
24603                    i && !this.hasGaps || Object.keys(this.fragments).forEach((function (s) {
24604                        var o = a.fragments[s];
24605                        if (o) {
24606                            var l = o.body;
24607                            l.type !== r || i && !l.gap || l.start < e && l.end > t && (o.buffered || n) && a.removeFragment(l)
24608                        }
24609                    }))
24610                }, e.removeFragment = function (t) {
24611                    var e = zr(t);
24612                    t.stats.loaded = 0, t.clearElementaryStreamInfo();
24613                    var r = this.activePartLists[t.type];
24614                    if (r) {
24615                        var i = t.sn;
24616                        this.activePartLists[t.type] = r.filter((function (t) {
24617                            return t.fragment.sn !== i
24618                        }))
24619                    }
24620                    delete this.fragments[e], t.endList && delete this.endListFragments[t.type]
24621                }, e.removeAllFragments = function () {
24622                    this.fragments = Object.create(null), this.endListFragments = Object.create(null), this.activePartLists = Object.create(null), this.hasGaps = !1
24623                }, t
24624            }();
24625
24626        function Xr(t) {
24627            var e, r, i;
24628            return t.buffered && (t.body.gap || (null == (e = t.range.video) ? void 0 : e.partial) || (null == (r = t.range.audio) ? void 0 : r.partial) || (null == (i = t.range.audiovideo) ? void 0 : i.partial))
24629        }
24630
24631        function zr(t) {
24632            return t.type + "_" + t.level + "_" + t.sn
24633        }
24634        var Qr = {
24635                length: 0,
24636                start: function () {
24637                    return 0
24638                },
24639                end: function () {
24640                    return 0
24641                }
24642            },
24643            Jr = function () {
24644                function t() {}
24645                return t.isBuffered = function (e, r) {
24646                    try {
24647                        if (e)
24648                            for (var i = t.getBuffered(e), n = 0; n < i.length; n++)
24649                                if (r >= i.start(n) && r <= i.end(n)) return !0
24650                    } catch (t) {}
24651                    return !1
24652                }, t.bufferInfo = function (e, r, i) {
24653                    try {
24654                        if (e) {
24655                            var n, a = t.getBuffered(e),
24656                                s = [];
24657                            for (n = 0; n < a.length; n++) s.push({
24658                                start: a.start(n),
24659                                end: a.end(n)
24660                            });
24661                            return this.bufferedInfo(s, r, i)
24662                        }
24663                    } catch (t) {}
24664                    return {
24665                        len: 0,
24666                        start: r,
24667                        end: r,
24668                        nextStart: void 0
24669                    }
24670                }, t.bufferedInfo = function (t, e, r) {
24671                    e = Math.max(0, e), t.sort((function (t, e) {
24672                        var r = t.start - e.start;
24673                        return r || e.end - t.end
24674                    }));
24675                    var i = [];
24676                    if (r)
24677                        for (var n = 0; n < t.length; n++) {
24678                            var a = i.length;
24679                            if (a) {
24680                                var s = i[a - 1].end;
24681                                t[n].start - s < r ? t[n].end > s && (i[a - 1].end = t[n].end) : i.push(t[n])
24682                            } else i.push(t[n])
24683                        } else i = t;
24684                    for (var o, l = 0, u = e, h = e, d = 0; d < i.length; d++) {
24685                        var c = i[d].start,
24686                            f = i[d].end;
24687                        if (e + r >= c && e < f) u = c, l = (h = f) - e;
24688                        else if (e + r < c) {
24689                            o = c;
24690                            break
24691                        }
24692                    }
24693                    return {
24694                        len: l,
24695                        start: u || 0,
24696                        end: h || 0,
24697                        nextStart: o
24698                    }
24699                }, t.getBuffered = function (t) {
24700                    try {
24701                        return t.buffered
24702                    } catch (t) {
24703                        return w.log("failed to get media.buffered", t), Qr
24704                    }
24705                }, t
24706            }(),
24707            $r = function (t, e, r, i, n, a) {
24708                void 0 === i && (i = 0), void 0 === n && (n = -1), void 0 === a && (a = !1), this.level = void 0, this.sn = void 0, this.part = void 0, this.id = void 0, this.size = void 0, this.partial = void 0, this.transmuxing = {
24709                    start: 0,
24710                    executeStart: 0,
24711                    executeEnd: 0,
24712                    end: 0
24713                }, this.buffering = {
24714                    audio: {
24715                        start: 0,
24716                        executeStart: 0,
24717                        executeEnd: 0,
24718                        end: 0
24719                    },
24720                    video: {
24721                        start: 0,
24722                        executeStart: 0,
24723                        executeEnd: 0,
24724                        end: 0
24725                    },
24726                    audiovideo: {
24727                        start: 0,
24728                        executeStart: 0,
24729                        executeEnd: 0,
24730                        end: 0
24731                    }
24732                }, this.level = t, this.sn = e, this.id = r, this.size = i, this.part = n, this.partial = a
24733            };
24734
24735        function Zr(t, e) {
24736            for (var r = 0, i = t.length; r < i; r++) {
24737                var n;
24738                if ((null == (n = t[r]) ? void 0 : n.cc) === e) return t[r]
24739            }
24740            return null
24741        }
24742
24743        function ti(t, e) {
24744            if (t) {
24745                var r = t.start + e;
24746                t.start = t.startPTS = r, t.endPTS = r + t.duration
24747            }
24748        }
24749
24750        function ei(t, e) {
24751            for (var r = e.fragments, i = 0, n = r.length; i < n; i++) ti(r[i], t);
24752            e.fragmentHint && ti(e.fragmentHint, t), e.alignedSliding = !0
24753        }
24754
24755        function ri(t, e, r) {
24756            e && (function (t, e, r) {
24757                if (function (t, e, r) {
24758                        return !(!e || !(r.endCC > r.startCC || t && t.cc < r.startCC))
24759                    }(t, r, e)) {
24760                    var i = function (t, e) {
24761                        var r = t.fragments,
24762                            i = e.fragments;
24763                        if (i.length && r.length) {
24764                            var n = Zr(r, i[0].cc);
24765                            if (n && (!n || n.startPTS)) return n;
24766                            w.log("No frag in previous level to align on")
24767                        } else w.log("No fragments to align")
24768                    }(r, e);
24769                    i && y(i.start) && (w.log("Adjusting PTS using last level due to CC increase within current level " + e.url), ei(i.start, e))
24770                }
24771            }(t, r, e), !r.alignedSliding && e && ii(r, e), r.alignedSliding || !e || r.skippedSegments || or(e, r))
24772        }
24773
24774        function ii(t, e) {
24775            if (t.hasProgramDateTime && e.hasProgramDateTime) {
24776                var r = t.fragments,
24777                    i = e.fragments;
24778                if (r.length && i.length) {
24779                    var n, a, s = Math.min(e.endCC, t.endCC);
24780                    e.startCC < s && t.startCC < s && (n = Zr(i, s), a = Zr(r, s)), n && a || (a = Zr(r, (n = i[Math.floor(i.length / 2)]).cc) || r[Math.floor(r.length / 2)]);
24781                    var o = n.programDateTime,
24782                        l = a.programDateTime;
24783                    o && l && ei((l - o) / 1e3 - (a.start - n.start), t)
24784                }
24785            }
24786        }
24787        var ni = Math.pow(2, 17),
24788            ai = function () {
24789                function t(t) {
24790                    this.config = void 0, this.loader = null, this.partLoadTimeout = -1, this.config = t
24791                }
24792                var e = t.prototype;
24793                return e.destroy = function () {
24794                    this.loader && (this.loader.destroy(), this.loader = null)
24795                }, e.abort = function () {
24796                    this.loader && this.loader.abort()
24797                }, e.load = function (t, e) {
24798                    var r = this,
24799                        n = t.url;
24800                    if (!n) return Promise.reject(new li({
24801                        type: L.NETWORK_ERROR,
24802                        details: A.FRAG_LOAD_ERROR,
24803                        fatal: !1,
24804                        frag: t,
24805                        error: new Error("Fragment does not have a " + (n ? "part list" : "url")),
24806                        networkDetails: null
24807                    }));
24808                    this.abort();
24809                    var a = this.config,
24810                        s = a.fLoader,
24811                        o = a.loader;
24812                    return new Promise((function (l, u) {
24813                        if (r.loader && r.loader.destroy(), t.gap) {
24814                            if (t.tagList.some((function (t) {
24815                                    return "GAP" === t[0]
24816                                }))) return void u(oi(t));
24817                            t.gap = !1
24818                        }
24819                        var h = r.loader = t.loader = s ? new s(a) : new o(a),
24820                            d = si(t),
24821                            c = vr(a.fragLoadPolicy.default),
24822                            f = {
24823                                loadPolicy: c,
24824                                timeout: c.maxLoadTimeMs,
24825                                maxRetry: 0,
24826                                retryDelay: 0,
24827                                maxRetryDelay: 0,
24828                                highWaterMark: "initSegment" === t.sn ? 1 / 0 : ni
24829                            };
24830                        t.stats = h.stats, h.load(d, f, {
24831                            onSuccess: function (e, i, n, a) {
24832                                r.resetLoader(t, h);
24833                                var s = e.data;
24834                                n.resetIV && t.decryptdata && (t.decryptdata.iv = new Uint8Array(s.slice(0, 16)), s = s.slice(16)), l({
24835                                    frag: t,
24836                                    part: null,
24837                                    payload: s,
24838                                    networkDetails: a
24839                                })
24840                            },
24841                            onError: function (e, a, s, o) {
24842                                r.resetLoader(t, h), u(new li({
vendor: 55,988 bytes, lines 24843-25692
24843                                    type: L.NETWORK_ERROR,
24844                                    details: A.FRAG_LOAD_ERROR,
24845                                    fatal: !1,
24846                                    frag: t,
24847                                    response: i({
24848                                        url: n,
24849                                        data: void 0
24850                                    }, e),
24851                                    error: new Error("HTTP Error " + e.code + " " + e.text),
24852                                    networkDetails: s,
24853                                    stats: o
24854                                }))
24855                            },
24856                            onAbort: function (e, i, n) {
24857                                r.resetLoader(t, h), u(new li({
24858                                    type: L.NETWORK_ERROR,
24859                                    details: A.INTERNAL_ABORTED,
24860                                    fatal: !1,
24861                                    frag: t,
24862                                    error: new Error("Aborted"),
24863                                    networkDetails: n,
24864                                    stats: e
24865                                }))
24866                            },
24867                            onTimeout: function (e, i, n) {
24868                                r.resetLoader(t, h), u(new li({
24869                                    type: L.NETWORK_ERROR,
24870                                    details: A.FRAG_LOAD_TIMEOUT,
24871                                    fatal: !1,
24872                                    frag: t,
24873                                    error: new Error("Timeout after " + f.timeout + "ms"),
24874                                    networkDetails: n,
24875                                    stats: e
24876                                }))
24877                            },
24878                            onProgress: function (r, i, n, a) {
24879                                e && e({
24880                                    frag: t,
24881                                    part: null,
24882                                    payload: n,
24883                                    networkDetails: a
24884                                })
24885                            }
24886                        })
24887                    }))
24888                }, e.loadPart = function (t, e, r) {
24889                    var n = this;
24890                    this.abort();
24891                    var a = this.config,
24892                        s = a.fLoader,
24893                        o = a.loader;
24894                    return new Promise((function (l, u) {
24895                        if (n.loader && n.loader.destroy(), t.gap || e.gap) u(oi(t, e));
24896                        else {
24897                            var h = n.loader = t.loader = s ? new s(a) : new o(a),
24898                                d = si(t, e),
24899                                c = vr(a.fragLoadPolicy.default),
24900                                f = {
24901                                    loadPolicy: c,
24902                                    timeout: c.maxLoadTimeMs,
24903                                    maxRetry: 0,
24904                                    retryDelay: 0,
24905                                    maxRetryDelay: 0,
24906                                    highWaterMark: ni
24907                                };
24908                            e.stats = h.stats, h.load(d, f, {
24909                                onSuccess: function (i, a, s, o) {
24910                                    n.resetLoader(t, h), n.updateStatsFromPart(t, e);
24911                                    var u = {
24912                                        frag: t,
24913                                        part: e,
24914                                        payload: i.data,
24915                                        networkDetails: o
24916                                    };
24917                                    r(u), l(u)
24918                                },
24919                                onError: function (r, a, s, o) {
24920                                    n.resetLoader(t, h), u(new li({
24921                                        type: L.NETWORK_ERROR,
24922                                        details: A.FRAG_LOAD_ERROR,
24923                                        fatal: !1,
24924                                        frag: t,
24925                                        part: e,
24926                                        response: i({
24927                                            url: d.url,
24928                                            data: void 0
24929                                        }, r),
24930                                        error: new Error("HTTP Error " + r.code + " " + r.text),
24931                                        networkDetails: s,
24932                                        stats: o
24933                                    }))
24934                                },
24935                                onAbort: function (r, i, a) {
24936                                    t.stats.aborted = e.stats.aborted, n.resetLoader(t, h), u(new li({
24937                                        type: L.NETWORK_ERROR,
24938                                        details: A.INTERNAL_ABORTED,
24939                                        fatal: !1,
24940                                        frag: t,
24941                                        part: e,
24942                                        error: new Error("Aborted"),
24943                                        networkDetails: a,
24944                                        stats: r
24945                                    }))
24946                                },
24947                                onTimeout: function (r, i, a) {
24948                                    n.resetLoader(t, h), u(new li({
24949                                        type: L.NETWORK_ERROR,
24950                                        details: A.FRAG_LOAD_TIMEOUT,
24951                                        fatal: !1,
24952                                        frag: t,
24953                                        part: e,
24954                                        error: new Error("Timeout after " + f.timeout + "ms"),
24955                                        networkDetails: a,
24956                                        stats: r
24957                                    }))
24958                                }
24959                            })
24960                        }
24961                    }))
24962                }, e.updateStatsFromPart = function (t, e) {
24963                    var r = t.stats,
24964                        i = e.stats,
24965                        n = i.total;
24966                    if (r.loaded += i.loaded, n) {
24967                        var a = Math.round(t.duration / e.duration),
24968                            s = Math.min(Math.round(r.loaded / n), a),
24969                            o = (a - s) * Math.round(r.loaded / s);
24970                        r.total = r.loaded + o
24971                    } else r.total = Math.max(r.loaded, r.total);
24972                    var l = r.loading,
24973                        u = i.loading;
24974                    l.start ? l.first += u.first - u.start : (l.start = u.start, l.first = u.first), l.end = u.end
24975                }, e.resetLoader = function (t, e) {
24976                    t.loader = null, this.loader === e && (self.clearTimeout(this.partLoadTimeout), this.loader = null), e.destroy()
24977                }, t
24978            }();
24979
24980        function si(t, e) {
24981            void 0 === e && (e = null);
24982            var r = e || t,
24983                i = {
24984                    frag: t,
24985                    part: e,
24986                    responseType: "arraybuffer",
24987                    url: r.url,
24988                    headers: {},
24989                    rangeStart: 0,
24990                    rangeEnd: 0
24991                },
24992                n = r.byteRangeStartOffset,
24993                a = r.byteRangeEndOffset;
24994            if (y(n) && y(a)) {
24995                var s, o = n,
24996                    l = a;
24997                if ("initSegment" === t.sn && "AES-128" === (null == (s = t.decryptdata) ? void 0 : s.method)) {
24998                    var u = a - n;
24999                    u % 16 && (l = a + (16 - u % 16)), 0 !== n && (i.resetIV = !0, o = n - 16)
25000                }
25001                i.rangeStart = o, i.rangeEnd = l
25002            }
25003            return i
25004        }
25005
25006        function oi(t, e) {
25007            var r = new Error("GAP " + (t.gap ? "tag" : "attribute") + " found"),
25008                i = {
25009                    type: L.MEDIA_ERROR,
25010                    details: A.FRAG_GAP,
25011                    fatal: !1,
25012                    frag: t,
25013                    error: r,
25014                    networkDetails: null
25015                };
25016            return e && (i.part = e), (e || t).stats.aborted = !0, new li(i)
25017        }
25018        var li = function (t) {
25019                function e(e) {
25020                    var r;
25021                    return (r = t.call(this, e.error.message) || this).data = void 0, r.data = e, r
25022                }
25023                return l(e, t), e
25024            }(c(Error)),
25025            ui = function () {
25026                function t(t, e) {
25027                    this.subtle = void 0, this.aesIV = void 0, this.subtle = t, this.aesIV = e
25028                }
25029                return t.prototype.decrypt = function (t, e) {
25030                    return this.subtle.decrypt({
25031                        name: "AES-CBC",
25032                        iv: this.aesIV
25033                    }, e, t)
25034                }, t
25035            }(),
25036            hi = function () {
25037                function t(t, e) {
25038                    this.subtle = void 0, this.key = void 0, this.subtle = t, this.key = e
25039                }
25040                return t.prototype.expandKey = function () {
25041                    return this.subtle.importKey("raw", this.key, {
25042                        name: "AES-CBC"
25043                    }, !1, ["encrypt", "decrypt"])
25044                }, t
25045            }(),
25046            di = function () {
25047                function t() {
25048                    this.rcon = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], this.subMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)], this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)], this.sBox = new Uint32Array(256), this.invSBox = new Uint32Array(256), this.key = new Uint32Array(0), this.ksRows = 0, this.keySize = 0, this.keySchedule = void 0, this.invKeySchedule = void 0, this.initTable()
25049                }
25050                var e = t.prototype;
25051                return e.uint8ArrayToUint32Array_ = function (t) {
25052                    for (var e = new DataView(t), r = new Uint32Array(4), i = 0; i < 4; i++) r[i] = e.getUint32(4 * i);
25053                    return r
25054                }, e.initTable = function () {
25055                    var t = this.sBox,
25056                        e = this.invSBox,
25057                        r = this.subMix,
25058                        i = r[0],
25059                        n = r[1],
25060                        a = r[2],
25061                        s = r[3],
25062                        o = this.invSubMix,
25063                        l = o[0],
25064                        u = o[1],
25065                        h = o[2],
25066                        d = o[3],
25067                        c = new Uint32Array(256),
25068                        f = 0,
25069                        g = 0,
25070                        v = 0;
25071                    for (v = 0; v < 256; v++) c[v] = v < 128 ? v << 1 : v << 1 ^ 283;
25072                    for (v = 0; v < 256; v++) {
25073                        var m = g ^ g << 1 ^ g << 2 ^ g << 3 ^ g << 4;
25074                        m = m >>> 8 ^ 255 & m ^ 99, t[f] = m, e[m] = f;
25075                        var p = c[f],
25076                            y = c[p],
25077                            E = c[y],
25078                            T = 257 * c[m] ^ 16843008 * m;
25079                        i[f] = T << 24 | T >>> 8, n[f] = T << 16 | T >>> 16, a[f] = T << 8 | T >>> 24, s[f] = T, T = 16843009 * E ^ 65537 * y ^ 257 * p ^ 16843008 * f, l[m] = T << 24 | T >>> 8, u[m] = T << 16 | T >>> 16, h[m] = T << 8 | T >>> 24, d[m] = T, f ? (f = p ^ c[c[c[E ^ p]]], g ^= c[c[g]]) : f = g = 1
25080                    }
25081                }, e.expandKey = function (t) {
25082                    for (var e = this.uint8ArrayToUint32Array_(t), r = !0, i = 0; i < e.length && r;) r = e[i] === this.key[i], i++;
25083                    if (!r) {
25084                        this.key = e;
25085                        var n = this.keySize = e.length;
25086                        if (4 !== n && 6 !== n && 8 !== n) throw new Error("Invalid aes key size=" + n);
25087                        var a, s, o, l, u = this.ksRows = 4 * (n + 6 + 1),
25088                            h = this.keySchedule = new Uint32Array(u),
25089                            d = this.invKeySchedule = new Uint32Array(u),
25090                            c = this.sBox,
25091                            f = this.rcon,
25092                            g = this.invSubMix,
25093                            v = g[0],
25094                            m = g[1],
25095                            p = g[2],
25096                            y = g[3];
25097                        for (a = 0; a < u; a++) a < n ? o = h[a] = e[a] : (l = o, a % n == 0 ? (l = c[(l = l << 8 | l >>> 24) >>> 24] << 24 | c[l >>> 16 & 255] << 16 | c[l >>> 8 & 255] << 8 | c[255 & l], l ^= f[a / n | 0] << 24) : n > 6 && a % n == 4 && (l = c[l >>> 24] << 24 | c[l >>> 16 & 255] << 16 | c[l >>> 8 & 255] << 8 | c[255 & l]), h[a] = o = (h[a - n] ^ l) >>> 0);
25098                        for (s = 0; s < u; s++) a = u - s, l = 3 & s ? h[a] : h[a - 4], d[s] = s < 4 || a <= 4 ? l : v[c[l >>> 24]] ^ m[c[l >>> 16 & 255]] ^ p[c[l >>> 8 & 255]] ^ y[c[255 & l]], d[s] = d[s] >>> 0
25099                    }
25100                }, e.networkToHostOrderSwap = function (t) {
25101                    return t << 24 | (65280 & t) << 8 | (16711680 & t) >> 8 | t >>> 24
25102                }, e.decrypt = function (t, e, r) {
25103                    for (var i, n, a, s, o, l, u, h, d, c, f, g, v, m, p = this.keySize + 6, y = this.invKeySchedule, E = this.invSBox, T = this.invSubMix, S = T[0], L = T[1], A = T[2], R = T[3], k = this.uint8ArrayToUint32Array_(r), b = k[0], D = k[1], I = k[2], w = k[3], C = new Int32Array(t), _ = new Int32Array(C.length), x = this.networkToHostOrderSwap; e < C.length;) {
25104                        for (d = x(C[e]), c = x(C[e + 1]), f = x(C[e + 2]), g = x(C[e + 3]), o = d ^ y[0], l = g ^ y[1], u = f ^ y[2], h = c ^ y[3], v = 4, m = 1; m < p; m++) i = S[o >>> 24] ^ L[l >> 16 & 255] ^ A[u >> 8 & 255] ^ R[255 & h] ^ y[v], n = S[l >>> 24] ^ L[u >> 16 & 255] ^ A[h >> 8 & 255] ^ R[255 & o] ^ y[v + 1], a = S[u >>> 24] ^ L[h >> 16 & 255] ^ A[o >> 8 & 255] ^ R[255 & l] ^ y[v + 2], s = S[h >>> 24] ^ L[o >> 16 & 255] ^ A[l >> 8 & 255] ^ R[255 & u] ^ y[v + 3], o = i, l = n, u = a, h = s, v += 4;
25105                        i = E[o >>> 24] << 24 ^ E[l >> 16 & 255] << 16 ^ E[u >> 8 & 255] << 8 ^ E[255 & h] ^ y[v], n = E[l >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[h >> 8 & 255] << 8 ^ E[255 & o] ^ y[v + 1], a = E[u >>> 24] << 24 ^ E[h >> 16 & 255] << 16 ^ E[o >> 8 & 255] << 8 ^ E[255 & l] ^ y[v + 2], s = E[h >>> 24] << 24 ^ E[o >> 16 & 255] << 16 ^ E[l >> 8 & 255] << 8 ^ E[255 & u] ^ y[v + 3], _[e] = x(i ^ b), _[e + 1] = x(s ^ D), _[e + 2] = x(a ^ I), _[e + 3] = x(n ^ w), b = d, D = c, I = f, w = g, e += 4
25106                    }
25107                    return _.buffer
25108                }, t
25109            }(),
25110            ci = function () {
25111                function t(t, e) {
25112                    var r = (void 0 === e ? {} : e).removePKCS7Padding,
25113                        i = void 0 === r || r;
25114                    if (this.logEnabled = !0, this.removePKCS7Padding = void 0, this.subtle = null, this.softwareDecrypter = null, this.key = null, this.fastAesKey = null, this.remainderData = null, this.currentIV = null, this.currentResult = null, this.useSoftware = void 0, this.useSoftware = t.enableSoftwareAES, this.removePKCS7Padding = i, i) try {
25115                        var n = self.crypto;
25116                        n && (this.subtle = n.subtle || n.webkitSubtle)
25117                    } catch (t) {}
25118                    this.useSoftware = !this.subtle
25119                }
25120                var e = t.prototype;
25121                return e.destroy = function () {
25122                    this.subtle = null, this.softwareDecrypter = null, this.key = null, this.fastAesKey = null, this.remainderData = null, this.currentIV = null, this.currentResult = null
25123                }, e.isSync = function () {
25124                    return this.useSoftware
25125                }, e.flush = function () {
25126                    var t = this.currentResult,
25127                        e = this.remainderData;
25128                    if (!t || e) return this.reset(), null;
25129                    var r, i, n, a = new Uint8Array(t);
25130                    return this.reset(), this.removePKCS7Padding ? (i = (r = a).byteLength, (n = i && new DataView(r.buffer).getUint8(i - 1)) ? nt(r, 0, i - n) : r) : a
25131                }, e.reset = function () {
25132                    this.currentResult = null, this.currentIV = null, this.remainderData = null, this.softwareDecrypter && (this.softwareDecrypter = null)
25133                }, e.decrypt = function (t, e, r) {
25134                    var i = this;
25135                    return this.useSoftware ? new Promise((function (n, a) {
25136                        i.softwareDecrypt(new Uint8Array(t), e, r);
25137                        var s = i.flush();
25138                        s ? n(s.buffer) : a(new Error("[softwareDecrypt] Failed to decrypt data"))
25139                    })) : this.webCryptoDecrypt(new Uint8Array(t), e, r)
25140                }, e.softwareDecrypt = function (t, e, r) {
25141                    var i = this.currentIV,
25142                        n = this.currentResult,
25143                        a = this.remainderData;
25144                    this.logOnce("JS AES decrypt"), a && (t = Kt(a, t), this.remainderData = null);
25145                    var s = this.getValidChunk(t);
25146                    if (!s.length) return null;
25147                    i && (r = i);
25148                    var o = this.softwareDecrypter;
25149                    o || (o = this.softwareDecrypter = new di), o.expandKey(e);
25150                    var l = n;
25151                    return this.currentResult = o.decrypt(s.buffer, 0, r), this.currentIV = nt(s, -16).buffer, l || null
25152                }, e.webCryptoDecrypt = function (t, e, r) {
25153                    var i = this;
25154                    if (this.key !== e || !this.fastAesKey) {
25155                        if (!this.subtle) return Promise.resolve(this.onWebCryptoError(t, e, r));
25156                        this.key = e, this.fastAesKey = new hi(this.subtle, e)
25157                    }
25158                    return this.fastAesKey.expandKey().then((function (e) {
25159                        return i.subtle ? (i.logOnce("WebCrypto AES decrypt"), new ui(i.subtle, new Uint8Array(r)).decrypt(t.buffer, e)) : Promise.reject(new Error("web crypto not initialized"))
25160                    })).catch((function (n) {
25161                        return w.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, " + n.name + ": " + n.message), i.onWebCryptoError(t, e, r)
25162                    }))
25163                }, e.onWebCryptoError = function (t, e, r) {
25164                    this.useSoftware = !0, this.logEnabled = !0, this.softwareDecrypt(t, e, r);
25165                    var i = this.flush();
25166                    if (i) return i.buffer;
25167                    throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")
25168                }, e.getValidChunk = function (t) {
25169                    var e = t,
25170                        r = t.length - t.length % 16;
25171                    return r !== t.length && (e = nt(t, 0, r), this.remainderData = nt(t, r)), e
25172                }, e.logOnce = function (t) {
25173                    this.logEnabled && (w.log("[decrypter]: " + t), this.logEnabled = !1)
25174                }, t
25175            }(),
25176            fi = function (t) {
25177                for (var e = "", r = t.length, i = 0; i < r; i++) e += "[" + t.start(i).toFixed(3) + "-" + t.end(i).toFixed(3) + "]";
25178                return e
25179            },
25180            gi = "STOPPED",
25181            vi = "IDLE",
25182            mi = "KEY_LOADING",
25183            pi = "FRAG_LOADING",
25184            yi = "FRAG_LOADING_WAITING_RETRY",
25185            Ei = "WAITING_TRACK",
25186            Ti = "PARSING",
25187            Si = "PARSED",
25188            Li = "ENDED",
25189            Ai = "ERROR",
25190            Ri = "WAITING_INIT_PTS",
25191            ki = "WAITING_LEVEL",
25192            bi = function (t) {
25193                function e(e, r, i, n, a) {
25194                    var s;
25195                    return (s = t.call(this) || this).hls = void 0, s.fragPrevious = null, s.fragCurrent = null, s.fragmentTracker = void 0, s.transmuxer = null, s._state = gi, s.playlistType = void 0, s.media = null, s.mediaBuffer = null, s.config = void 0, s.bitrateTest = !1, s.lastCurrentTime = 0, s.nextLoadPosition = 0, s.startPosition = 0, s.startTimeOffset = null, s.loadedmetadata = !1, s.retryDate = 0, s.levels = null, s.fragmentLoader = void 0, s.keyLoader = void 0, s.levelLastLoaded = null, s.startFragRequested = !1, s.decrypter = void 0, s.initPTS = [], s.onvseeking = null, s.onvended = null, s.logPrefix = "", s.log = void 0, s.warn = void 0, s.playlistType = a, s.logPrefix = n, s.log = w.log.bind(w, n + ":"), s.warn = w.warn.bind(w, n + ":"), s.hls = e, s.fragmentLoader = new ai(e.config), s.keyLoader = i, s.fragmentTracker = r, s.config = e.config, s.decrypter = new ci(e.config), e.on(S.MANIFEST_LOADED, s.onManifestLoaded, function (t) {
25196                        if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
25197                        return t
25198                    }(s)), s
25199                }
25200                l(e, t);
25201                var r = e.prototype;
25202                return r.doTick = function () {
25203                    this.onTickEnd()
25204                }, r.onTickEnd = function () {}, r.startLoad = function (t) {}, r.stopLoad = function () {
25205                    this.fragmentLoader.abort(), this.keyLoader.abort(this.playlistType);
25206                    var t = this.fragCurrent;
25207                    null != t && t.loader && (t.abortRequests(), this.fragmentTracker.removeFragment(t)), this.resetTransmuxer(), this.fragCurrent = null, this.fragPrevious = null, this.clearInterval(), this.clearNextTick(), this.state = gi
25208                }, r._streamEnded = function (t, e) {
25209                    if (e.live || t.nextStart || !t.end || !this.media) return !1;
25210                    var r = e.partList;
25211                    if (null != r && r.length) {
25212                        var i = r[r.length - 1];
25213                        return Jr.isBuffered(this.media, i.start + i.duration / 2)
25214                    }
25215                    var n = e.fragments[e.fragments.length - 1].type;
25216                    return this.fragmentTracker.isEndListAppended(n)
25217                }, r.getLevelDetails = function () {
25218                    var t;
25219                    if (this.levels && null !== this.levelLastLoaded) return null == (t = this.levelLastLoaded) ? void 0 : t.details
25220                }, r.onMediaAttached = function (t, e) {
25221                    var r = this.media = this.mediaBuffer = e.media;
25222                    this.onvseeking = this.onMediaSeeking.bind(this), this.onvended = this.onMediaEnded.bind(this), r.addEventListener("seeking", this.onvseeking), r.addEventListener("ended", this.onvended);
25223                    var i = this.config;
25224                    this.levels && i.autoStartLoad && this.state === gi && this.startLoad(i.startPosition)
25225                }, r.onMediaDetaching = function () {
25226                    var t = this.media;
25227                    null != t && t.ended && (this.log("MSE detaching and video ended, reset startPosition"), this.startPosition = this.lastCurrentTime = 0), t && this.onvseeking && this.onvended && (t.removeEventListener("seeking", this.onvseeking), t.removeEventListener("ended", this.onvended), this.onvseeking = this.onvended = null), this.keyLoader && this.keyLoader.detach(), this.media = this.mediaBuffer = null, this.loadedmetadata = !1, this.fragmentTracker.removeAllFragments(), this.stopLoad()
25228                }, r.onMediaSeeking = function () {
25229                    var t = this.config,
25230                        e = this.fragCurrent,
25231                        r = this.media,
25232                        i = this.mediaBuffer,
25233                        n = this.state,
25234                        a = r ? r.currentTime : 0,
25235                        s = Jr.bufferInfo(i || r, a, t.maxBufferHole);
25236                    if (this.log("media seeking to " + (y(a) ? a.toFixed(3) : a) + ", state: " + n), this.state === Li) this.resetLoadingState();
25237                    else if (e) {
25238                        var o = t.maxFragLookUpTolerance,
25239                            l = e.start - o,
25240                            u = e.start + e.duration + o;
25241                        if (!s.len || u < s.start || l > s.end) {
25242                            var h = a > u;
25243                            (a < l || h) && (h && e.loader && (this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"), e.abortRequests(), this.resetLoadingState()), this.fragPrevious = null)
25244                        }
25245                    }
25246                    r && (this.fragmentTracker.removeFragmentsInRange(a, 1 / 0, this.playlistType, !0), this.lastCurrentTime = a), this.loadedmetadata || s.len || (this.nextLoadPosition = this.startPosition = a), this.tickImmediate()
25247                }, r.onMediaEnded = function () {
25248                    this.startPosition = this.lastCurrentTime = 0
25249                }, r.onManifestLoaded = function (t, e) {
25250                    this.startTimeOffset = e.startTimeOffset, this.initPTS = []
25251                }, r.onHandlerDestroying = function () {
25252                    this.hls.off(S.MANIFEST_LOADED, this.onManifestLoaded, this), this.stopLoad(), t.prototype.onHandlerDestroying.call(this), this.hls = null
25253                }, r.onHandlerDestroyed = function () {
25254                    this.state = gi, this.fragmentLoader && this.fragmentLoader.destroy(), this.keyLoader && this.keyLoader.destroy(), this.decrypter && this.decrypter.destroy(), this.hls = this.log = this.warn = this.decrypter = this.keyLoader = this.fragmentLoader = this.fragmentTracker = null, t.prototype.onHandlerDestroyed.call(this)
25255                }, r.loadFragment = function (t, e, r) {
25256                    this._loadFragForPlayback(t, e, r)
25257                }, r._loadFragForPlayback = function (t, e, r) {
25258                    var i = this;
25259                    this._doFragLoad(t, e, r, (function (e) {
25260                        if (i.fragContextChanged(t)) return i.warn("Fragment " + t.sn + (e.part ? " p: " + e.part.index : "") + " of level " + t.level + " was dropped during download."), void i.fragmentTracker.removeFragment(t);
25261                        t.stats.chunkCount++, i._handleFragmentLoadProgress(e)
25262                    })).then((function (e) {
25263                        if (e) {
25264                            var r = i.state;
25265                            i.fragContextChanged(t) ? (r === pi || !i.fragCurrent && r === Ti) && (i.fragmentTracker.removeFragment(t), i.state = vi) : ("payload" in e && (i.log("Loaded fragment " + t.sn + " of level " + t.level), i.hls.trigger(S.FRAG_LOADED, e)), i._handleFragmentLoadComplete(e))
25266                        }
25267                    })).catch((function (e) {
25268                        i.state !== gi && i.state !== Ai && (i.warn(e), i.resetFragmentLoading(t))
25269                    }))
25270                }, r.clearTrackerIfNeeded = function (t) {
25271                    var e, r = this.fragmentTracker;
25272                    if (r.getState(t) === Yr) {
25273                        var i = t.type,
25274                            n = this.getFwdBufferInfo(this.mediaBuffer, i),
25275                            a = Math.max(t.duration, n ? n.len : this.config.maxBufferLength),
25276                            s = this.backtrackFragment;
25277                        (1 == (s ? t.sn - s.sn : 0) || this.reduceMaxBufferLength(a)) && r.removeFragment(t)
25278                    } else 0 === (null == (e = this.mediaBuffer) ? void 0 : e.buffered.length) ? r.removeAllFragments() : r.hasParts(t.type) && (r.detectPartialFragments({
25279                        frag: t,
25280                        part: null,
25281                        stats: t.stats,
25282                        id: t.type
25283                    }), r.getState(t) === Wr && r.removeFragment(t))
25284                }, r.checkLiveUpdate = function (t) {
25285                    if (t.updated && !t.live) {
25286                        var e = t.fragments[t.fragments.length - 1];
25287                        this.fragmentTracker.detectPartialFragments({
25288                            frag: e,
25289                            part: null,
25290                            stats: e.stats,
25291                            id: e.type
25292                        })
25293                    }
25294                    t.fragments[0] || (t.deltaUpdateFailed = !0)
25295                }, r.flushMainBuffer = function (t, e, r) {
25296                    if (void 0 === r && (r = null), t - e) {
25297                        var i = {
25298                            startOffset: t,
25299                            endOffset: e,
25300                            type: r
25301                        };
25302                        this.hls.trigger(S.BUFFER_FLUSHING, i)
25303                    }
25304                }, r._loadInitSegment = function (t, e) {
25305                    var r = this;
25306                    this._doFragLoad(t, e).then((function (e) {
25307                        if (!e || r.fragContextChanged(t) || !r.levels) throw new Error("init load aborted");
25308                        return e
25309                    })).then((function (e) {
25310                        var i = r.hls,
25311                            n = e.payload,
25312                            a = t.decryptdata;
25313                        if (n && n.byteLength > 0 && null != a && a.key && a.iv && "AES-128" === a.method) {
25314                            var s = self.performance.now();
25315                            return r.decrypter.decrypt(new Uint8Array(n), a.key.buffer, a.iv.buffer).catch((function (e) {
25316                                throw i.trigger(S.ERROR, {
25317                                    type: L.MEDIA_ERROR,
25318                                    details: A.FRAG_DECRYPT_ERROR,
25319                                    fatal: !1,
25320                                    error: e,
25321                                    reason: e.message,
25322                                    frag: t
25323                                }), e
25324                            })).then((function (n) {
25325                                var a = self.performance.now();
25326                                return i.trigger(S.FRAG_DECRYPTED, {
25327                                    frag: t,
25328                                    payload: n,
25329                                    stats: {
25330                                        tstart: s,
25331                                        tdecrypt: a
25332                                    }
25333                                }), e.payload = n, r.completeInitSegmentLoad(e)
25334                            }))
25335                        }
25336                        return r.completeInitSegmentLoad(e)
25337                    })).catch((function (e) {
25338                        r.state !== gi && r.state !== Ai && (r.warn(e), r.resetFragmentLoading(t))
25339                    }))
25340                }, r.completeInitSegmentLoad = function (t) {
25341                    if (!this.levels) throw new Error("init load aborted, missing levels");
25342                    var e = t.frag.stats;
25343                    this.state = vi, t.frag.data = new Uint8Array(t.payload), e.parsing.start = e.buffering.start = self.performance.now(), e.parsing.end = e.buffering.end = self.performance.now(), this.tick()
25344                }, r.fragContextChanged = function (t) {
25345                    var e = this.fragCurrent;
25346                    return !t || !e || t.sn !== e.sn || t.level !== e.level
25347                }, r.fragBufferedComplete = function (t, e) {
25348                    var r, i, n, a, s = this.mediaBuffer ? this.mediaBuffer : this.media;
25349                    if (this.log("Buffered " + t.type + " sn: " + t.sn + (e ? " part: " + e.index : "") + " of " + (this.playlistType === we ? "level" : "track") + " " + t.level + " (frag:[" + (null != (r = t.startPTS) ? r : NaN).toFixed(3) + "-" + (null != (i = t.endPTS) ? i : NaN).toFixed(3) + "] > buffer:" + (s ? fi(Jr.getBuffered(s)) : "(detached)") + ")"), "initSegment" !== t.sn) {
25350                        var o;
25351                        if (t.type !== _e) {
25352                            var l = t.elementaryStreams;
25353                            if (!Object.keys(l).some((function (t) {
25354                                    return !!l[t]
25355                                }))) return void(this.state = vi)
25356                        }
25357                        var u = null == (o = this.levels) ? void 0 : o[t.level];
25358                        null != u && u.fragmentError && (this.log("Resetting level fragment error count of " + u.fragmentError + " on frag buffered"), u.fragmentError = 0)
25359                    }
25360                    this.state = vi, s && (!this.loadedmetadata && t.type == we && s.buffered.length && (null == (n = this.fragCurrent) ? void 0 : n.sn) === (null == (a = this.fragPrevious) ? void 0 : a.sn) && (this.loadedmetadata = !0, this.seekToStartPos()), this.tick())
25361                }, r.seekToStartPos = function () {}, r._handleFragmentLoadComplete = function (t) {
25362                    var e = this.transmuxer;
25363                    if (e) {
25364                        var r = t.frag,
25365                            i = t.part,
25366                            n = t.partsLoaded,
25367                            a = !n || 0 === n.length || n.some((function (t) {
25368                                return !t
25369                            })),
25370                            s = new $r(r.level, r.sn, r.stats.chunkCount + 1, 0, i ? i.index : -1, !a);
25371                        e.flush(s)
25372                    }
25373                }, r._handleFragmentLoadProgress = function (t) {}, r._doFragLoad = function (t, e, r, i) {
25374                    var n, a = this;
25375                    void 0 === r && (r = null);
25376                    var s = null == e ? void 0 : e.details;
25377                    if (!this.levels || !s) throw new Error("frag load aborted, missing level" + (s ? "" : " detail") + "s");
25378                    var o = null;
25379                    if (!t.encrypted || null != (n = t.decryptdata) && n.key ? !t.encrypted && s.encryptedFragments.length && this.keyLoader.loadClear(t, s.encryptedFragments) : (this.log("Loading key for " + t.sn + " of [" + s.startSN + "-" + s.endSN + "], " + ("[stream-controller]" === this.logPrefix ? "level" : "track") + " " + t.level), this.state = mi, this.fragCurrent = t, o = this.keyLoader.load(t).then((function (t) {
25380                            if (!a.fragContextChanged(t.frag)) return a.hls.trigger(S.KEY_LOADED, t), a.state === mi && (a.state = vi), t
25381                        })), this.hls.trigger(S.KEY_LOADING, {
25382                            frag: t
25383                        }), null === this.fragCurrent && (o = Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))), r = Math.max(t.start, r || 0), this.config.lowLatencyMode && "initSegment" !== t.sn) {
25384                        var l = s.partList;
25385                        if (l && i) {
25386                            r > t.end && s.fragmentHint && (t = s.fragmentHint);
25387                            var u = this.getNextPart(l, t, r);
25388                            if (u > -1) {
25389                                var h, d = l[u];
25390                                return this.log("Loading part sn: " + t.sn + " p: " + d.index + " cc: " + t.cc + " of playlist [" + s.startSN + "-" + s.endSN + "] parts [0-" + u + "-" + (l.length - 1) + "] " + ("[stream-controller]" === this.logPrefix ? "level" : "track") + ": " + t.level + ", target: " + parseFloat(r.toFixed(3))), this.nextLoadPosition = d.start + d.duration, this.state = pi, h = o ? o.then((function (r) {
25391                                    return !r || a.fragContextChanged(r.frag) ? null : a.doFragPartsLoad(t, d, e, i)
25392                                })).catch((function (t) {
25393                                    return a.handleFragLoadError(t)
25394                                })) : this.doFragPartsLoad(t, d, e, i).catch((function (t) {
25395                                    return a.handleFragLoadError(t)
25396                                })), this.hls.trigger(S.FRAG_LOADING, {
25397                                    frag: t,
25398                                    part: d,
25399                                    targetBufferTime: r
25400                                }), null === this.fragCurrent ? Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")) : h
25401                            }
25402                            if (!t.url || this.loadedEndOfParts(l, r)) return Promise.resolve(null)
25403                        }
25404                    }
25405                    this.log("Loading fragment " + t.sn + " cc: " + t.cc + " " + (s ? "of [" + s.startSN + "-" + s.endSN + "] " : "") + ("[stream-controller]" === this.logPrefix ? "level" : "track") + ": " + t.level + ", target: " + parseFloat(r.toFixed(3))), y(t.sn) && !this.bitrateTest && (this.nextLoadPosition = t.start + t.duration), this.state = pi;
25406                    var c, f = this.config.progressive;
25407                    return c = f && o ? o.then((function (e) {
25408                        return !e || a.fragContextChanged(null == e ? void 0 : e.frag) ? null : a.fragmentLoader.load(t, i)
25409                    })).catch((function (t) {
25410                        return a.handleFragLoadError(t)
25411                    })) : Promise.all([this.fragmentLoader.load(t, f ? i : void 0), o]).then((function (t) {
25412                        var e = t[0];
25413                        return !f && e && i && i(e), e
25414                    })).catch((function (t) {
25415                        return a.handleFragLoadError(t)
25416                    })), this.hls.trigger(S.FRAG_LOADING, {
25417                        frag: t,
25418                        targetBufferTime: r
25419                    }), null === this.fragCurrent ? Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")) : c
25420                }, r.doFragPartsLoad = function (t, e, r, i) {
25421                    var n = this;
25422                    return new Promise((function (a, s) {
25423                        var o, l = [],
25424                            u = null == (o = r.details) ? void 0 : o.partList;
25425                        ! function e(o) {
25426                            n.fragmentLoader.loadPart(t, o, i).then((function (i) {
25427                                l[o.index] = i;
25428                                var s = i.part;
25429                                n.hls.trigger(S.FRAG_LOADED, i);
25430                                var h = ur(r, t.sn, o.index + 1) || hr(u, t.sn, o.index + 1);
25431                                if (!h) return a({
25432                                    frag: t,
25433                                    part: s,
25434                                    partsLoaded: l
25435                                });
25436                                e(h)
25437                            })).catch(s)
25438                        }(e)
25439                    }))
25440                }, r.handleFragLoadError = function (t) {
25441                    if ("data" in t) {
25442                        var e = t.data;
25443                        t.data && e.details === A.INTERNAL_ABORTED ? this.handleFragLoadAborted(e.frag, e.part) : this.hls.trigger(S.ERROR, e)
25444                    } else this.hls.trigger(S.ERROR, {
25445                        type: L.OTHER_ERROR,
25446                        details: A.INTERNAL_EXCEPTION,
25447                        err: t,
25448                        error: t,
25449                        fatal: !0
25450                    });
25451                    return null
25452                }, r._handleTransmuxerFlush = function (t) {
25453                    var e = this.getCurrentContext(t);
25454                    if (e && this.state === Ti) {
25455                        var r = e.frag,
25456                            i = e.part,
25457                            n = e.level,
25458                            a = self.performance.now();
25459                        r.stats.parsing.end = a, i && (i.stats.parsing.end = a), this.updateLevelTiming(r, i, n, t.partial)
25460                    } else this.fragCurrent || this.state === gi || this.state === Ai || (this.state = vi)
25461                }, r.getCurrentContext = function (t) {
25462                    var e = this.levels,
25463                        r = this.fragCurrent,
25464                        i = t.level,
25465                        n = t.sn,
25466                        a = t.part;
25467                    if (null == e || !e[i]) return this.warn("Levels object was unset while buffering fragment " + n + " of level " + i + ". The current chunk will not be buffered."), null;
25468                    var s = e[i],
25469                        o = a > -1 ? ur(s, n, a) : null,
25470                        l = o ? o.fragment : function (t, e, r) {
25471                            if (null == t || !t.details) return null;
25472                            var i = t.details,
25473                                n = i.fragments[e - i.startSN];
25474                            return n || ((n = i.fragmentHint) && n.sn === e ? n : e < i.startSN && r && r.sn === e ? r : null)
25475                        }(s, n, r);
25476                    return l ? (r && r !== l && (l.stats = r.stats), {
25477                        frag: l,
25478                        part: o,
25479                        level: s
25480                    }) : null
25481                }, r.bufferFragmentData = function (t, e, r, i, n) {
25482                    var a;
25483                    if (t && this.state === Ti) {
25484                        var s = t.data1,
25485                            o = t.data2,
25486                            l = s;
25487                        if (s && o && (l = Kt(s, o)), null != (a = l) && a.length) {
25488                            var u = {
25489                                type: t.type,
25490                                frag: e,
25491                                part: r,
25492                                chunkMeta: i,
25493                                parent: e.type,
25494                                data: l
25495                            };
25496                            if (this.hls.trigger(S.BUFFER_APPENDING, u), t.dropped && t.independent && !r) {
25497                                if (n) return;
25498                                this.flushBufferGap(e)
25499                            }
25500                        }
25501                    }
25502                }, r.flushBufferGap = function (t) {
25503                    var e = this.media;
25504                    if (e)
25505                        if (Jr.isBuffered(e, e.currentTime)) {
25506                            var r = e.currentTime,
25507                                i = Jr.bufferInfo(e, r, 0),
25508                                n = t.duration,
25509                                a = Math.min(2 * this.config.maxFragLookUpTolerance, .25 * n),
25510                                s = Math.max(Math.min(t.start - a, i.end - a), r + a);
25511                            t.start - s > a && this.flushMainBuffer(s, t.start)
25512                        } else this.flushMainBuffer(0, t.start)
25513                }, r.getFwdBufferInfo = function (t, e) {
25514                    var r = this.getLoadPosition();
25515                    return y(r) ? this.getFwdBufferInfoAtPos(t, r, e) : null
25516                }, r.getFwdBufferInfoAtPos = function (t, e, r) {
25517                    var i = this.config.maxBufferHole,
25518                        n = Jr.bufferInfo(t, e, i);
25519                    if (0 === n.len && void 0 !== n.nextStart) {
25520                        var a = this.fragmentTracker.getBufferedFrag(e, r);
25521                        if (a && n.nextStart < a.end) return Jr.bufferInfo(t, e, Math.max(n.nextStart, i))
25522                    }
25523                    return n
25524                }, r.getMaxBufferLength = function (t) {
25525                    var e, r = this.config;
25526                    return e = t ? Math.max(8 * r.maxBufferSize / t, r.maxBufferLength) : r.maxBufferLength, Math.min(e, r.maxMaxBufferLength)
25527                }, r.reduceMaxBufferLength = function (t) {
25528                    var e = this.config,
25529                        r = t || e.maxBufferLength,
25530                        i = e.maxMaxBufferLength / 2;
25531                    return i >= r && (e.maxMaxBufferLength = i, this.warn("Reduce max buffer length to " + i + "s"), !0)
25532                }, r.getAppendedFrag = function (t, e) {
25533                    var r = this.fragmentTracker.getAppendedFrag(t, we);
25534                    return r && "fragment" in r ? r.fragment : r
25535                }, r.getNextFragment = function (t, e) {
25536                    var r = e.fragments,
25537                        i = r.length;
25538                    if (!i) return null;
25539                    var n, a = this.config,
25540                        s = r[0].start;
25541                    if (e.live) {
25542                        var o = a.initialLiveManifestSize;
25543                        if (i < o) return this.warn("Not enough fragments to start playback (have: " + i + ", need: " + o + ")"), null;
25544                        (!e.PTSKnown && !this.startFragRequested && -1 === this.startPosition || t < s) && (n = this.getInitialLiveFragment(e, r), this.startPosition = this.nextLoadPosition = n ? this.hls.liveSyncPosition || n.start : t)
25545                    } else t <= s && (n = r[0]);
25546                    if (!n) {
25547                        var l = a.lowLatencyMode ? e.partEnd : e.fragmentEnd;
25548                        n = this.getFragmentAtPosition(t, l, e)
25549                    }
25550                    return this.mapToInitFragWhenRequired(n)
25551                }, r.isLoopLoading = function (t, e) {
25552                    var r = this.fragmentTracker.getState(t);
25553                    return (r === jr || r === Wr && !!t.gap) && this.nextLoadPosition > e
25554                }, r.getNextFragmentLoopLoading = function (t, e, r, i, n) {
25555                    var a = t.gap,
25556                        s = this.getNextFragment(this.nextLoadPosition, e);
25557                    if (null === s) return s;
25558                    if (t = s, a && t && !t.gap && r.nextStart) {
25559                        var o = this.getFwdBufferInfoAtPos(this.mediaBuffer ? this.mediaBuffer : this.media, r.nextStart, i);
25560                        if (null !== o && r.len + o.len >= n) return this.log('buffer full after gaps in "' + i + '" playlist starting at sn: ' + t.sn), null
25561                    }
25562                    return t
25563                }, r.mapToInitFragWhenRequired = function (t) {
25564                    return null == t || !t.initSegment || null != t && t.initSegment.data || this.bitrateTest ? t : t.initSegment
25565                }, r.getNextPart = function (t, e, r) {
25566                    for (var i = -1, n = !1, a = !0, s = 0, o = t.length; s < o; s++) {
25567                        var l = t[s];
25568                        if (a = a && !l.independent, i > -1 && r < l.start) break;
25569                        var u = l.loaded;
25570                        u ? i = -1 : (n || l.independent || a) && l.fragment === e && (i = s), n = u
25571                    }
25572                    return i
25573                }, r.loadedEndOfParts = function (t, e) {
25574                    var r = t[t.length - 1];
25575                    return r && e > r.start && r.loaded
25576                }, r.getInitialLiveFragment = function (t, e) {
25577                    var r = this.fragPrevious,
25578                        i = null;
25579                    if (r) {
25580                        if (t.hasProgramDateTime && (this.log("Live playlist, switching playlist, load frag with same PDT: " + r.programDateTime), i = function (t, e, r) {
25581                                if (null === e || !Array.isArray(t) || !t.length || !y(e)) return null;
25582                                if (e < (t[0].programDateTime || 0)) return null;
25583                                if (e >= (t[t.length - 1].endProgramDateTime || 0)) return null;
25584                                r = r || 0;
25585                                for (var i = 0; i < t.length; ++i) {
25586                                    var n = t[i];
25587                                    if (Tr(e, r, n)) return n
25588                                }
25589                                return null
25590                            }(e, r.endProgramDateTime, this.config.maxFragLookUpTolerance)), !i) {
25591                            var n = r.sn + 1;
25592                            if (n >= t.startSN && n <= t.endSN) {
25593                                var a = e[n - t.startSN];
25594                                r.cc === a.cc && (i = a, this.log("Live playlist, switching playlist, load frag with next SN: " + i.sn))
25595                            }
25596                            i || (i = function (t, e) {
25597                                return pr(t, (function (t) {
25598                                    return t.cc < e ? 1 : t.cc > e ? -1 : 0
25599                                }))
25600                            }(e, r.cc), i && this.log("Live playlist, switching playlist, load frag with same CC: " + i.sn))
25601                        }
25602                    } else {
25603                        var s = this.hls.liveSyncPosition;
25604                        null !== s && (i = this.getFragmentAtPosition(s, this.bitrateTest ? t.fragmentEnd : t.edge, t))
25605                    }
25606                    return i
25607                }, r.getFragmentAtPosition = function (t, e, r) {
25608                    var i, n = this.config,
25609                        a = this.fragPrevious,
25610                        s = r.fragments,
25611                        o = r.endSN,
25612                        l = r.fragmentHint,
25613                        u = n.maxFragLookUpTolerance,
25614                        h = r.partList,
25615                        d = !!(n.lowLatencyMode && null != h && h.length && l);
25616                    if (d && l && !this.bitrateTest && (s = s.concat(l), o = l.sn), i = t < e ? yr(a, s, t, t > e - u ? 0 : u) : s[s.length - 1]) {
25617                        var c = i.sn - r.startSN,
25618                            f = this.fragmentTracker.getState(i);
25619                        if ((f === jr || f === Wr && i.gap) && (a = i), a && i.sn === a.sn && (!d || h[0].fragment.sn > i.sn) && a && i.level === a.level) {
25620                            var g = s[c + 1];
25621                            i = i.sn < o && this.fragmentTracker.getState(g) !== jr ? g : null
25622                        }
25623                    }
25624                    return i
25625                }, r.synchronizeToLiveEdge = function (t) {
25626                    var e = this.config,
25627                        r = this.media;
25628                    if (r) {
25629                        var i = this.hls.liveSyncPosition,
25630                            n = r.currentTime,
25631                            a = t.fragments[0].start,
25632                            s = t.edge,
25633                            o = n >= a - e.maxFragLookUpTolerance && n <= s;
25634                        if (null !== i && r.duration > i && (n < i || !o)) {
25635                            var l = void 0 !== e.liveMaxLatencyDuration ? e.liveMaxLatencyDuration : e.liveMaxLatencyDurationCount * t.targetduration;
25636                            (!o && r.readyState < 4 || n < s - l) && (this.loadedmetadata || (this.nextLoadPosition = i), r.readyState && (this.warn("Playback: " + n.toFixed(3) + " is located too far from the end of live sliding playlist: " + s + ", reset currentTime to : " + i.toFixed(3)), r.currentTime = i))
25637                        }
25638                    }
25639                }, r.alignPlaylists = function (t, e, r) {
25640                    var i = t.fragments.length;
25641                    if (!i) return this.warn("No fragments in live playlist"), 0;
25642                    var n = t.fragments[0].start,
25643                        a = !e,
25644                        s = t.alignedSliding && y(n);
25645                    if (a || !s && !n) {
25646                        var o = this.fragPrevious;
25647                        ri(o, r, t);
25648                        var l = t.fragments[0].start;
25649                        return this.log("Live playlist sliding: " + l.toFixed(2) + " start-sn: " + (e ? e.startSN : "na") + "->" + t.startSN + " prev-sn: " + (o ? o.sn : "na") + " fragments: " + i), l
25650                    }
25651                    return n
25652                }, r.waitForCdnTuneIn = function (t) {
25653                    return t.live && t.canBlockReload && t.partTarget && t.tuneInGoal > Math.max(t.partHoldBack, 3 * t.partTarget)
25654                }, r.setStartPosition = function (t, e) {
25655                    var r = this.startPosition;
25656                    if (r < e && (r = -1), -1 === r || -1 === this.lastCurrentTime) {
25657                        var i = null !== this.startTimeOffset,
25658                            n = i ? this.startTimeOffset : t.startTimeOffset;
25659                        null !== n && y(n) ? (r = e + n, n < 0 && (r += t.totalduration), r = Math.min(Math.max(e, r), e + t.totalduration), this.log("Start time offset " + n + " found in " + (i ? "multivariant" : "media") + " playlist, adjust startPosition to " + r), this.startPosition = r) : t.live ? r = this.hls.liveSyncPosition || e : this.startPosition = r = 0, this.lastCurrentTime = r
25660                    }
25661                    this.nextLoadPosition = r
25662                }, r.getLoadPosition = function () {
25663                    var t = this.media,
25664                        e = 0;
25665                    return this.loadedmetadata && t ? e = t.currentTime : this.nextLoadPosition && (e = this.nextLoadPosition), e
25666                }, r.handleFragLoadAborted = function (t, e) {
25667                    this.transmuxer && "initSegment" !== t.sn && t.stats.aborted && (this.warn("Fragment " + t.sn + (e ? " part " + e.index : "") + " of level " + t.level + " was aborted"), this.resetFragmentLoading(t))
25668                }, r.resetFragmentLoading = function (t) {
25669                    this.fragCurrent && (this.fragContextChanged(t) || this.state === yi) || (this.state = vi)
25670                }, r.onFragmentOrKeyLoadError = function (t, e) {
25671                    if (e.chunkMeta && !e.frag) {
25672                        var r = this.getCurrentContext(e.chunkMeta);
25673                        r && (e.frag = r.frag)
25674                    }
25675                    var i = e.frag;
25676                    if (i && i.type === t && this.levels)
25677                        if (this.fragContextChanged(i)) {
25678                            var n;
25679                            this.warn("Frag load error must match current frag to retry " + i.url + " > " + (null == (n = this.fragCurrent) ? void 0 : n.url))
25680                        } else {
25681                            var a = e.details === A.FRAG_GAP;
25682                            a && this.fragmentTracker.fragBuffered(i, !0);
25683                            var s = e.errorAction,
25684                                o = s || {},
25685                                l = o.action,
25686                                u = o.retryCount,
25687                                h = void 0 === u ? 0 : u,
25688                                d = o.retryConfig;
25689                            if (s && l === Rr && d) {
25690                                this.resetStartWhenNotLoaded(this.levelLastLoaded);
25691                                var c = gr(d, h);
25692                                this.warn("Fragment " + i.sn + " of " + t + " " + i.level 
vendor: 12,992 bytes, lines 25692-25923
25692+ " errored with " + e.details + ", retrying loading " + (h + 1) + "/" + d.maxNumRetry + " in " + c + "ms"), s.resolved = !0, this.retryDate = self.performance.now() + c, this.state = yi
25693                            } else if (d && s) {
25694                                if (this.resetFragmentErrors(t), !(h < d.maxNumRetry)) return void w.warn(e.details + " reached or exceeded max retry (" + h + ")");
25695                                a || l === Ar || (s.resolved = !0)
25696                            } else(null == s ? void 0 : s.action) === Lr ? this.state = ki : this.state = Ai;
25697                            this.tickImmediate()
25698                        }
25699                }, r.reduceLengthAndFlushBuffer = function (t) {
25700                    if (this.state === Ti || this.state === Si) {
25701                        var e = t.parent,
25702                            r = this.getFwdBufferInfo(this.mediaBuffer, e),
25703                            i = r && r.len > .5;
25704                        i && this.reduceMaxBufferLength(r.len);
25705                        var n = !i;
25706                        return n && this.warn("Buffer full error while media.currentTime is not buffered, flush " + e + " buffer"), t.frag && (this.fragmentTracker.removeFragment(t.frag), this.nextLoadPosition = t.frag.start), this.resetLoadingState(), n
25707                    }
25708                    return !1
25709                }, r.resetFragmentErrors = function (t) {
25710                    t === Ce && (this.fragCurrent = null), this.loadedmetadata || (this.startFragRequested = !1), this.state !== gi && (this.state = vi)
25711                }, r.afterBufferFlushed = function (t, e, r) {
25712                    if (t) {
25713                        var i = Jr.getBuffered(t);
25714                        this.fragmentTracker.detectEvictedFragments(e, i, r), this.state === Li && this.resetLoadingState()
25715                    }
25716                }, r.resetLoadingState = function () {
25717                    this.log("Reset loading state"), this.fragCurrent = null, this.fragPrevious = null, this.state = vi
25718                }, r.resetStartWhenNotLoaded = function (t) {
25719                    if (!this.loadedmetadata) {
25720                        this.startFragRequested = !1;
25721                        var e = t ? t.details : null;
25722                        null != e && e.live ? (this.startPosition = -1, this.setStartPosition(e, 0), this.resetLoadingState()) : this.nextLoadPosition = this.startPosition
25723                    }
25724                }, r.resetWhenMissingContext = function (t) {
25725                    this.warn("The loading context changed while buffering fragment " + t.sn + " of level " + t.level + ". This chunk will not be buffered."), this.removeUnbufferedFrags(), this.resetStartWhenNotLoaded(this.levelLastLoaded), this.resetLoadingState()
25726                }, r.removeUnbufferedFrags = function (t) {
25727                    void 0 === t && (t = 0), this.fragmentTracker.removeFragmentsInRange(t, 1 / 0, this.playlistType, !1, !0)
25728                }, r.updateLevelTiming = function (t, e, r, i) {
25729                    var n, a = this,
25730                        s = r.details;
25731                    if (s) {
25732                        if (!Object.keys(t.elementaryStreams).reduce((function (e, n) {
25733                                var o = t.elementaryStreams[n];
25734                                if (o) {
25735                                    var l = o.endPTS - o.startPTS;
25736                                    if (l <= 0) return a.warn("Could not parse fragment " + t.sn + " " + n + " duration reliably (" + l + ")"), e || !1;
25737                                    var u = i ? 0 : ar(s, t, o.startPTS, o.endPTS, o.startDTS, o.endDTS);
25738                                    return a.hls.trigger(S.LEVEL_PTS_UPDATED, {
25739                                        details: s,
25740                                        level: r,
25741                                        drift: u,
25742                                        type: n,
25743                                        frag: t,
25744                                        start: o.startPTS,
25745                                        end: o.endPTS
25746                                    }), !0
25747                                }
25748                                return e
25749                            }), !1) && null === (null == (n = this.transmuxer) ? void 0 : n.error)) {
25750                            var o = new Error("Found no media in fragment " + t.sn + " of level " + t.level + " resetting transmuxer to fallback to playlist timing");
25751                            if (0 === r.fragmentError && (r.fragmentError++, t.gap = !0, this.fragmentTracker.removeFragment(t), this.fragmentTracker.fragBuffered(t, !0)), this.warn(o.message), this.hls.trigger(S.ERROR, {
25752                                    type: L.MEDIA_ERROR,
25753                                    details: A.FRAG_PARSING_ERROR,
25754                                    fatal: !1,
25755                                    error: o,
25756                                    frag: t,
25757                                    reason: "Found no media in msn " + t.sn + ' of level "' + r.url + '"'
25758                                }), !this.hls) return;
25759                            this.resetTransmuxer()
25760                        }
25761                        this.state = Si, this.hls.trigger(S.FRAG_PARSED, {
25762                            frag: t,
25763                            part: e
25764                        })
25765                    } else this.warn("level.details undefined")
25766                }, r.resetTransmuxer = function () {
25767                    this.transmuxer && (this.transmuxer.destroy(), this.transmuxer = null)
25768                }, r.recoverWorkerError = function (t) {
25769                    "demuxerWorker" === t.event && (this.fragmentTracker.removeAllFragments(), this.resetTransmuxer(), this.resetStartWhenNotLoaded(this.levelLastLoaded), this.resetLoadingState())
25770                }, s(e, [{
25771                    key: "state",
25772                    get: function () {
25773                        return this._state
25774                    },
25775                    set: function (t) {
25776                        var e = this._state;
25777                        e !== t && (this._state = t, this.log(e + "->" + t))
25778                    }
25779                }]), e
25780            }(Hr),
25781            Di = function () {
25782                function t() {
25783                    this.chunks = [], this.dataLength = 0
25784                }
25785                var e = t.prototype;
25786                return e.push = function (t) {
25787                    this.chunks.push(t), this.dataLength += t.length
25788                }, e.flush = function () {
25789                    var t, e = this.chunks,
25790                        r = this.dataLength;
25791                    return e.length ? (t = 1 === e.length ? e[0] : function (t, e) {
25792                        for (var r = new Uint8Array(e), i = 0, n = 0; n < t.length; n++) {
25793                            var a = t[n];
25794                            r.set(a, i), i += a.length
25795                        }
25796                        return r
25797                    }(e, r), this.reset(), t) : new Uint8Array(0)
25798                }, e.reset = function () {
25799                    this.chunks.length = 0, this.dataLength = 0
25800                }, t
25801            }();
25802
25803        function Ii(t, e) {
25804            return void 0 === t && (t = ""), void 0 === e && (e = 9e4), {
25805                type: t,
25806                id: -1,
25807                pid: -1,
25808                inputTimeScale: e,
25809                sequenceNumber: -1,
25810                samples: [],
25811                dropped: 0
25812            }
25813        }
25814        var wi = function () {
25815                function t() {
25816                    this._audioTrack = void 0, this._id3Track = void 0, this.frameIndex = 0, this.cachedData = null, this.basePTS = null, this.initPTS = null, this.lastPTS = null
25817                }
25818                var e = t.prototype;
25819                return e.resetInitSegment = function (t, e, r, i) {
25820                    this._id3Track = {
25821                        type: "id3",
25822                        id: 3,
25823                        pid: -1,
25824                        inputTimeScale: 9e4,
25825                        sequenceNumber: 0,
25826                        samples: [],
25827                        dropped: 0
25828                    }
25829                }, e.resetTimeStamp = function (t) {
25830                    this.initPTS = t, this.resetContiguity()
25831                }, e.resetContiguity = function () {
25832                    this.basePTS = null, this.lastPTS = null, this.frameIndex = 0
25833                }, e.canParse = function (t, e) {
25834                    return !1
25835                }, e.appendFrame = function (t, e, r) {}, e.demux = function (t, e) {
25836                    this.cachedData && (t = Kt(this.cachedData, t), this.cachedData = null);
25837                    var r, i = lt(t, 0),
25838                        n = i ? i.length : 0,
25839                        a = this._audioTrack,
25840                        s = this._id3Track,
25841                        o = i ? dt(i) : void 0,
25842                        l = t.length;
25843                    for ((null === this.basePTS || 0 === this.frameIndex && y(o)) && (this.basePTS = Ci(o, e, this.initPTS), this.lastPTS = this.basePTS), null === this.lastPTS && (this.lastPTS = this.basePTS), i && i.length > 0 && s.samples.push({
25844                            pts: this.lastPTS,
25845                            dts: this.lastPTS,
25846                            data: i,
25847                            type: Ge,
25848                            duration: Number.POSITIVE_INFINITY
25849                        }); n < l;) {
25850                        if (this.canParse(t, n)) {
25851                            var u = this.appendFrame(a, t, n);
25852                            u ? (this.frameIndex++, this.lastPTS = u.sample.pts, r = n += u.length) : n = l
25853                        } else ht(t, n) ? (i = lt(t, n), s.samples.push({
25854                            pts: this.lastPTS,
25855                            dts: this.lastPTS,
25856                            data: i,
25857                            type: Ge,
25858                            duration: Number.POSITIVE_INFINITY
25859                        }), r = n += i.length) : n++;
25860                        if (n === l && r !== l) {
25861                            var h = nt(t, r);
25862                            this.cachedData ? this.cachedData = Kt(this.cachedData, h) : this.cachedData = h
25863                        }
25864                    }
25865                    return {
25866                        audioTrack: a,
25867                        videoTrack: Ii(),
25868                        id3Track: s,
25869                        textTrack: Ii()
25870                    }
25871                }, e.demuxSampleAes = function (t, e, r) {
25872                    return Promise.reject(new Error("[" + this + "] This demuxer does not support Sample-AES decryption"))
25873                }, e.flush = function (t) {
25874                    var e = this.cachedData;
25875                    return e && (this.cachedData = null, this.demux(e, 0)), {
25876                        audioTrack: this._audioTrack,
25877                        videoTrack: Ii(),
25878                        id3Track: this._id3Track,
25879                        textTrack: Ii()
25880                    }
25881                }, e.destroy = function () {}, t
25882            }(),
25883            Ci = function (t, e, r) {
25884                return y(t) ? 90 * t : 9e4 * e + (r ? 9e4 * r.baseTime / r.timescale : 0)
25885            };
25886
25887        function _i(t, e) {
25888            return 255 === t[e] && 240 == (246 & t[e + 1])
25889        }
25890
25891        function xi(t, e) {
25892            return 1 & t[e + 1] ? 7 : 9
25893        }
25894
25895        function Pi(t, e) {
25896            return (3 & t[e + 3]) << 11 | t[e + 4] << 3 | (224 & t[e + 5]) >>> 5
25897        }
25898
25899        function Fi(t, e) {
25900            return e + 1 < t.length && _i(t, e)
25901        }
25902
25903        function Mi(t, e) {
25904            if (Fi(t, e)) {
25905                var r = xi(t, e);
25906                if (e + r >= t.length) return !1;
25907                var i = Pi(t, e);
25908                if (i <= r) return !1;
25909                var n = e + i;
25910                return n === t.length || Fi(t, n)
25911            }
25912            return !1
25913        }
25914
25915        function Oi(t, e, r, i, n) {
25916            if (!t.samplerate) {
25917                var a = function (t, e, r, i) {
25918                    var n, a, s, o, l = navigator.userAgent.toLowerCase(),
25919                        u = i,
25920                        h = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
25921                    n = 1 + ((192 & e[r + 2]) >>> 6);
25922                    var d = (60 & e[r + 2]) >>> 2;
25923                    if (!(d > h.length - 1)) return s = (1 & e[r + 2]) << 2, s |= (192 & e[r + 3]) >>> 6, w.log("manifest codec:" + i + ", ADTS type:" + n + ", samplingIndex:" + d), /firefox/i.test(l) ? d >= 6 ? (n = 5, o = new Array(4), a = d - 3) : (n = 2, o = new Array(2), a = d) : 
vendor: 10,450 bytes, lines 25923-26148
25923-1 !== l.indexOf("android") ? (n = 2, o = new Array(2), a = d) : (n = 5, o = new Array(4), i && (-1 !== i.indexOf("mp4a.40.29") || -1 !== i.indexOf("mp4a.40.5")) || !i && d >= 6 ? a = d - 3 : ((i && -1 !== i.indexOf("mp4a.40.2") && (d >= 6 && 1 === s || /vivaldi/i.test(l)) || !i && 1 === s) && (n = 2, o = new Array(2)), a = d)), o[0] = n << 3, o[0] |= (14 & d) >> 1, o[1] |= (1 & d) << 7, o[1] |= s << 3, 5 === n && (o[1] |= (14 & a) >> 1, o[2] = (1 & a) << 7, o[2] |= 8, o[3] = 0), {
25924                        config: o,
25925                        samplerate: h[d],
25926                        channelCount: s,
25927                        codec: "mp4a.40." + n,
25928                        manifestCodec: u
25929                    };
25930                    var c = new Error("invalid ADTS sampling index:" + d);
25931                    t.emit(S.ERROR, S.ERROR, {
25932                        type: L.MEDIA_ERROR,
25933                        details: A.FRAG_PARSING_ERROR,
25934                        fatal: !0,
25935                        error: c,
25936                        reason: c.message
25937                    })
25938                }(e, r, i, n);
25939                if (!a) return;
25940                t.config = a.config, t.samplerate = a.samplerate, t.channelCount = a.channelCount, t.codec = a.codec, t.manifestCodec = a.manifestCodec, w.log("parsed codec:" + t.codec + ", rate:" + a.samplerate + ", channels:" + a.channelCount)
25941            }
25942        }
25943
25944        function Ni(t) {
25945            return 9216e4 / t
25946        }
25947
25948        function Ui(t, e, r, i, n) {
25949            var a, s = i + n * Ni(t.samplerate),
25950                o = function (t, e) {
25951                    var r = xi(t, e);
25952                    if (e + r <= t.length) {
25953                        var i = Pi(t, e) - r;
25954                        if (i > 0) return {
25955                            headerLength: r,
25956                            frameLength: i
25957                        }
25958                    }
25959                }(e, r);
25960            if (o) {
25961                var l = o.frameLength,
25962                    u = o.headerLength,
25963                    h = u + l,
25964                    d = Math.max(0, r + h - e.length);
25965                d ? (a = new Uint8Array(h - u)).set(e.subarray(r + u, e.length), 0) : a = e.subarray(r + u, r + h);
25966                var c = {
25967                    unit: a,
25968                    pts: s
25969                };
25970                return d || t.samples.push(c), {
25971                    sample: c,
25972                    length: h,
25973                    missing: d
25974                }
25975            }
25976            var f = e.length - r;
25977            return (a = new Uint8Array(f)).set(e.subarray(r, e.length), 0), {
25978                sample: {
25979                    unit: a,
25980                    pts: s
25981                },
25982                length: f,
25983                missing: -1
25984            }
25985        }
25986        var Bi = null,
25987            Gi = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160],
25988            Ki = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3],
25989            Hi = [
25990                [0, 72, 144, 12],
25991                [0, 0, 0, 0],
25992                [0, 72, 144, 12],
25993                [0, 144, 144, 12]
25994            ],
25995            Vi = [0, 1, 1, 4];
25996
25997        function Yi(t, e, r, i, n) {
25998            if (!(r + 24 > e.length)) {
25999                var a = Wi(e, r);
26000                if (a && r + a.frameLength <= e.length) {
26001                    var s = i + n * (9e4 * a.samplesPerFrame / a.sampleRate),
26002                        o = {
26003                            unit: e.subarray(r, r + a.frameLength),
26004                            pts: s,
26005                            dts: s
26006                        };
26007                    return t.config = [], t.channelCount = a.channelCount, t.samplerate = a.sampleRate, t.samples.push(o), {
26008                        sample: o,
26009                        length: a.frameLength,
26010                        missing: 0
26011                    }
26012                }
26013            }
26014        }
26015
26016        function Wi(t, e) {
26017            var r = t[e + 1] >> 3 & 3,
26018                i = t[e + 1] >> 1 & 3,
26019                n = t[e + 2] >> 4 & 15,
26020                a = t[e + 2] >> 2 & 3;
26021            if (1 !== r && 0 !== n && 15 !== n && 3 !== a) {
26022                var s = t[e + 2] >> 1 & 1,
26023                    o = t[e + 3] >> 6,
26024                    l = 1e3 * Gi[14 * (3 === r ? 3 - i : 3 === i ? 3 : 4) + n - 1],
26025                    u = Ki[3 * (3 === r ? 0 : 2 === r ? 1 : 2) + a],
26026                    h = 3 === o ? 1 : 2,
26027                    d = Hi[r][i],
26028                    c = Vi[i],
26029                    f = 8 * d * c,
26030                    g = Math.floor(d * l / u + s) * c;
26031                if (null === Bi) {
26032                    var v = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
26033                    Bi = v ? parseInt(v[1]) : 0
26034                }
26035                return !!Bi && Bi <= 87 && 2 === i && l >= 224e3 && 0 === o && (t[e + 3] = 128 | t[e + 3]), {
26036                    sampleRate: u,
26037                    channelCount: h,
26038                    frameLength: g,
26039                    samplesPerFrame: f
26040                }
26041            }
26042        }
26043
26044        function ji(t, e) {
26045            return 255 === t[e] && 224 == (224 & t[e + 1]) && 0 != (6 & t[e + 1])
26046        }
26047
26048        function qi(t, e) {
26049            return e + 1 < t.length && ji(t, e)
26050        }
26051
26052        function Xi(t, e) {
26053            if (e + 1 < t.length && ji(t, e)) {
26054                var r = Wi(t, e),
26055                    i = 4;
26056                null != r && r.frameLength && (i = r.frameLength);
26057                var n = e + i;
26058                return n === t.length || qi(t, n)
26059            }
26060            return !1
26061        }
26062        var zi = function (t) {
26063                function e(e, r) {
26064                    var i;
26065                    return (i = t.call(this) || this).observer = void 0, i.config = void 0, i.observer = e, i.config = r, i
26066                }
26067                l(e, t);
26068                var r = e.prototype;
26069                return r.resetInitSegment = function (e, r, i, n) {
26070                    t.prototype.resetInitSegment.call(this, e, r, i, n), this._audioTrack = {
26071                        container: "audio/adts",
26072                        type: "audio",
26073                        id: 2,
26074                        pid: -1,
26075                        sequenceNumber: 0,
26076                        segmentCodec: "aac",
26077                        samples: [],
26078                        manifestCodec: r,
26079                        duration: n,
26080                        inputTimeScale: 9e4,
26081                        dropped: 0
26082                    }
26083                }, e.probe = function (t) {
26084                    if (!t) return !1;
26085                    var e = lt(t, 0),
26086                        r = (null == e ? void 0 : e.length) || 0;
26087                    if (Xi(t, r)) return !1;
26088                    for (var i = t.length; r < i; r++)
26089                        if (Mi(t, r)) return w.log("ADTS sync word found !"), !0;
26090                    return !1
26091                }, r.canParse = function (t, e) {
26092                    return function (t, e) {
26093                        return function (t, e) {
26094                            return e + 5 < t.length
26095                        }(t, e) && _i(t, e) && Pi(t, e) <= t.length - e
26096                    }(t, e)
26097                }, r.appendFrame = function (t, e, r) {
26098                    Oi(t, this.observer, e, r, t.manifestCodec);
26099                    var i = Ui(t, e, r, this.basePTS, this.frameIndex);
26100                    if (i && 0 === i.missing) return i
26101                }, e
26102            }(wi),
26103            Qi = /\/emsg[-/]ID3/i,
26104            Ji = function () {
26105                function t(t, e) {
26106                    this.remainderData = null, this.timeOffset = 0, this.config = void 0, this.videoTrack = void 0, this.audioTrack = void 0, this.id3Track = void 0, this.txtTrack = void 0, this.config = e
26107                }
26108                var e = t.prototype;
26109                return e.resetTimeStamp = function () {}, e.resetInitSegment = function (t, e, r, i) {
26110                    var n = this.videoTrack = Ii("video", 1),
26111                        a = this.audioTrack = Ii("audio", 1),
26112                        s = this.txtTrack = Ii("text", 1);
26113                    if (this.id3Track = Ii("id3", 1), this.timeOffset = 0, null != t && t.byteLength) {
26114                        var o = Ft(t);
26115                        if (o.video) {
26116                            var l = o.video,
26117                                u = l.id,
26118                                h = l.timescale,
26119                                d = l.codec;
26120                            n.id = u, n.timescale = s.timescale = h, n.codec = d
26121                        }
26122                        if (o.audio) {
26123                            var c = o.audio,
26124                                f = c.id,
26125                                g = c.timescale,
26126                                v = c.codec;
26127                            a.id = f, a.timescale = g, a.codec = v
26128                        }
26129                        s.id = kt.text, n.sampleDuration = 0, n.duration = a.duration = i
26130                    }
26131                }, e.resetContiguity = function () {
26132                    this.remainderData = null
26133                }, t.probe = function (t) {
26134                    return function (t) {
26135                        for (var e = t.byteLength, r = 0; r < e;) {
26136                            var i = It(t, r);
26137                            if (i > 8 && 109 === t[r + 4] && 111 === t[r + 5] && 111 === t[r + 6] && 102 === t[r + 7]) return !0;
26138                            r = i > 1 ? r + i : e
26139                        }
26140                        return !1
26141                    }(t)
26142                }, e.demux = function (t, e) {
26143                    this.timeOffset = e;
26144                    var r = t,
26145                        i = this.videoTrack,
26146                        n = this.txtTrack;
26147                    if (this.config.progressive) {
26148                        this.remainderData && (r = Kt(this.remainderData, t));
vendor: 12,854 bytes, lines 26149-26381
26149                        var a = function (t) {
26150                            var e = {
26151                                    valid: null,
26152                                    remainder: null
26153                                },
26154                                r = xt(t, ["moof"]);
26155                            if (r.length < 2) return e.remainder = t, e;
26156                            var i = r[r.length - 1];
26157                            return e.valid = nt(t, 0, i.byteOffset - 8), e.remainder = nt(t, i.byteOffset - 8), e
26158                        }(r);
26159                        this.remainderData = a.remainder, i.samples = a.valid || new Uint8Array
26160                    } else i.samples = r;
26161                    var s = this.extractID3Track(i, e);
26162                    return n.samples = Ht(e, i), {
26163                        videoTrack: i,
26164                        audioTrack: this.audioTrack,
26165                        id3Track: s,
26166                        textTrack: this.txtTrack
26167                    }
26168                }, e.flush = function () {
26169                    var t = this.timeOffset,
26170                        e = this.videoTrack,
26171                        r = this.txtTrack;
26172                    e.samples = this.remainderData || new Uint8Array, this.remainderData = null;
26173                    var i = this.extractID3Track(e, this.timeOffset);
26174                    return r.samples = Ht(t, e), {
26175                        videoTrack: e,
26176                        audioTrack: Ii(),
26177                        id3Track: i,
26178                        textTrack: Ii()
26179                    }
26180                }, e.extractID3Track = function (t, e) {
26181                    var r = this.id3Track;
26182                    if (t.samples.length) {
26183                        var i = xt(t.samples, ["emsg"]);
26184                        i && i.forEach((function (t) {
26185                            var i = function (t) {
26186                                var e = t[0],
26187                                    r = "",
26188                                    i = "",
26189                                    n = 0,
26190                                    a = 0,
26191                                    s = 0,
26192                                    o = 0,
26193                                    l = 0,
26194                                    u = 0;
26195                                if (0 === e) {
26196                                    for (;
26197                                        "\0" !== bt(t.subarray(u, u + 1));) r += bt(t.subarray(u, u + 1)), u += 1;
26198                                    for (r += bt(t.subarray(u, u + 1)), u += 1;
26199                                        "\0" !== bt(t.subarray(u, u + 1));) i += bt(t.subarray(u, u + 1)), u += 1;
26200                                    i += bt(t.subarray(u, u + 1)), u += 1, n = It(t, 12), a = It(t, 16), o = It(t, 20), l = It(t, 24), u = 28
26201                                } else if (1 === e) {
26202                                    n = It(t, u += 4);
26203                                    var h = It(t, u += 4),
26204                                        d = It(t, u += 4);
26205                                    for (u += 4, s = Math.pow(2, 32) * h + d, E(s) || (s = Number.MAX_SAFE_INTEGER, w.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")), o = It(t, u), l = It(t, u += 4), u += 4;
26206                                        "\0" !== bt(t.subarray(u, u + 1));) r += bt(t.subarray(u, u + 1)), u += 1;
26207                                    for (r += bt(t.subarray(u, u + 1)), u += 1;
26208                                        "\0" !== bt(t.subarray(u, u + 1));) i += bt(t.subarray(u, u + 1)), u += 1;
26209                                    i += bt(t.subarray(u, u + 1)), u += 1
26210                                }
26211                                return {
26212                                    schemeIdUri: r,
26213                                    value: i,
26214                                    timeScale: n,
26215                                    presentationTime: s,
26216                                    presentationTimeDelta: a,
26217                                    eventDuration: o,
26218                                    id: l,
26219                                    payload: t.subarray(u, t.byteLength)
26220                                }
26221                            }(t);
26222                            if (Qi.test(i.schemeIdUri)) {
26223                                var n = y(i.presentationTime) ? i.presentationTime / i.timeScale : e + i.presentationTimeDelta / i.timeScale,
26224                                    a = 4294967295 === i.eventDuration ? Number.POSITIVE_INFINITY : i.eventDuration / i.timeScale;
26225                                a <= .001 && (a = Number.POSITIVE_INFINITY);
26226                                var s = i.payload;
26227                                r.samples.push({
26228                                    data: s,
26229                                    len: s.byteLength,
26230                                    dts: n,
26231                                    pts: n,
26232                                    type: He,
26233                                    duration: a
26234                                })
26235                            }
26236                        }))
26237                    }
26238                    return r
26239                }, e.demuxSampleAes = function (t, e, r) {
26240                    return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))
26241                }, e.destroy = function () {}, t
26242            }(),
26243            $i = function (t, e) {
26244                var r = 0,
26245                    i = 5;
26246                e += i;
26247                for (var n = new Uint32Array(1), a = new Uint32Array(1), s = new Uint8Array(1); i > 0;) {
26248                    s[0] = t[e];
26249                    var o = Math.min(i, 8),
26250                        l = 8 - o;
26251                    a[0] = 4278190080 >>> 24 + l << l, n[0] = (s[0] & a[0]) >> l, r = r ? r << o | n[0] : n[0], e += 1, i -= o
26252                }
26253                return r
26254            },
26255            Zi = function (t) {
26256                function e(e) {
26257                    var r;
26258                    return (r = t.call(this) || this).observer = void 0, r.observer = e, r
26259                }
26260                l(e, t);
26261                var r = e.prototype;
26262                return r.resetInitSegment = function (e, r, i, n) {
26263                    t.prototype.resetInitSegment.call(this, e, r, i, n), this._audioTrack = {
26264                        container: "audio/ac-3",
26265                        type: "audio",
26266                        id: 2,
26267                        pid: -1,
26268                        sequenceNumber: 0,
26269                        segmentCodec: "ac3",
26270                        samples: [],
26271                        manifestCodec: r,
26272                        duration: n,
26273                        inputTimeScale: 9e4,
26274                        dropped: 0
26275                    }
26276                }, r.canParse = function (t, e) {
26277                    return e + 64 < t.length
26278                }, r.appendFrame = function (t, e, r) {
26279                    var i = tn(t, e, r, this.basePTS, this.frameIndex);
26280                    if (-1 !== i) return {
26281                        sample: t.samples[t.samples.length - 1],
26282                        length: i,
26283                        missing: 0
26284                    }
26285                }, e.probe = function (t) {
26286                    if (!t) return !1;
26287                    var e = lt(t, 0);
26288                    if (!e) return !1;
26289                    var r = e.length;
26290                    return 11 === t[r] && 119 === t[r + 1] && void 0 !== dt(e) && $i(t, r) < 16
26291                }, e
26292            }(wi);
26293
26294        function tn(t, e, r, i, n) {
26295            if (r + 8 > e.length) return -1;
26296            if (11 !== e[r] || 119 !== e[r + 1]) return -1;
26297            var a = e[r + 4] >> 6;
26298            if (a >= 3) return -1;
26299            var s = [48e3, 44100, 32e3][a],
26300                o = 63 & e[r + 4],
26301                l = 2 * [64, 69, 96, 64, 70, 96, 80, 87, 120, 80, 88, 120, 96, 104, 144, 96, 105, 144, 112, 121, 168, 112, 122, 168, 128, 139, 192, 128, 140, 192, 160, 174, 240, 160, 175, 240, 192, 208, 288, 192, 209, 288, 224, 243, 336, 224, 244, 336, 256, 278, 384, 256, 279, 384, 320, 348, 480, 320, 349, 480, 384, 417, 576, 384, 418, 576, 448, 487, 672, 448, 488, 672, 512, 557, 768, 512, 558, 768, 640, 696, 960, 640, 697, 960, 768, 835, 1152, 768, 836, 1152, 896, 975, 1344, 896, 976, 1344, 1024, 1114, 1536, 1024, 1115, 1536, 1152, 1253, 1728, 1152, 1254, 1728, 1280, 1393, 1920, 1280, 1394, 1920][3 * o + a];
26302            if (r + l > e.length) return -1;
26303            var u = e[r + 6] >> 5,
26304                h = 0;
26305            2 === u ? h += 2 : (1 & u && 1 !== u && (h += 2), 4 & u && (h += 2));
26306            var d = (e[r + 6] << 8 | e[r + 7]) >> 12 - h & 1,
26307                c = [2, 1, 2, 3, 3, 4, 4, 5][u] + d,
26308                f = e[r + 5] >> 3,
26309                g = 7 & e[r + 5],
26310                v = new Uint8Array([a << 6 | f << 1 | g >> 2, (3 & g) << 6 | u << 3 | d << 2 | o >> 4, o << 4 & 224]),
26311                m = i + n * (1536 / s * 9e4),
26312                p = e.subarray(r, r + l);
26313            return t.config = v, t.channelCount = c, t.samplerate = s, t.samples.push({
26314                unit: p,
26315                pts: m
26316            }), l
26317        }
26318        var en = function () {
26319                function t() {
26320                    this.VideoSample = null
26321                }
26322                var e = t.prototype;
26323                return e.createVideoSample = function (t, e, r, i) {
26324                    return {
26325                        key: t,
26326                        frame: !1,
26327                        pts: e,
26328                        dts: r,
26329                        units: [],
26330                        debug: i,
26331                        length: 0
26332                    }
26333                }, e.getLastNalUnit = function (t) {
26334                    var e, r, i = this.VideoSample;
26335                    if (i && 0 !== i.units.length || (i = t[t.length - 1]), null != (e = i) && e.units) {
26336                        var n = i.units;
26337                        r = n[n.length - 1]
26338                    }
26339                    return r
26340                }, e.pushAccessUnit = function (t, e) {
26341                    if (t.units.length && t.frame) {
26342                        if (void 0 === t.pts) {
26343                            var r = e.samples,
26344                                i = r.length;
26345                            if (!i) return void e.dropped++;
26346                            var n = r[i - 1];
26347                            t.pts = n.pts, t.dts = n.dts
26348                        }
26349                        e.samples.push(t)
26350                    }
26351                    t.debug.length && w.log(t.pts + "/" + t.dts + ":" + t.debug)
26352                }, t
26353            }(),
26354            rn = function () {
26355                function t(t) {
26356                    this.data = void 0, this.bytesAvailable = void 0, this.word = void 0, this.bitsAvailable = void 0, this.data = t, this.bytesAvailable = t.byteLength, this.word = 0, this.bitsAvailable = 0
26357                }
26358                var e = t.prototype;
26359                return e.loadWord = function () {
26360                    var t = this.data,
26361                        e = this.bytesAvailable,
26362                        r = t.byteLength - e,
26363                        i = new Uint8Array(4),
26364                        n = Math.min(4, e);
26365                    if (0 === n) throw new Error("no bytes available");
26366                    i.set(t.subarray(r, r + n)), this.word = new DataView(i.buffer).getUint32(0), this.bitsAvailable = 8 * n, this.bytesAvailable -= n
26367                }, e.skipBits = function (t) {
26368                    var e;
26369                    t = Math.min(t, 8 * this.bytesAvailable + this.bitsAvailable), this.bitsAvailable > t ? (this.word <<= t, this.bitsAvailable -= t) : (t -= this.bitsAvailable, t -= (e = t >> 3) << 3, this.bytesAvailable -= e, this.loadWord(), this.word <<= t, this.bitsAvailable -= t)
26370                }, e.readBits = function (t) {
26371                    var e = Math.min(this.bitsAvailable, t),
26372                        r = this.word >>> 32 - e;
26373                    if (t > 32 && w.error("Cannot read more than 32 bits at a time"), this.bitsAvailable -= e, this.bitsAvailable > 0) this.word <<= e;
26374                    else {
26375                        if (!(this.bytesAvailable > 0)) throw new Error("no bits available");
26376                        this.loadWord()
26377                    }
26378                    return (e = t - e) > 0 && this.bitsAvailable ? r << e | this.readBits(e) : r
26379                }, e.skipLZ = function () {
26380                    var t;
26381                    for (t = 0; t < this.bitsAvailable;
vendor: 5,205 bytes, lines 26381-26501
26381 ++t)
26382                        if (0 != (this.word & 2147483648 >>> t)) return this.word <<= t, this.bitsAvailable -= t, t;
26383                    return this.loadWord(), t + this.skipLZ()
26384                }, e.skipUEG = function () {
26385                    this.skipBits(1 + this.skipLZ())
26386                }, e.skipEG = function () {
26387                    this.skipBits(1 + this.skipLZ())
26388                }, e.readUEG = function () {
26389                    var t = this.skipLZ();
26390                    return this.readBits(t + 1) - 1
26391                }, e.readEG = function () {
26392                    var t = this.readUEG();
26393                    return 1 & t ? 1 + t >>> 1 : -1 * (t >>> 1)
26394                }, e.readBoolean = function () {
26395                    return 1 === this.readBits(1)
26396                }, e.readUByte = function () {
26397                    return this.readBits(8)
26398                }, e.readUShort = function () {
26399                    return this.readBits(16)
26400                }, e.readUInt = function () {
26401                    return this.readBits(32)
26402                }, e.skipScalingList = function (t) {
26403                    for (var e = 8, r = 8, i = 0; i < t; i++) 0 !== r && (r = (e + this.readEG() + 256) % 256), e = 0 === r ? e : r
26404                }, e.readSPS = function () {
26405                    var t, e, r, i = 0,
26406                        n = 0,
26407                        a = 0,
26408                        s = 0,
26409                        o = this.readUByte.bind(this),
26410                        l = this.readBits.bind(this),
26411                        u = this.readUEG.bind(this),
26412                        h = this.readBoolean.bind(this),
26413                        d = this.skipBits.bind(this),
26414                        c = this.skipEG.bind(this),
26415                        f = this.skipUEG.bind(this),
26416                        g = this.skipScalingList.bind(this);
26417                    o();
26418                    var v = o();
26419                    if (l(5), d(3), o(), f(), 100 === v || 110 === v || 122 === v || 244 === v || 44 === v || 83 === v || 86 === v || 118 === v || 128 === v) {
26420                        var m = u();
26421                        if (3 === m && d(1), f(), f(), d(1), h())
26422                            for (e = 3 !== m ? 8 : 12, r = 0; r < e; r++) h() && g(r < 6 ? 16 : 64)
26423                    }
26424                    f();
26425                    var p = u();
26426                    if (0 === p) u();
26427                    else if (1 === p)
26428                        for (d(1), c(), c(), t = u(), r = 0; r < t; r++) c();
26429                    f(), d(1);
26430                    var y = u(),
26431                        E = u(),
26432                        T = l(1);
26433                    0 === T && d(1), d(1), h() && (i = u(), n = u(), a = u(), s = u());
26434                    var S = [1, 1];
26435                    if (h() && h()) switch (o()) {
26436                    case 1:
26437                        S = [1, 1];
26438                        break;
26439                    case 2:
26440                        S = [12, 11];
26441                        break;
26442                    case 3:
26443                        S = [10, 11];
26444                        break;
26445                    case 4:
26446                        S = [16, 11];
26447                        break;
26448                    case 5:
26449                        S = [40, 33];
26450                        break;
26451                    case 6:
26452                        S = [24, 11];
26453                        break;
26454                    case 7:
26455                        S = [20, 11];
26456                        break;
26457                    case 8:
26458                        S = [32, 11];
26459                        break;
26460                    case 9:
26461                        S = [80, 33];
26462                        break;
26463                    case 10:
26464                        S = [18, 11];
26465                        break;
26466                    case 11:
26467                        S = [15, 11];
26468                        break;
26469                    case 12:
26470                        S = [64, 33];
26471                        break;
26472                    case 13:
26473                        S = [160, 99];
26474                        break;
26475                    case 14:
26476                        S = [4, 3];
26477                        break;
26478                    case 15:
26479                        S = [3, 2];
26480                        break;
26481                    case 16:
26482                        S = [2, 1];
26483                        break;
26484                    case 255:
26485                        S = [o() << 8 | o(), o() << 8 | o()]
26486                    }
26487                    return {
26488                        width: Math.ceil(16 * (y + 1) - 2 * i - 2 * n),
26489                        height: (2 - T) * (E + 1) * 16 - (T ? 2 : 4) * (a + s),
26490                        pixelRatio: S
26491                    }
26492                }, e.readSliceType = function () {
26493                    return this.readUByte(), this.readUEG(), this.readUEG()
26494                }, t
26495            }(),
26496            nn = function (t) {
26497                function e() {
26498                    return t.apply(this, arguments) || this
26499                }
26500                l(e, t);
26501                var r = e.prototype;
vendor: 13,281 bytes, lines 26502-26722
26502                return r.parseAVCPES = function (t, e, r, i, n) {
26503                    var a, s = this,
26504                        o = this.parseAVCNALu(t, r.data),
26505                        l = this.VideoSample,
26506                        u = !1;
26507                    r.data = null, l && o.length && !t.audFound && (this.pushAccessUnit(l, t), l = this.VideoSample = this.createVideoSample(!1, r.pts, r.dts, "")), o.forEach((function (i) {
26508                        var o;
26509                        switch (i.type) {
26510                        case 1:
26511                            var h = !1;
26512                            a = !0;
26513                            var d, c = i.data;
26514                            if (u && c.length > 4) {
26515                                var f = new rn(c).readSliceType();
26516                                2 !== f && 4 !== f && 7 !== f && 9 !== f || (h = !0)
26517                            }
26518                            h && null != (d = l) && d.frame && !l.key && (s.pushAccessUnit(l, t), l = s.VideoSample = null), l || (l = s.VideoSample = s.createVideoSample(!0, r.pts, r.dts, "")), l.frame = !0, l.key = h;
26519                            break;
26520                        case 5:
26521                            a = !0, null != (o = l) && o.frame && !l.key && (s.pushAccessUnit(l, t), l = s.VideoSample = null), l || (l = s.VideoSample = s.createVideoSample(!0, r.pts, r.dts, "")), l.key = !0, l.frame = !0;
26522                            break;
26523                        case 6:
26524                            a = !0, Yt(i.data, 1, r.pts, e.samples);
26525                            break;
26526                        case 7:
26527                            var g, v;
26528                            a = !0, u = !0;
26529                            var m = i.data,
26530                                p = new rn(m).readSPS();
26531                            if (!t.sps || t.width !== p.width || t.height !== p.height || (null == (g = t.pixelRatio) ? void 0 : g[0]) !== p.pixelRatio[0] || (null == (v = t.pixelRatio) ? void 0 : v[1]) !== p.pixelRatio[1]) {
26532                                t.width = p.width, t.height = p.height, t.pixelRatio = p.pixelRatio, t.sps = [m], t.duration = n;
26533                                for (var y = m.subarray(1, 4), E = "avc1.", T = 0; T < 3; T++) {
26534                                    var S = y[T].toString(16);
26535                                    S.length < 2 && (S = "0" + S), E += S
26536                                }
26537                                t.codec = E
26538                            }
26539                            break;
26540                        case 8:
26541                            a = !0, t.pps = [i.data];
26542                            break;
26543                        case 9:
26544                            a = !0, t.audFound = !0, l && s.pushAccessUnit(l, t), l = s.VideoSample = s.createVideoSample(!1, r.pts, r.dts, "");
26545                            break;
26546                        case 12:
26547                            a = !0;
26548                            break;
26549                        default:
26550                            a = !1, l && (l.debug += "unknown NAL " + i.type + " ")
26551                        }
26552                        l && a && l.units.push(i)
26553                    })), i && l && (this.pushAccessUnit(l, t), this.VideoSample = null)
26554                }, r.parseAVCNALu = function (t, e) {
26555                    var r, i, n = e.byteLength,
26556                        a = t.naluState || 0,
26557                        s = a,
26558                        o = [],
26559                        l = 0,
26560                        u = -1,
26561                        h = 0;
26562                    for (-1 === a && (u = 0, h = 31 & e[0], a = 0, l = 1); l < n;)
26563                        if (r = e[l++], a)
26564                            if (1 !== a)
26565                                if (r)
26566                                    if (1 === r) {
26567                                        if (i = l - a - 1, u >= 0) {
26568                                            var d = {
26569                                                data: e.subarray(u, i),
26570                                                type: h
26571                                            };
26572                                            o.push(d)
26573                                        } else {
26574                                            var c = this.getLastNalUnit(t.samples);
26575                                            c && (s && l <= 4 - s && c.state && (c.data = c.data.subarray(0, c.data.byteLength - s)), i > 0 && (c.data = Kt(c.data, e.subarray(0, i)), c.state = 0))
26576                                        }
26577                                        l < n ? (u = l, h = 31 & e[l], a = 0) : a = -1
26578                                    } else a = 0;
26579                    else a = 3;
26580                    else a = r ? 0 : 2;
26581                    else a = r ? 0 : 1;
26582                    if (u >= 0 && a >= 0) {
26583                        var f = {
26584                            data: e.subarray(u, n),
26585                            type: h,
26586                            state: a
26587                        };
26588                        o.push(f)
26589                    }
26590                    if (0 === o.length) {
26591                        var g = this.getLastNalUnit(t.samples);
26592                        g && (g.data = Kt(g.data, e))
26593                    }
26594                    return t.naluState = a, o
26595                }, e
26596            }(en),
26597            an = function () {
26598                function t(t, e, r) {
26599                    this.keyData = void 0, this.decrypter = void 0, this.keyData = r, this.decrypter = new ci(e, {
26600                        removePKCS7Padding: !1
26601                    })
26602                }
26603                var e = t.prototype;
26604                return e.decryptBuffer = function (t) {
26605                    return this.decrypter.decrypt(t, this.keyData.key.buffer, this.keyData.iv.buffer)
26606                }, e.decryptAacSample = function (t, e, r) {
26607                    var i = this,
26608                        n = t[e].unit;
26609                    if (!(n.length <= 16)) {
26610                        var a = n.subarray(16, n.length - n.length % 16),
26611                            s = a.buffer.slice(a.byteOffset, a.byteOffset + a.length);
26612                        this.decryptBuffer(s).then((function (a) {
26613                            var s = new Uint8Array(a);
26614                            n.set(s, 16), i.decrypter.isSync() || i.decryptAacSamples(t, e + 1, r)
26615                        }))
26616                    }
26617                }, e.decryptAacSamples = function (t, e, r) {
26618                    for (;; e++) {
26619                        if (e >= t.length) return void r();
26620                        if (!(t[e].unit.length < 32 || (this.decryptAacSample(t, e, r), this.decrypter.isSync()))) return
26621                    }
26622                }, e.getAvcEncryptedData = function (t) {
26623                    for (var e = 16 * Math.floor((t.length - 48) / 160) + 16, r = new Int8Array(e), i = 0, n = 32; n < t.length - 16; n += 160, i += 16) r.set(t.subarray(n, n + 16), i);
26624                    return r
26625                }, e.getAvcDecryptedUnit = function (t, e) {
26626                    for (var r = new Uint8Array(e), i = 0, n = 32; n < t.length - 16; n += 160, i += 16) t.set(r.subarray(i, i + 16), n);
26627                    return t
26628                }, e.decryptAvcSample = function (t, e, r, i, n) {
26629                    var a = this,
26630                        s = Wt(n.data),
26631                        o = this.getAvcEncryptedData(s);
26632                    this.decryptBuffer(o.buffer).then((function (o) {
26633                        n.data = a.getAvcDecryptedUnit(s, o), a.decrypter.isSync() || a.decryptAvcSamples(t, e, r + 1, i)
26634                    }))
26635                }, e.decryptAvcSamples = function (t, e, r, i) {
26636                    if (t instanceof Uint8Array) throw new Error("Cannot decrypt samples of type Uint8Array");
26637                    for (;; e++, r = 0) {
26638                        if (e >= t.length) return void i();
26639                        for (var n = t[e].units; !(r >= n.length); r++) {
26640                            var a = n[r];
26641                            if (!(a.data.length <= 48 || 1 !== a.type && 5 !== a.type || (this.decryptAvcSample(t, e, r, i, a), this.decrypter.isSync()))) return
26642                        }
26643                    }
26644                }, t
26645            }(),
26646            sn = 188,
26647            on = function () {
26648                function t(t, e, r) {
26649                    this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.sampleAes = null, this.pmtParsed = !1, this.audioCodec = void 0, this.videoCodec = void 0, this._duration = 0, this._pmtId = -1, this._videoTrack = void 0, this._audioTrack = void 0, this._id3Track = void 0, this._txtTrack = void 0, this.aacOverFlow = null, this.remainderData = null, this.videoParser = void 0, this.observer = t, this.config = e, this.typeSupported = r, this.videoParser = new nn
26650                }
26651                t.probe = function (e) {
26652                    var r = t.syncOffset(e);
26653                    return r > 0 && w.warn("MPEG2-TS detected but first sync word found @ offset " + r), -1 !== r
26654                }, t.syncOffset = function (t) {
26655                    for (var e = t.length, r = Math.min(940, e - sn) + 1, i = 0; i < r;) {
26656                        for (var n = !1, a = -1, s = 0, o = i; o < e; o += sn) {
26657                            if (71 !== t[o] || e - o !== sn && 71 !== t[o + sn]) {
26658                                if (s) return -1;
26659                                break
26660                            }
26661                            if (s++, -1 === a && 0 !== (a = o) && (r = Math.min(a + 18612, t.length - sn) + 1), n || (n = 0 === ln(t, o)), n && s > 1 && (0 === a && s > 2 || o + sn > r)) return a
26662                        }
26663                        i++
26664                    }
26665                    return -1
26666                }, t.createTrack = function (t, e) {
26667                    return {
26668                        container: "video" === t || "audio" === t ? "video/mp2t" : void 0,
26669                        type: t,
26670                        id: kt[t],
26671                        pid: -1,
26672                        inputTimeScale: 9e4,
26673                        sequenceNumber: 0,
26674                        samples: [],
26675                        dropped: 0,
26676                        duration: "audio" === t ? e : void 0
26677                    }
26678                };
26679                var e = t.prototype;
26680                return e.resetInitSegment = function (e, r, i, n) {
26681                    this.pmtParsed = !1, this._pmtId = -1, this._videoTrack = t.createTrack("video"), this._audioTrack = t.createTrack("audio", n), this._id3Track = t.createTrack("id3"), this._txtTrack = t.createTrack("text"), this._audioTrack.segmentCodec = "aac", this.aacOverFlow = null, this.remainderData = null, this.audioCodec = r, this.videoCodec = i, this._duration = n
26682                }, e.resetTimeStamp = function () {}, e.resetContiguity = function () {
26683                    var t = this._audioTrack,
26684                        e = this._videoTrack,
26685                        r = this._id3Track;
26686                    t && (t.pesData = null), e && (e.pesData = null), r && (r.pesData = null), this.aacOverFlow = null, this.remainderData = null
26687                }, e.demux = function (e, r, i, n) {
26688                    var a;
26689                    void 0 === i && (i = !1), void 0 === n && (n = !1), i || (this.sampleAes = null);
26690                    var s = this._videoTrack,
26691                        o = this._audioTrack,
26692                        l = this._id3Track,
26693                        u = this._txtTrack,
26694                        h = s.pid,
26695                        d = s.pesData,
26696                        c = o.pid,
26697                        f = l.pid,
26698                        g = o.pesData,
26699                        v = l.pesData,
26700                        m = null,
26701                        p = this.pmtParsed,
26702                        y = this._pmtId,
26703                        E = e.length;
26704                    if (this.remainderData && (E = (e = Kt(this.remainderData, e)).length, this.remainderData = null), E < sn && !n) return this.remainderData = e, {
26705                        audioTrack: o,
26706                        videoTrack: s,
26707                        id3Track: l,
26708                        textTrack: u
26709                    };
26710                    var T = Math.max(0, t.syncOffset(e));
26711                    (E -= (E - T) % sn) < e.byteLength && !n && (this.remainderData = new Uint8Array(e.buffer, E, e.buffer.byteLength - E));
26712                    for (var R = 0, k = T; k < E; k += sn)
26713                        if (71 === e[k]) {
26714                            var b = !!(64 & e[k + 1]),
26715                                D = ln(e, k),
26716                                I = void 0;
26717                            if ((48 & e[k + 3]) >> 4 > 1) {
26718                                if ((I = k + 5 + e[k + 4]) === k + sn) continue
26719                            } else I = k + 4;
26720                            switch (D) {
26721                            case h:
26722                                b && (d && (a = cn(d)) && this.videoParser.parseA
26722VCPES(s, u, a, !1, this._duration), d = {
26723                                    data: [],
26724                                    size: 0
26725                                }), d && (d.data.push(e.subarray(I, k + sn)), d.size += k + sn - I);
26726                                break;
26727                            case c:
26728                                if (b) {
26729                                    if (g && (a = cn(g))) switch (o.segmentCodec) {
26730                                    case "aac":
26731                                        this.parseAACPES(o, a);
26732                                        break;
26733                                    case "mp3":
26734                                        this.parseMPEGPES(o, a);
26735                                        break;
26736                                    case "ac3":
26737                                        this.parseAC3PES(o, a)
26738                                    }
26739                                    g = {
26740                                        data: [],
26741                                        size: 0
26742                                    }
26743                                }
26744                                g && (g.data.push(e.subarray(I, k + sn)), g.size += k + sn - I);
26745                                break;
26746                            case f:
26747                                b && (v && (a = cn(v)) && this.parseID3PES(l, a), v = {
26748                                    data: [],
26749                                    size: 0
26750                                }), v && (v.data.push(e.subarray(I, k + sn)), v.size += k + sn - I);
26751                                break;
26752                            case 0:
26753                                b && (I += e[I] + 1), y = this._pmtId = un(e, I);
26754                                break;
26755                            case y:
26756                                b && (I += e[I] + 1);
26757                                var C = hn(e, I, this.typeSupported, i);
26758                                (h = C.videoPid) > 0 && (s.pid = h, s.segmentCodec = C.segmentVideoCodec), (c = C.audioPid) > 0 && (o.pid = c, o.segmentCodec = C.segmentAudioCodec), (f = C.id3Pid) > 0 && (l.pid = f), null === m || p || (w.warn("MPEG-TS PMT found at " + k + " after unknown PID '" + m + "'. Backtracking to sync byte @" + T + " to parse all TS packets."), m = null, k = T - 188), p = this.pmtParsed = !0;
26759                                break;
26760                            case 17:
26761                            case 8191:
26762                                break;
26763                            default:
26764                                m = D
26765                            }
26766                        } else R++;
26767                    if (R > 0) {
26768                        var _ = new Error("Found " + R + " TS packet/s that do not start with 0x47");
26769                        this.observer.emit(S.ERROR, S.ERROR, {
26770                            type: L.MEDIA_ERROR,
26771                            details: A.FRAG_PARSING_ERROR,
26772                            fatal: !1,
26773                            error: _,
26774                            reason: _.message
26775                        })
26776                    }
26777                    s.pesData = d, o.pesData = g, l.pesData = v;
26778                    var x = {
26779                        audioTrack: o,
26780                        videoTrack: s,
26781                        id3Track: l,
26782                        textTrack: u
26783                    };
26784                    return n && this.extractRemainingSamples(x), x
26785                }, e.flush = function () {
26786                    var t, e = this.remainderData;
26787                    return this.remainderData = null, t = e ? this.demux(e, -1, !1, !0) : {
26788                        videoTrack: this._videoTrack,
26789                        audioTrack: this._audioTrack,
26790                        id3Track: this._id3Track,
26791                        textTrack: this._txtTrack
26792                    }, this.extractRemainingSamples(t), this.sampleAes ? this.decrypt(t, this.sampleAes) : t
26793                }, e.extractRemainingSamples = function (t) {
26794                    var e, r = t.audioTrack,
26795                        i = t.videoTrack,
26796                        n = t.id3Track,
26797                        a = t.textTrack,
26798                        s = i.pesData,
26799                        o = r.pesData,
26800                        l = n.pesData;
26801                    if (s && (e = cn(s)) ? (this.videoParser.parseA
vendor: 14,764 bytes, lines 26801-27088
26801VCPES(i, a, e, !0, this._duration), i.pesData = null) : i.pesData = s, o && (e = cn(o))) {
26802                        switch (r.segmentCodec) {
26803                        case "aac":
26804                            this.parseAACPES(r, e);
26805                            break;
26806                        case "mp3":
26807                            this.parseMPEGPES(r, e);
26808                            break;
26809                        case "ac3":
26810                            this.parseAC3PES(r, e)
26811                        }
26812                        r.pesData = null
26813                    } else null != o && o.size && w.log("last AAC PES packet truncated,might overlap between fragments"), r.pesData = o;
26814                    l && (e = cn(l)) ? (this.parseID3PES(n, e), n.pesData = null) : n.pesData = l
26815                }, e.demuxSampleAes = function (t, e, r) {
26816                    var i = this.demux(t, r, !0, !this.config.progressive),
26817                        n = this.sampleAes = new an(this.observer, this.config, e);
26818                    return this.decrypt(i, n)
26819                }, e.decrypt = function (t, e) {
26820                    return new Promise((function (r) {
26821                        var i = t.audioTrack,
26822                            n = t.videoTrack;
26823                        i.samples && "aac" === i.segmentCodec ? e.decryptAacSamples(i.samples, 0, (function () {
26824                            n.samples ? e.decryptAvcSamples(n.samples, 0, 0, (function () {
26825                                r(t)
26826                            })) : r(t)
26827                        })) : n.samples && e.decryptAvcSamples(n.samples, 0, 0, (function () {
26828                            r(t)
26829                        }))
26830                    }))
26831                }, e.destroy = function () {
26832                    this._duration = 0
26833                }, e.parseAACPES = function (t, e) {
26834                    var r, i, n, a = 0,
26835                        s = this.aacOverFlow,
26836                        o = e.data;
26837                    if (s) {
26838                        this.aacOverFlow = null;
26839                        var l = s.missing,
26840                            u = s.sample.unit.byteLength;
26841                        if (-1 === l) o = Kt(s.sample.unit, o);
26842                        else {
26843                            var h = u - l;
26844                            s.sample.unit.set(o.subarray(0, l), h), t.samples.push(s.sample), a = s.missing
26845                        }
26846                    }
26847                    for (r = a, i = o.length; r < i - 1 && !Fi(o, r); r++);
26848                    if (r !== a) {
26849                        var d, c = r < i - 1;
26850                        d = c ? "AAC PES did not start with ADTS header,offset:" + r : "No ADTS header found in AAC PES";
26851                        var f = new Error(d);
26852                        if (w.warn("parsing error: " + d), this.observer.emit(S.ERROR, S.ERROR, {
26853                                type: L.MEDIA_ERROR,
26854                                details: A.FRAG_PARSING_ERROR,
26855                                fatal: !1,
26856                                levelRetry: c,
26857                                error: f,
26858                                reason: d
26859                            }), !c) return
26860                    }
26861                    if (Oi(t, this.observer, o, r, this.audioCodec), void 0 !== e.pts) n = e.pts;
26862                    else {
26863                        if (!s) return void w.warn("[tsdemuxer]: AAC PES unknown PTS");
26864                        var g = Ni(t.samplerate);
26865                        n = s.sample.pts + g
26866                    }
26867                    for (var v, m = 0; r < i;) {
26868                        if (r += (v = Ui(t, o, r, n, m)).length, v.missing) {
26869                            this.aacOverFlow = v;
26870                            break
26871                        }
26872                        for (m++; r < i - 1 && !Fi(o, r); r++);
26873                    }
26874                }, e.parseMPEGPES = function (t, e) {
26875                    var r = e.data,
26876                        i = r.length,
26877                        n = 0,
26878                        a = 0,
26879                        s = e.pts;
26880                    if (void 0 !== s)
26881                        for (; a < i;)
26882                            if (qi(r, a)) {
26883                                var o = Yi(t, r, a, s, n);
26884                                if (!o) break;
26885                                a += o.length, n++
26886                            } else a++;
26887                    else w.warn("[tsdemuxer]: MPEG PES unknown PTS")
26888                }, e.parseAC3PES = function (t, e) {
26889                    var r = e.data,
26890                        i = e.pts;
26891                    if (void 0 !== i)
26892                        for (var n, a = r.length, s = 0, o = 0; o < a && (n = tn(t, r, o, i, s++)) > 0;) o += n;
26893                    else w.warn("[tsdemuxer]: AC3 PES unknown PTS")
26894                }, e.parseID3PES = function (t, e) {
26895                    if (void 0 !== e.pts) {
26896                        var r = o({}, e, {
26897                            type: this._videoTrack ? He : Ge,
26898                            duration: Number.POSITIVE_INFINITY
26899                        });
26900                        t.samples.push(r)
26901                    } else w.warn("[tsdemuxer]: ID3 PES unknown PTS")
26902                }, t
26903            }();
26904
26905        function ln(t, e) {
26906            return ((31 & t[e + 1]) << 8) + t[e + 2]
26907        }
26908
26909        function un(t, e) {
26910            return (31 & t[e + 10]) << 8 | t[e + 11]
26911        }
26912
26913        function hn(t, e, r, i) {
26914            var n = {
26915                    audioPid: -1,
26916                    videoPid: -1,
26917                    id3Pid: -1,
26918                    segmentVideoCodec: "avc",
26919                    segmentAudioCodec: "aac"
26920                },
26921                a = e + 3 + ((15 & t[e + 1]) << 8 | t[e + 2]) - 4;
26922            for (e += 12 + ((15 & t[e + 10]) << 8 | t[e + 11]); e < a;) {
26923                var s = ln(t, e),
26924                    o = (15 & t[e + 3]) << 8 | t[e + 4];
26925                switch (t[e]) {
26926                case 207:
26927                    if (!i) {
26928                        dn("ADTS AAC");
26929                        break
26930                    }
26931                    case 15:
26932                        -1 === n.audioPid && (n.audioPid = s);
26933                        break;
26934                    case 21:
26935                        -1 === n.id3Pid && (n.id3Pid = s);
26936                        break;
26937                    case 219:
26938                        if (!i) {
26939                            dn("H.264");
26940                            break
26941                        }
26942                        case 27:
26943                            -1 === n.videoPid && (n.videoPid = s, n.segmentVideoCodec = "avc");
26944                            break;
26945                        case 3:
26946                        case 4:
26947                            r.mpeg || r.mp3 ? -1 === n.audioPid && (n.audioPid = s, n.segmentAudioCodec = "mp3") : w.log("MPEG audio found, not supported in this browser");
26948                            break;
26949                        case 193:
26950                            if (!i) {
26951                                dn("AC-3");
26952                                break
26953                            }
26954                            case 129:
26955                                r.ac3 ? -1 === n.audioPid && (n.audioPid = s, n.segmentAudioCodec = "ac3") : w.log("AC-3 audio found, not supported in this browser");
26956                                break;
26957                            case 6:
26958                                if (-1 === n.audioPid && o > 0)
26959                                    for (var l = e + 5, u = o; u > 2;) {
26960                                        106 === t[l] && (!0 !== r.ac3 ? w.log("AC-3 audio found, not supported in this browser for now") : (n.audioPid = s, n.segmentAudioCodec = "ac3"));
26961                                        var h = t[l + 1] + 2;
26962                                        l += h, u -= h
26963                                    }
26964                                break;
26965                            case 194:
26966                            case 135:
26967                                throw new Error("Unsupported EC-3 in M2TS found");
26968                            case 36:
26969                                throw new Error("Unsupported HEVC in M2TS found")
26970                }
26971                e += o + 5
26972            }
26973            return n
26974        }
26975
26976        function dn(t) {
26977            w.log(t + " with AES-128-CBC encryption found in unencrypted stream")
26978        }
26979
26980        function cn(t) {
26981            var e, r, i, n, a, s = 0,
26982                o = t.data;
26983            if (!t || 0 === t.size) return null;
26984            for (; o[0].length < 19 && o.length > 1;) o[0] = Kt(o[0], o[1]), o.splice(1, 1);
26985            if (1 === ((e = o[0])[0] << 16) + (e[1] << 8) + e[2]) {
26986                if ((r = (e[4] << 8) + e[5]) && r > t.size - 6) return null;
26987                var l = e[7];
26988                192 & l && (n = 536870912 * (14 & e[9]) + 4194304 * (255 & e[10]) + 16384 * (254 & e[11]) + 128 * (255 & e[12]) + (254 & e[13]) / 2, 64 & l ? n - (a = 536870912 * (14 & e[14]) + 4194304 * (255 & e[15]) + 16384 * (254 & e[16]) + 128 * (255 & e[17]) + (254 & e[18]) / 2) > 54e5 && (w.warn(Math.round((n - a) / 9e4) + "s delta between PTS and DTS, align them"), n = a) : a = n);
26989                var u = (i = e[8]) + 9;
26990                if (t.size <= u) return null;
26991                t.size -= u;
26992                for (var h = new Uint8Array(t.size), d = 0, c = o.length; d < c; d++) {
26993                    var f = (e = o[d]).byteLength;
26994                    if (u) {
26995                        if (u > f) {
26996                            u -= f;
26997                            continue
26998                        }
26999                        e = e.subarray(u), f -= u, u = 0
27000                    }
27001                    h.set(e, s), s += f
27002                }
27003                return r && (r -= i + 3), {
27004                    data: h,
27005                    pts: n,
27006                    dts: a,
27007                    len: r
27008                }
27009            }
27010            return null
27011        }
27012        var fn = function (t) {
27013                function e() {
27014                    return t.apply(this, arguments) || this
27015                }
27016                l(e, t);
27017                var r = e.prototype;
27018                return r.resetInitSegment = function (e, r, i, n) {
27019                    t.prototype.resetInitSegment.call(this, e, r, i, n), this._audioTrack = {
27020                        container: "audio/mpeg",
27021                        type: "audio",
27022                        id: 2,
27023                        pid: -1,
27024                        sequenceNumber: 0,
27025                        segmentCodec: "mp3",
27026                        samples: [],
27027                        manifestCodec: r,
27028                        duration: n,
27029                        inputTimeScale: 9e4,
27030                        dropped: 0
27031                    }
27032                }, e.probe = function (t) {
27033                    if (!t) return !1;
27034                    var e = lt(t, 0),
27035                        r = (null == e ? void 0 : e.length) || 0;
27036                    if (e && 11 === t[r] && 119 === t[r + 1] && void 0 !== dt(e) && $i(t, r) <= 16) return !1;
27037                    for (var i = t.length; r < i; r++)
27038                        if (Xi(t, r)) return w.log("MPEG Audio sync word found !"), !0;
27039                    return !1
27040                }, r.canParse = function (t, e) {
27041                    return function (t, e) {
27042                        return ji(t, e) && 4 <= t.length - e
27043                    }(t, e)
27044                }, r.appendFrame = function (t, e, r) {
27045                    if (null !== this.basePTS) return Yi(t, e, r, this.basePTS, this.frameIndex)
27046                }, e
27047            }(wi),
27048            gn = function () {
27049                function t() {}
27050                return t.getSilentFrame = function (t, e) {
27051                    if ("mp4a.40.2" === t) {
27052                        if (1 === e) return new Uint8Array([0, 200, 0, 128, 35, 128]);
27053                        if (2 === e) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
27054                        if (3 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
27055                        if (4 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
27056                        if (5 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
27057                        if (6 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224])
27058                    } else {
27059                        if (1 === e) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
27060                        if (2 === e) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
27061                        if (3 === e) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94])
27062                    }
27063                }, t
27064            }(),
27065            vn = Math.pow(2, 32) - 1,
27066            mn = function () {
27067                function t() {}
27068                return t.init = function () {
27069                    var e;
27070                    for (e in t.types = {
27071                            avc1: [],
27072                            avcC: [],
27073                            btrt: [],
27074                            dinf: [],
27075                            dref: [],
27076                            esds: [],
27077                            ftyp: [],
27078                            hdlr: [],
27079                            mdat: [],
27080                            mdhd: [],
27081                            mdia: [],
27082                            mfhd: [],
27083                            minf: [],
27084                            moof: [],
27085                            moov: [],
27086                            mp4a: [],
27087                            ".mp3": [],
27088                            dac3: [],
27089                            "ac-3": [],
27090                            mvex: [],
27091                            mvhd: [],
27092                            pasp: [],
27093                            sdtp: [],
27094                            stbl: [],
27095                            stco: [],
27096                            stsc: [],
27097                            stsd: [],
27098                            stsz: [],
27099                            stts: [],
27100                            tfdt: [],
27101                            tfhd: [],
27102                            traf: [],
27103                            trak: [],
27104                            trun: [],
27105                            trex: [],
27106                            tkhd: [],
27107                            vmhd: [],
27108                            smhd: []
27109                        }, t.types) t.types.hasOwnProperty(e) && (t.types[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e.charCodeAt(3)]);
27110                    var r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]),
27111                        i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]);
27112                    t.HDLR_TYPES = {
27113                        video: r,
vendor: 9,743 bytes, lines 27114-27214
27114                        audio: i
27115                    };
27116                    var n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]),
27117                        a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);
27118                    t.STTS = t.STSC = t.STCO = a, t.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), t.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), t.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), t.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]);
27119                    var s = new Uint8Array([105, 115, 111, 109]),
27120                        o = new Uint8Array([97, 118, 99, 49]),
27121                        l = new Uint8Array([0, 0, 0, 1]);
27122                    t.FTYP = t.box(t.types.ftyp, s, l, s, o), t.DINF = t.box(t.types.dinf, t.box(t.types.dref, n))
27123                }, t.box = function (t) {
27124                    for (var e = 8, r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++) i[n - 1] = arguments[n];
27125                    for (var a = i.length, s = a; a--;) e += i[a].byteLength;
27126                    var o = new Uint8Array(e);
27127                    for (o[0] = e >> 24 & 255, o[1] = e >> 16 & 255, o[2] = e >> 8 & 255, o[3] = 255 & e, o.set(t, 4), a = 0, e = 8; a < s; a++) o.set(i[a], e), e += i[a].byteLength;
27128                    return o
27129                }, t.hdlr = function (e) {
27130                    return t.box(t.types.hdlr, t.HDLR_TYPES[e])
27131                }, t.mdat = function (e) {
27132                    return t.box(t.types.mdat, e)
27133                }, t.mdhd = function (e, r) {
27134                    r *= e;
27135                    var i = Math.floor(r / (vn + 1)),
27136                        n = Math.floor(r % (vn + 1));
27137                    return t.box(t.types.mdhd, new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e, i >> 24, i >> 16 & 255, i >> 8 & 255, 255 & i, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n, 85, 196, 0, 0]))
27138                }, t.mdia = function (e) {
27139                    return t.box(t.types.mdia, t.mdhd(e.timescale, e.duration), t.hdlr(e.type), t.minf(e))
27140                }, t.mfhd = function (e) {
27141                    return t.box(t.types.mfhd, new Uint8Array([0, 0, 0, 0, e >> 24, e >> 16 & 255, e >> 8 & 255, 255 & e]))
27142                }, t.minf = function (e) {
27143                    return "audio" === e.type ? t.box(t.types.minf, t.box(t.types.smhd, t.SMHD), t.DINF, t.stbl(e)) : t.box(t.types.minf, t.box(t.types.vmhd, t.VMHD), t.DINF, t.stbl(e))
27144                }, t.moof = function (e, r, i) {
27145                    return t.box(t.types.moof, t.mfhd(e), t.traf(i, r))
27146                }, t.moov = function (e) {
27147                    for (var r = e.length, i = []; r--;) i[r] = t.trak(e[r]);
27148                    return t.box.apply(null, [t.types.moov, t.mvhd(e[0].timescale, e[0].duration)].concat(i).concat(t.mvex(e)))
27149                }, t.mvex = function (e) {
27150                    for (var r = e.length, i = []; r--;) i[r] = t.trex(e[r]);
27151                    return t.box.apply(null, [t.types.mvex].concat(i))
27152                }, t.mvhd = function (e, r) {
27153                    r *= e;
27154                    var i = Math.floor(r / (vn + 1)),
27155                        n = Math.floor(r % (vn + 1)),
27156                        a = new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e, i >> 24, i >> 16 & 255, i >> 8 & 255, 255 & i, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]);
27157                    return t.box(t.types.mvhd, a)
27158                }, t.sdtp = function (e) {
27159                    var r, i, n = e.samples || [],
27160                        a = new Uint8Array(4 + n.length);
27161                    for (r = 0; r < n.length; r++) i = n[r].flags, a[r + 4] = i.dependsOn << 4 | i.isDependedOn << 2 | i.hasRedundancy;
27162                    return t.box(t.types.sdtp, a)
27163                }, t.stbl = function (e) {
27164                    return t.box(t.types.stbl, t.stsd(e), t.box(t.types.stts, t.STTS), t.box(t.types.stsc, t.STSC), t.box(t.types.stsz, t.STSZ), t.box(t.types.stco, t.STCO))
27165                }, t.avc1 = function (e) {
27166                    var r, i, n, a = [],
27167                        s = [];
27168                    for (r = 0; r < e.sps.length; r++) n = (i = e.sps[r]).byteLength, a.push(n >>> 8 & 255), a.push(255 & n), a = a.concat(Array.prototype.slice.call(i));
27169                    for (r = 0; r < e.pps.length; r++) n = (i = e.pps[r]).byteLength, s.push(n >>> 8 & 255), s.push(255 & n), s = s.concat(Array.prototype.slice.call(i));
27170                    var o = t.box(t.types.avcC, new Uint8Array([1, a[3], a[4], a[5], 255, 224 | e.sps.length].concat(a).concat([e.pps.length]).concat(s))),
27171                        l = e.width,
27172                        u = e.height,
27173                        h = e.pixelRatio[0],
27174                        d = e.pixelRatio[1];
27175                    return t.box(t.types.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, l >> 8 & 255, 255 & l, u >> 8 & 255, 255 & u, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 18, 100, 97, 105, 108, 121, 109, 111, 116, 105, 111, 110, 47, 104, 108, 115, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17]), o, t.box(t.types.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192])), t.box(t.types.pasp, new Uint8Array([h >> 24, h >> 16 & 255, h >> 8 & 255, 255 & h, d >> 24, d >> 16 & 255, d >> 8 & 255, 255 & d])))
27176                }, t.esds = function (t) {
27177                    var e = t.config.length;
27178                    return new Uint8Array([0, 0, 0, 0, 3, 23 + e, 0, 1, 0, 4, 15 + e, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5].concat([e]).concat(t.config).concat([6, 1, 2]))
27179                }, t.audioStsd = function (t) {
27180                    var e = t.samplerate;
27181                    return new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t.channelCount, 0, 16, 0, 0, 0, 0, e >> 8 & 255, 255 & e, 0, 0])
27182                }, t.mp4a = function (e) {
27183                    return t.box(t.types.mp4a, t.audioStsd(e), t.box(t.types.esds, t.esds(e)))
27184                }, t.mp3 = function (e) {
27185                    return t.box(t.types[".mp3"], t.audioStsd(e))
27186                }, t.ac3 = function (e) {
27187                    return t.box(t.types["ac-3"], t.audioStsd(e), t.box(t.types.dac3, e.config))
27188                }, t.stsd = function (e) {
27189                    return "audio" === e.type ? "mp3" === e.segmentCodec && "mp3" === e.codec ? t.box(t.types.stsd, t.STSD, t.mp3(e)) : "ac3" === e.segmentCodec ? t.box(t.types.stsd, t.STSD, t.ac3(e)) : t.box(t.types.stsd, t.STSD, t.mp4a(e)) : t.box(t.types.stsd, t.STSD, t.avc1(e))
27190                }, t.tkhd = function (e) {
27191                    var r = e.id,
27192                        i = e.duration * e.timescale,
27193                        n = e.width,
27194                        a = e.height,
27195                        s = Math.floor(i / (vn + 1)),
27196                        o = Math.floor(i % (vn + 1));
27197                    return t.box(t.types.tkhd, new Uint8Array([1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, 0, 0, 0, 0, s >> 24, s >> 16 & 255, s >> 8 & 255, 255 & s, o >> 24, o >> 16 & 255, o >> 8 & 255, 255 & o, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, n >> 8 & 255, 255 & n, 0, 0, a >> 8 & 255, 255 & a, 0, 0]))
27198                }, t.traf = function (e, r) {
27199                    var i = t.sdtp(e),
27200                        n = e.id,
27201                        a = Math.floor(r / (vn + 1)),
27202                        s = Math.floor(r % (vn + 1));
27203                    return t.box(t.types.traf, t.box(t.types.tfhd, new Uint8Array([0, 0, 0, 0, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n])), t.box(t.types.tfdt, new Uint8Array([1, 0, 0, 0, a >> 24, a >> 16 & 255, a >> 8 & 255, 255 & a, s >> 24, s >> 16 & 255, s >> 8 & 255, 255 & s])), t.trun(e, i.length + 16 + 20 + 8 + 16 + 8 + 8), i)
27204                }, t.trak = function (e) {
27205                    return e.duration = e.duration || 4294967295, t.box(t.types.trak, t.tkhd(e), t.mdia(e))
27206                }, t.trex = function (e) {
27207                    var r = e.id;
27208                    return t.box(t.types.trex, new Uint8Array([0, 0, 0, 0, r >> 24, r >> 16 & 255, r >> 8 & 255, 255 & r, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]))
27209                }, t.trun = function (e, r) {
27210                    var i, n, a, s, o, l, u = e.samples || [],
27211                        h = u.length,
27212                        d = 12 + 16 * h,
27213                        c = new Uint8Array(d);
27214                    for (r += 8 + d, c.set(["video" === e.type ? 1 : 0, 0, 15, 1, h >>> 24 & 255, h >>> 16 & 255, h >>> 8 & 255, 255 & h, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r], 0), i = 0; i < h; i++) a = (n = u[i]).duration, s = n.size, o = n.flags, l = n.cts, c.set([a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o.isLeading << 2 | o.dependsOn, o.isDependedOn << 6 | o.hasRedundancy << 4 | o.paddingValue << 1 | o.isNonSync, 61440 & o.degradPrio, 15 & o.degradPrio, l >>> 24 & 255, l >>> 16 & 255, l >>> 8 & 255, 255 & l], 12 + 16 * i);
vendor: 4,128 bytes, lines 27215-27282
27215                    return t.box(t.types.trun, c)
27216                }, t.initSegment = function (e) {
27217                    t.types || t.init();
27218                    var r = t.moov(e);
27219                    return Kt(t.FTYP, r)
27220                }, t
27221            }();
27222        mn.types = void 0, mn.HDLR_TYPES = void 0, mn.STTS = void 0, mn.STSC = void 0, mn.STCO = void 0, mn.STSZ = void 0, mn.VMHD = void 0, mn.SMHD = void 0, mn.STSD = void 0, mn.FTYP = void 0, mn.DINF = void 0;
27223        var pn = 9e4;
27224
27225        function yn(t, e, r, i) {
27226            void 0 === r && (r = 1), void 0 === i && (i = !1);
27227            var n = t * e * r;
27228            return i ? Math.round(n) : n
27229        }
27230
27231        function En(t, e) {
27232            return void 0 === e && (e = !1), yn(t, 1e3, 1 / pn, e)
27233        }
27234        var Tn = null,
27235            Sn = null,
27236            Ln = function () {
27237                function t(t, e, r, i) {
27238                    if (this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.ISGenerated = !1, this._initPTS = null, this._initDTS = null, this.nextAvcDts = null, this.nextAudioPts = null, this.videoSampleDuration = null, this.isAudioContiguous = !1, this.isVideoContiguous = !1, this.videoTrackConfig = void 0, this.observer = t, this.config = e, this.typeSupported = r, this.ISGenerated = !1, null === Tn) {
27239                        var n = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
27240                        Tn = n ? parseInt(n[1]) : 0
27241                    }
27242                    if (null === Sn) {
27243                        var a = navigator.userAgent.match(/Safari\/(\d+)/i);
27244                        Sn = a ? parseInt(a[1]) : 0
27245                    }
27246                }
27247                var e = t.prototype;
27248                return e.destroy = function () {
27249                    this.config = this.videoTrackConfig = this._initPTS = this._initDTS = null
27250                }, e.resetTimeStamp = function (t) {
27251                    w.log("[mp4-remuxer]: initPTS & initDTS reset"), this._initPTS = this._initDTS = t
27252                }, e.resetNextTimestamp = function () {
27253                    w.log("[mp4-remuxer]: reset next timestamp"), this.isVideoContiguous = !1, this.isAudioContiguous = !1
27254                }, e.resetInitSegment = function () {
27255                    w.log("[mp4-remuxer]: ISGenerated flag reset"), this.ISGenerated = !1, this.videoTrackConfig = void 0
27256                }, e.getVideoStartPts = function (t) {
27257                    var e = !1,
27258                        r = t.reduce((function (t, r) {
27259                            var i = r.pts - t;
27260                            return i < -4294967296 ? (e = !0, An(t, r.pts)) : i > 0 ? t : r.pts
27261                        }), t[0].pts);
27262                    return e && w.debug("PTS rollover detected"), r
27263                }, e.remux = function (t, e, r, i, n, a, s, o) {
27264                    var l, u, h, d, c, f, g = n,
27265                        v = n,
27266                        m = t.pid > -1,
27267                        p = e.pid > -1,
27268                        y = e.samples.length,
27269                        E = t.samples.length > 0,
27270                        T = s && y > 0 || y > 1;
27271                    if ((!m || E) && (!p || T) || this.ISGenerated || s) {
27272                        if (this.ISGenerated) {
27273                            var S, L, A, R, k = this.videoTrackConfig;
27274                            !k || e.width === k.width && e.height === k.height && (null == (S = e.pixelRatio) ? void 0 : S[0]) === (null == (L = k.pixelRatio) ? void 0 : L[0]) && (null == (A = e.pixelRatio) ? void 0 : A[1]) === (null == (R = k.pixelRatio) ? void 0 : R[1]) || this.resetInitSegment()
27275                        } else h = this.generateIS(t, e, n, a);
27276                        var b, D = this.isVideoContiguous,
27277                            I = -1;
27278                        if (T && (I = function (t) {
27279                                for (var e = 0; e < t.length; e++)
27280                                    if (t[e].key) return e;
27281                                return -1
27282                            }
vendor: 12,747 bytes, lines 27282-27498
27282(e.samples), !D && this.config.forceKeyFrameOnDiscontinuity))
27283                            if (f = !0, I > 0) {
27284                                w.warn("[mp4-remuxer]: Dropped " + I + " out of " + y + " video samples due to a missing keyframe");
27285                                var C = this.getVideoStartPts(e.samples);
27286                                e.samples = e.samples.slice(I), e.dropped += I, b = v += (e.samples[0].pts - C) / e.inputTimeScale
27287                            } else -1 === I && (w.warn("[mp4-remuxer]: No keyframe found out of " + y + " video samples"), f = !1);
27288                        if (this.ISGenerated) {
27289                            if (E && T) {
27290                                var _ = this.getVideoStartPts(e.samples),
27291                                    x = (An(t.samples[0].pts, _) - _) / e.inputTimeScale;
27292                                g += Math.max(0, x), v += Math.max(0, -x)
27293                            }
27294                            if (E) {
27295                                if (t.samplerate || (w.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"), h = this.generateIS(t, e, n, a)), u = this.remuxAudio(t, g, this.isAudioContiguous, a, p || T || o === Ce ? v : void 0), T) {
27296                                    var P = u ? u.endPTS - u.startPTS : 0;
27297                                    e.inputTimeScale || (w.warn("[mp4-remuxer]: regenerate InitSegment as video detected"), h = this.generateIS(t, e, n, a)), l = this.remuxVideo(e, v, D, P)
27298                                }
27299                            } else T && (l = this.remuxVideo(e, v, D, 0));
27300                            l && (l.firstKeyFrame = I, l.independent = -1 !== I, l.firstKeyFramePTS = b)
27301                        }
27302                    }
27303                    return this.ISGenerated && this._initPTS && this._initDTS && (r.samples.length && (c = Rn(r, n, this._initPTS, this._initDTS)), i.samples.length && (d = kn(i, n, this._initPTS))), {
27304                        audio: u,
27305                        video: l,
27306                        initSegment: h,
27307                        independent: f,
27308                        text: d,
27309                        id3: c
27310                    }
27311                }, e.generateIS = function (t, e, r, i) {
27312                    var n, a, s, o = t.samples,
27313                        l = e.samples,
27314                        u = this.typeSupported,
27315                        h = {},
27316                        d = this._initPTS,
27317                        c = !d || i,
27318                        f = "audio/mp4";
27319                    if (c && (n = a = 1 / 0), t.config && o.length) {
27320                        switch (t.timescale = t.samplerate, t.segmentCodec) {
27321                        case "mp3":
27322                            u.mpeg ? (f = "audio/mpeg", t.codec = "") : u.mp3 && (t.codec = "mp3");
27323                            break;
27324                        case "ac3":
27325                            t.codec = "ac-3"
27326                        }
27327                        h.audio = {
27328                            id: "audio",
27329                            container: f,
27330                            codec: t.codec,
27331                            initSegment: "mp3" === t.segmentCodec && u.mpeg ? new Uint8Array(0) : mn.initSegment([t]),
27332                            metadata: {
27333                                channelCount: t.channelCount
27334                            }
27335                        }, c && (s = t.inputTimeScale, d && s === d.timescale ? c = !1 : n = a = o[0].pts - Math.round(s * r))
27336                    }
27337                    if (e.sps && e.pps && l.length) {
27338                        if (e.timescale = e.inputTimeScale, h.video = {
27339                                id: "main",
27340                                container: "video/mp4",
27341                                codec: e.codec,
27342                                initSegment: mn.initSegment([e]),
27343                                metadata: {
27344                                    width: e.width,
27345                                    height: e.height
27346                                }
27347                            }, c)
27348                            if (s = e.inputTimeScale, d && s === d.timescale) c = !1;
27349                            else {
27350                                var g = this.getVideoStartPts(l),
27351                                    v = Math.round(s * r);
27352                                a = Math.min(a, An(l[0].dts, g) - v), n = Math.min(n, g - v)
27353                            } this.videoTrackConfig = {
27354                            width: e.width,
27355                            height: e.height,
27356                            pixelRatio: e.pixelRatio
27357                        }
27358                    }
27359                    if (Object.keys(h).length) return this.ISGenerated = !0, c ? (this._initPTS = {
27360                        baseTime: n,
27361                        timescale: s
27362                    }, this._initDTS = {
27363                        baseTime: a,
27364                        timescale: s
27365                    }) : n = s = void 0, {
27366                        tracks: h,
27367                        initPTS: n,
27368                        timescale: s
27369                    }
27370                }, e.remuxVideo = function (t, e, r, i) {
27371                    var n, a, s = t.inputTimeScale,
27372                        l = t.samples,
27373                        u = [],
27374                        h = l.length,
27375                        d = this._initPTS,
27376                        c = this.nextAvcDts,
27377                        f = 8,
27378                        g = this.videoSampleDuration,
27379                        v = Number.POSITIVE_INFINITY,
27380                        m = Number.NEGATIVE_INFINITY,
27381                        p = !1;
27382                    if (!r || null === c) {
27383                        var y = e * s,
27384                            E = l[0].pts - An(l[0].dts, l[0].pts);
27385                        Tn && null !== c && Math.abs(y - E - c) < 15e3 ? r = !0 : c = y - E
27386                    }
27387                    for (var T = d.baseTime * s / d.timescale, R = 0; R < h; R++) {
27388                        var k = l[R];
27389                        k.pts = An(k.pts - T, c), k.dts = An(k.dts - T, c), k.dts < l[R > 0 ? R - 1 : R].dts && (p = !0)
27390                    }
27391                    p && l.sort((function (t, e) {
27392                        var r = t.dts - e.dts,
27393                            i = t.pts - e.pts;
27394                        return r || i
27395                    })), n = l[0].dts;
27396                    var b = (a = l[l.length - 1].dts) - n,
27397                        D = b ? Math.round(b / (h - 1)) : g || t.inputTimeScale / 30;
27398                    if (r) {
27399                        var I = n - c,
27400                            C = I > D,
27401                            _ = I < -1;
27402                        if ((C || _) && (C ? w.warn("AVC: " + En(I, !0) + " ms (" + I + "dts) hole between fragments detected at " + e.toFixed(3)) : w.warn("AVC: " + En(-I, !0) + " ms (" + I + "dts) overlapping between fragments detected at " + e.toFixed(3)), !_ || c >= l[0].pts || Tn)) {
27403                            n = c;
27404                            var x = l[0].pts - I;
27405                            if (C) l[0].dts = n, l[0].pts = x;
27406                            else
27407                                for (var P = 0; P < l.length && !(l[P].dts > x); P++) l[P].dts -= I, l[P].pts -= I;
27408                            w.log("Video: Initial PTS/DTS adjusted: " + En(x, !0) + "/" + En(n, !0) + ", delta: " + En(I, !0) + " ms")
27409                        }
27410                    }
27411                    for (var F = 0, M = 0, O = n = Math.max(0, n), N = 0; N < h; N++) {
27412                        for (var U = l[N], B = U.units, G = B.length, K = 0, H = 0; H < G; H++) K += B[H].data.length;
27413                        M += K, F += G, U.length = K, U.dts < O ? (U.dts = O, O += D / 4 | 0 || 1) : O = U.dts, v = Math.min(U.pts, v), m = Math.max(U.pts, m)
27414                    }
27415                    a = l[h - 1].dts;
27416                    var V, Y = M + 4 * F + 8;
27417                    try {
27418                        V = new Uint8Array(Y)
27419                    } catch (t) {
27420                        return void this.observer.emit(S.ERROR, S.ERROR, {
27421                            type: L.MUX_ERROR,
27422                            details: A.REMUX_ALLOC_ERROR,
27423                            fatal: !1,
27424                            error: t,
27425                            bytes: Y,
27426                            reason: "fail allocating video mdat " + Y
27427                        })
27428                    }
27429                    var W = new DataView(V.buffer);
27430                    W.setUint32(0, Y), V.set(mn.types.mdat, 4);
27431                    for (var j = !1, q = Number.POSITIVE_INFINITY, X = Number.POSITIVE_INFINITY, z = Number.NEGATIVE_INFINITY, Q = Number.NEGATIVE_INFINITY, J = 0; J < h; J++) {
27432                        for (var $ = l[J], Z = $.units, tt = 0, et = 0, rt = Z.length; et < rt; et++) {
27433                            var it = Z[et],
27434                                nt = it.data,
27435                                at = it.data.byteLength;
27436                            W.setUint32(f, at), f += 4, V.set(nt, f), f += at, tt += 4 + at
27437                        }
27438                        var st = void 0;
27439                        if (J < h - 1) g = l[J + 1].dts - $.dts, st = l[J + 1].pts - $.pts;
27440                        else {
27441                            var ot = this.config,
27442                                lt = J > 0 ? $.dts - l[J - 1].dts : D;
27443                            if (st = J > 0 ? $.pts - l[J - 1].pts : D, ot.stretchShortVideoTrack && null !== this.nextAudioPts) {
27444                                var ut = Math.floor(ot.maxBufferHole * s),
27445                                    ht = (i ? v + i * s : this.nextAudioPts) - $.pts;
27446                                ht > ut ? ((g = ht - lt) < 0 ? g = lt : j = !0, w.log("[mp4-remuxer]: It is approximately " + ht / 90 + " ms to the next segment; using duration " + g / 90 + " ms for the last video frame.")) : g = lt
27447                            } else g = lt
27448                        }
27449                        var dt = Math.round($.pts - $.dts);
27450                        q = Math.min(q, g), z = Math.max(z, g), X = Math.min(X, st), Q = Math.max(Q, st), u.push(new Dn($.key, g, tt, dt))
27451                    }
27452                    if (u.length)
27453                        if (Tn) {
27454                            if (Tn < 70) {
27455                                var ct = u[0].flags;
27456                                ct.dependsOn = 2, ct.isNonSync = 0
27457                            }
27458                        } else if (Sn && Q - X < z - q && D / z < .025 && 0 === u[0].cts) {
27459                        w.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");
27460                        for (var ft = n, gt = 0, vt = u.length; gt < vt; gt++) {
27461                            var mt = ft + u[gt].duration,
27462                                pt = ft + u[gt].cts;
27463                            if (gt < vt - 1) {
27464                                var yt = mt + u[gt + 1].cts;
27465                                u[gt].duration = yt - pt
27466                            } else u[gt].duration = gt ? u[gt - 1].duration : D;
27467                            u[gt].cts = 0, ft = mt
27468                        }
27469                    }
27470                    g = j || !g ? D : g, this.nextAvcDts = c = a + g, this.videoSampleDuration = g, this.isVideoContiguous = !0;
27471                    var Et = {
27472                        data1: mn.moof(t.sequenceNumber++, n, o({}, t, {
27473                            samples: u
27474                        })),
27475                        data2: V,
27476                        startPTS: v / s,
27477                        endPTS: (m + g) / s,
27478                        startDTS: n / s,
27479                        endDTS: c / s,
27480                        type: "video",
27481                        hasAudio: !1,
27482                        hasVideo: !0,
27483                        nb: u.length,
27484                        dropped: t.dropped
27485                    };
27486                    return t.samples = [], t.dropped = 0, Et
27487                }, e.getSamplesPerFrame = function (t) {
27488                    switch (t.segmentCodec) {
27489                    case "mp3":
27490                        return 1152;
27491                    case "ac3":
27492                        return 1536;
27493                    default:
27494                        return 1024
27495                    }
27496                }, e.remuxAudio = function (t, e, r, i, n) {
27497                    var a = t.inputTimeScale,
27498                        s = a / (t.samplerate ? t.samplerate : a),
vendor: 9,305 bytes, lines 27499-27676
27499                        l = this.getSamplesPerFrame(t),
27500                        u = l * s,
27501                        h = this._initPTS,
27502                        d = "mp3" === t.segmentCodec && this.typeSupported.mpeg,
27503                        c = [],
27504                        f = void 0 !== n,
27505                        g = t.samples,
27506                        v = d ? 0 : 8,
27507                        m = this.nextAudioPts || -1,
27508                        p = e * a,
27509                        y = h.baseTime * a / h.timescale;
27510                    if (this.isAudioContiguous = r = r || g.length && m > 0 && (i && Math.abs(p - m) < 9e3 || Math.abs(An(g[0].pts - y, p) - m) < 20 * u), g.forEach((function (t) {
27511                            t.pts = An(t.pts - y, p)
27512                        })), !r || m < 0) {
27513                        if (g = g.filter((function (t) {
27514                                return t.pts >= 0
27515                            })), !g.length) return;
27516                        m = 0 === n ? 0 : i && !f ? Math.max(0, p) : g[0].pts
27517                    }
27518                    if ("aac" === t.segmentCodec)
27519                        for (var E = this.config.maxAudioFramesDrift, T = 0, R = m; T < g.length; T++) {
27520                            var k = g[T],
27521                                b = k.pts,
27522                                D = b - R,
27523                                I = Math.abs(1e3 * D / a);
27524                            if (D <= -E * u && f) 0 === T && (w.warn("Audio frame @ " + (b / a).toFixed(3) + "s overlaps nextAudioPts by " + Math.round(1e3 * D / a) + " ms."), this.nextAudioPts = m = R = b);
27525                            else if (D >= E * u && I < 1e4 && f) {
27526                                var C = Math.round(D / u);
27527                                (R = b - C * u) < 0 && (C--, R += u), 0 === T && (this.nextAudioPts = m = R), w.warn("[mp4-remuxer]: Injecting " + C + " audio frame @ " + (R / a).toFixed(3) + "s due to " + Math.round(1e3 * D / a) + " ms gap.");
27528                                for (var _ = 0; _ < C; _++) {
27529                                    var x = Math.max(R, 0),
27530                                        P = gn.getSilentFrame(t.manifestCodec || t.codec, t.channelCount);
27531                                    P || (w.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."), P = k.unit.subarray()), g.splice(T, 0, {
27532                                        unit: P,
27533                                        pts: x
27534                                    }), R += u, T++
27535                                }
27536                            }
27537                            k.pts = R, R += u
27538                        }
27539                    for (var F, M = null, O = null, N = 0, U = g.length; U--;) N += g[U].unit.byteLength;
27540                    for (var B = 0, G = g.length; B < G; B++) {
27541                        var K = g[B],
27542                            H = K.unit,
27543                            V = K.pts;
27544                        if (null !== O) c[B - 1].duration = Math.round((V - O) / s);
27545                        else {
27546                            if (r && "aac" === t.segmentCodec && (V = m), M = V, !(N > 0)) return;
27547                            N += v;
27548                            try {
27549                                F = new Uint8Array(N)
27550                            } catch (t) {
27551                                return void this.observer.emit(S.ERROR, S.ERROR, {
27552                                    type: L.MUX_ERROR,
27553                                    details: A.REMUX_ALLOC_ERROR,
27554                                    fatal: !1,
27555                                    error: t,
27556                                    bytes: N,
27557                                    reason: "fail allocating audio mdat " + N
27558                                })
27559                            }
27560                            d || (new DataView(F.buffer).setUint32(0, N), F.set(mn.types.mdat, 4))
27561                        }
27562                        F.set(H, v);
27563                        var Y = H.byteLength;
27564                        v += Y, c.push(new Dn(!0, l, Y, 0)), O = V
27565                    }
27566                    var W = c.length;
27567                    if (W) {
27568                        var j = c[c.length - 1];
27569                        this.nextAudioPts = m = O + s * j.duration;
27570                        var q = d ? new Uint8Array(0) : mn.moof(t.sequenceNumber++, M / s, o({}, t, {
27571                            samples: c
27572                        }));
27573                        t.samples = [];
27574                        var X = M / a,
27575                            z = m / a,
27576                            Q = {
27577                                data1: q,
27578                                data2: F,
27579                                startPTS: X,
27580                                endPTS: z,
27581                                startDTS: X,
27582                                endDTS: z,
27583                                type: "audio",
27584                                hasAudio: !0,
27585                                hasVideo: !1,
27586                                nb: W
27587                            };
27588                        return this.isAudioContiguous = !0, Q
27589                    }
27590                }, e.remuxEmptyAudio = function (t, e, r, i) {
27591                    var n = t.inputTimeScale,
27592                        a = n / (t.samplerate ? t.samplerate : n),
27593                        s = this.nextAudioPts,
27594                        o = this._initDTS,
27595                        l = 9e4 * o.baseTime / o.timescale,
27596                        u = (null !== s ? s : i.startDTS * n) + l,
27597                        h = i.endDTS * n + l,
27598                        d = 1024 * a,
27599                        c = Math.ceil((h - u) / d),
27600                        f = gn.getSilentFrame(t.manifestCodec || t.codec, t.channelCount);
27601                    if (w.warn("[mp4-remuxer]: remux empty Audio"), f) {
27602                        for (var g = [], v = 0; v < c; v++) {
27603                            var m = u + v * d;
27604                            g.push({
27605                                unit: f,
27606                                pts: m,
27607                                dts: m
27608                            })
27609                        }
27610                        return t.samples = g, this.remuxAudio(t, e, r, !1)
27611                    }
27612                    w.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")
27613                }, t
27614            }();
27615
27616        function An(t, e) {
27617            var r;
27618            if (null === e) return t;
27619            for (r = e < t ? -8589934592 : 8589934592; Math.abs(t - e) > 4294967296;) t += r;
27620            return t
27621        }
27622
27623        function Rn(t, e, r, i) {
27624            var n = t.samples.length;
27625            if (n) {
27626                for (var a = t.inputTimeScale, s = 0; s < n; s++) {
27627                    var o = t.samples[s];
27628                    o.pts = An(o.pts - r.baseTime * a / r.timescale, e * a) / a, o.dts = An(o.dts - i.baseTime * a / i.timescale, e * a) / a
27629                }
27630                var l = t.samples;
27631                return t.samples = [], {
27632                    samples: l
27633                }
27634            }
27635        }
27636
27637        function kn(t, e, r) {
27638            var i = t.samples.length;
27639            if (i) {
27640                for (var n = t.inputTimeScale, a = 0; a < i; a++) {
27641                    var s = t.samples[a];
27642                    s.pts = An(s.pts - r.baseTime * n / r.timescale, e * n) / n
27643                }
27644                t.samples.sort((function (t, e) {
27645                    return t.pts - e.pts
27646                }));
27647                var o = t.samples;
27648                return t.samples = [], {
27649                    samples: o
27650                }
27651            }
27652        }
27653        var bn, Dn = function (t, e, r, i) {
27654                this.size = void 0, this.duration = void 0, this.cts = void 0, this.flags = void 0, this.duration = e, this.size = r, this.cts = i, this.flags = {
27655                    isLeading: 0,
27656                    isDependedOn: 0,
27657                    hasRedundancy: 0,
27658                    degradPrio: 0,
27659                    dependsOn: t ? 2 : 1,
27660                    isNonSync: t ? 0 : 1
27661                }
27662            },
27663            In = function () {
27664                function t() {
27665                    this.emitInitSegment = !1, this.audioCodec = void 0, this.videoCodec = void 0, this.initData = void 0, this.initPTS = null, this.initTracks = void 0, this.lastEndTime = null
27666                }
27667                var e = t.prototype;
27668                return e.destroy = function () {}, e.resetTimeStamp = function (t) {
27669                    this.initPTS = t, this.lastEndTime = null
27670                }, e.resetNextTimestamp = function () {
27671                    this.lastEndTime = null
27672                }, e.resetInitSegment = function (t, e, r, i) {
27673                    this.audioCodec = e, this.videoCodec = r, this.generateInitSegment(function (t, e) {
27674                        if (!t || !e) return t;
27675                        var r = e.keyId;
27676                        return r && e.isCommonEncryption && xt(t, ["moov", "trak"]).forEac
vendor: 6,014 bytes, lines 27676-27774
27676h((function (t) {
27677                            var e = xt(t, ["mdia", "minf", "stbl", "stsd"])[0].subarray(8),
27678                                i = xt(e, ["enca"]),
27679                                n = i.length > 0;
27680                            n || (i = xt(e, ["encv"])), i.forEach((function (t) {
27681                                xt(n ? t.subarray(28) : t.subarray(78), ["sinf"]).forEach((function (t) {
27682                                    var e = Bt(t);
27683                                    if (e) {
27684                                        var i = e.subarray(8, 24);
27685                                        i.some((function (t) {
27686                                            return 0 !== t
27687                                        })) || (w.log("[eme] Patching keyId in 'enc" + (n ? "a" : "v") + ">sinf>>tenc' box: " + Lt(i) + " -> " + Lt(r)), e.set(r, 8))
27688                                    }
27689                                }))
27690                            }))
27691                        })), t
27692                    }(t, i)), this.emitInitSegment = !0
27693                }, e.generateInitSegment = function (t) {
27694                    var e = this.audioCodec,
27695                        r = this.videoCodec;
27696                    if (null == t || !t.byteLength) return this.initTracks = void 0, void(this.initData = void 0);
27697                    var i = this.initData = Ft(t);
27698                    i.audio && (e = wn(i.audio, O)), i.video && (r = wn(i.video, N));
27699                    var n = {};
27700                    i.audio && i.video ? n.audiovideo = {
27701                        container: "video/mp4",
27702                        codec: e + "," + r,
27703                        initSegment: t,
27704                        id: "main"
27705                    } : i.audio ? n.audio = {
27706                        container: "audio/mp4",
27707                        codec: e,
27708                        initSegment: t,
27709                        id: "audio"
27710                    } : i.video ? n.video = {
27711                        container: "video/mp4",
27712                        codec: r,
27713                        initSegment: t,
27714                        id: "main"
27715                    } : w.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."), this.initTracks = n
27716                }, e.remux = function (t, e, r, i, n, a) {
27717                    var s, o, l = this.initPTS,
27718                        u = this.lastEndTime,
27719                        h = {
27720                            audio: void 0,
27721                            video: void 0,
27722                            text: i,
27723                            id3: r,
27724                            initSegment: void 0
27725                        };
27726                    y(u) || (u = this.lastEndTime = n || 0);
27727                    var d = e.samples;
27728                    if (null == d || !d.length) return h;
27729                    var c = {
27730                            initPTS: void 0,
27731                            timescale: 1
27732                        },
27733                        f = this.initData;
27734                    if (null != (s = f) && s.length || (this.generateInitSegment(d), f = this.initData), null == (o = f) || !o.length) return w.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."), h;
27735                    this.emitInitSegment && (c.tracks = this.initTracks, this.emitInitSegment = !1);
27736                    var g = function (t, e) {
27737                            for (var r = 0, i = 0, n = 0, a = xt(t, ["moof", "traf"]), s = 0; s < a.length; s++) {
27738                                var o = a[s],
27739                                    l = xt(o, ["tfhd"])[0],
27740                                    u = e[It(l, 4)];
27741                                if (u) {
27742                                    var h = u.default,
27743                                        d = It(l, 0) | (null == h ? void 0 : h.flags),
27744                                        c = null == h ? void 0 : h.duration;
27745                                    8 & d && (c = It(l, 2 & d ? 12 : 8));
27746                                    for (var f = u.timescale || 9e4, g = xt(o, ["trun"]), v = 0; v < g.length; v++) !(r = Gt(g[v])) && c && (r = c * It(g[v], 4)), u.type === N ? i += r / f : u.type === O && (n += r / f)
27747                                }
27748                            }
27749                            if (0 === i && 0 === n) {
27750                                for (var m = 1 / 0, p = 0, E = 0, T = xt(t, ["sidx"]), S = 0; S < T.length; S++) {
27751                                    var L = Pt(T[S]);
27752                                    if (null != L && L.references) {
27753                                        m = Math.min(m, L.earliestPresentationTime / L.timescale);
27754                                        var A = L.references.reduce((function (t, e) {
27755                                            return t + e.info.duration || 0
27756                                        }), 0);
27757                                        E = (p = Math.max(p, A + L.earliestPresentationTime / L.timescale)) - m
27758                                    }
27759                                }
27760                                if (E && y(E)) return E
27761                            }
27762                            return i || n
27763                        }(d, f),
27764                        v = function (t, e) {
27765                            return xt(e, ["moof", "traf"]).reduce((function (e, r) {
27766                                var i = xt(r, ["tfdt"])[0],
27767                                    n = i[0],
27768                                    a = xt(r, ["tfhd"]).reduce((function (e, r) {
27769                                        var a = It(r, 4),
27770                                            s = t[a];
27771                                        if (s) {
27772                                            var o = It(i, 4);
27773                                            if (1 === n) {
27774                                                if (o === At) return w.warn("[mp4-demuxer]: Ignoring assumed invali
vendor: 5,184 bytes, lines 27774-27877
27774d signed 64-bit track fragment decode time"), e;
27775                                                o *= At + 1, o += It(i, 8)
27776                                            }
27777                                            var l = o / (s.timescale || 9e4);
27778                                            if (y(l) && (null === e || l < e)) return l
27779                                        }
27780                                        return e
27781                                    }), null);
27782                                return null !== a && y(a) && (null === e || a < e) ? a : e
27783                            }), null)
27784                        }(f, d),
27785                        m = null === v ? n : v;
27786                    (function (t, e, r, i) {
27787                        if (null === t) return !0;
27788                        var n = Math.max(i, 1),
27789                            a = e - t.baseTime / t.timescale;
27790                        return Math.abs(a - r) > n
27791                    }(l, m, n, g) || c.timescale !== l.timescale && a) && (c.initPTS = m - n, l && 1 === l.timescale && w.warn("Adjusting initPTS by " + (c.initPTS - l.baseTime)), this.initPTS = l = {
27792                        baseTime: c.initPTS,
27793                        timescale: 1
27794                    });
27795                    var p = t ? m - l.baseTime / l.timescale : u,
27796                        E = p + g;
27797                    ! function (t, e, r) {
27798                        xt(e, ["moof", "traf"]).forEach((function (e) {
27799                            xt(e, ["tfhd"]).forEach((function (i) {
27800                                var n = It(i, 4),
27801                                    a = t[n];
27802                                if (a) {
27803                                    var s = a.timescale || 9e4;
27804                                    xt(e, ["tfdt"]).forEach((function (t) {
27805                                        var e = t[0],
27806                                            i = r * s;
27807                                        if (i) {
27808                                            var n = It(t, 4);
27809                                            if (0 === e) n -= i, _t(t, 4, n = Math.max(n, 0));
27810                                            else {
27811                                                n *= Math.pow(2, 32), n += It(t, 8), n -= i, n = Math.max(n, 0);
27812                                                var a = Math.floor(n / (At + 1)),
27813                                                    o = Math.floor(n % (At + 1));
27814                                                _t(t, 4, a), _t(t, 8, o)
27815                                            }
27816                                        }
27817                                    }))
27818                                }
27819                            }))
27820                        }))
27821                    }(f, d, l.baseTime / l.timescale), g > 0 ? this.lastEndTime = E : (w.warn("Duration parsed from mp4 should be greater than zero"), this.resetNextTimestamp());
27822                    var T = !!f.audio,
27823                        S = !!f.video,
27824                        L = "";
27825                    T && (L += "audio"), S && (L += "video");
27826                    var A = {
27827                        data1: d,
27828                        startPTS: p,
27829                        startDTS: p,
27830                        endPTS: E,
27831                        endDTS: E,
27832                        type: L,
27833                        hasAudio: T,
27834                        hasVideo: S,
27835                        nb: 1,
27836                        dropped: 0
27837                    };
27838                    return h.audio = "audio" === A.type ? A : void 0, h.video = "audio" !== A.type ? A : void 0, h.initSegment = c, h.id3 = Rn(r, n, l, l), i.samples.length && (h.text = kn(i, n, l)), h
27839                }, t
27840            }();
27841
27842        function wn(t, e) {
27843            var r = null == t ? void 0 : t.codec;
27844            if (r && r.length > 4) return r;
27845            if (e === O) {
27846                if ("ec-3" === r || "ac-3" === r || "alac" === r) return r;
27847                if ("fLaC" === r || "Opus" === r) return he(r, !1);
27848                var i = "mp4a.40.5";
27849                return w.info('Parsed audio codec "' + r + '" or audio object type not handled. Using "' + i + '"'), i
27850            }
27851            return w.warn('Unhandled video codec "' + r + '"'), "hvc1" === r || "hev1" === r ? "hvc1.1.6.L120.90" : "av01" === r ? "av01.0.04M.08" : "avc1.42e01e"
27852        }
27853        try {
27854            bn = self.performance.now.bind(self.performance)
27855        } catch (t) {
27856            w.debug("Unable to use Performance API on this environment"), bn = null == j ? void 0 : j.Date.now
27857        }
27858        var Cn = [{
27859            demux: Ji,
27860            remux: In
27861        }, {
27862            demux: on,
27863            remux: Ln
27864        }, {
27865            demux: zi,
27866            remux: Ln
27867        }, {
27868            demux: fn,
27869            remux: Ln
27870        }];
27871        Cn.splice(2, 0, {
27872            demux: Zi,
27873            remux: Ln
27874        });
27875        var _n = function () {
27876                function t(t, e, r, i, n) {
27877                    this.async = !1, this.observer = void 0, this.typeSupp
vendor: 14,585 bytes, lines 27877-28144
27877orted = void 0, this.config = void 0, this.vendor = void 0, this.id = void 0, this.demuxer = void 0, this.remuxer = void 0, this.decrypter = void 0, this.probe = void 0, this.decryptionPromise = null, this.transmuxConfig = void 0, this.currentTransmuxState = void 0, this.observer = t, this.typeSupported = e, this.config = r, this.vendor = i, this.id = n
27878                }
27879                var e = t.prototype;
27880                return e.configure = function (t) {
27881                    this.transmuxConfig = t, this.decrypter && this.decrypter.reset()
27882                }, e.push = function (t, e, r, i) {
27883                    var n = this,
27884                        a = r.transmuxing;
27885                    a.executeStart = bn();
27886                    var s = new Uint8Array(t),
27887                        o = this.currentTransmuxState,
27888                        l = this.transmuxConfig;
27889                    i && (this.currentTransmuxState = i);
27890                    var u = i || o,
27891                        h = u.contiguous,
27892                        d = u.discontinuity,
27893                        c = u.trackSwitch,
27894                        f = u.accurateTimeOffset,
27895                        g = u.timeOffset,
27896                        v = u.initSegmentChange,
27897                        m = l.audioCodec,
27898                        p = l.videoCodec,
27899                        y = l.defaultInitPts,
27900                        E = l.duration,
27901                        T = l.initSegmentData,
27902                        R = function (t, e) {
27903                            var r = null;
27904                            return t.byteLength > 0 && null != (null == e ? void 0 : e.key) && null !== e.iv && null != e.method && (r = e), r
27905                        }(s, e);
27906                    if (R && "AES-128" === R.method) {
27907                        var k = this.getDecrypter();
27908                        if (!k.isSync()) return this.decryptionPromise = k.webCryptoDecrypt(s, R.key.buffer, R.iv.buffer).then((function (t) {
27909                            var e = n.push(t, null, r);
27910                            return n.decryptionPromise = null, e
27911                        })), this.decryptionPromise;
27912                        var b = k.softwareDecrypt(s, R.key.buffer, R.iv.buffer);
27913                        if (r.part > -1 && (b = k.flush()), !b) return a.executeEnd = bn(), xn(r);
27914                        s = new Uint8Array(b)
27915                    }
27916                    var D = this.needsProbing(d, c);
27917                    if (D) {
27918                        var I = this.configureTransmuxer(s);
27919                        if (I) return w.warn("[transmuxer] " + I.message), this.observer.emit(S.ERROR, S.ERROR, {
27920                            type: L.MEDIA_ERROR,
27921                            details: A.FRAG_PARSING_ERROR,
27922                            fatal: !1,
27923                            error: I,
27924                            reason: I.message
27925                        }), a.executeEnd = bn(), xn(r)
27926                    }(d || c || v || D) && this.resetInitSegment(T, m, p, E, e), (d || v || D) && this.resetInitialTimestamp(y), h || this.resetContiguity();
27927                    var C = this.transmux(s, R, g, f, r),
27928                        _ = this.currentTransmuxState;
27929                    return _.contiguous = !0, _.discontinuity = !1, _.trackSwitch = !1, a.executeEnd = bn(), C
27930                }, e.flush = function (t) {
27931                    var e = this,
27932                        r = t.transmuxing;
27933                    r.executeStart = bn();
27934                    var i = this.decrypter,
27935                        n = this.currentTransmuxState,
27936                        a = this.decryptionPromise;
27937                    if (a) return a.then((function () {
27938                        return e.flush(t)
27939                    }));
27940                    var s = [],
27941                        o = n.timeOffset;
27942                    if (i) {
27943                        var l = i.flush();
27944                        l && s.push(this.push(l, null, t))
27945                    }
27946                    var u = this.demuxer,
27947                        h = this.remuxer;
27948                    if (!u || !h) return r.executeEnd = bn(), [xn(t)];
27949                    var d = u.flush(o);
27950                    return Pn(d) ? d.then((function (r) {
27951                        return e.flushRemux(s, r, t), s
27952                    })) : (this.flushRemux(s, d, t), s)
27953                }, e.flushRemux = function (t, e, r) {
27954                    var i = e.audioTrack,
27955                        n = e.videoTrack,
27956                        a = e.id3Track,
27957                        s = e.textTrack,
27958                        o = this.currentTransmuxState,
27959                        l = o.accurateTimeOffset,
27960                        u = o.timeOffset;
27961                    w.log("[transmuxer.ts]: Flushed fragment " + r.sn + (r.part > -1 ? " p: " + r.part : "") + " of level " + r.level);
27962                    var h = this.remuxer.remux(i, n, a, s, u, l, !0, this.id);
27963                    t.push({
27964                        remuxResult: h,
27965                        chunkMeta: r
27966                    }), r.transmuxing.executeEnd = bn()
27967                }, e.resetInitialTimestamp = function (t) {
27968                    var e = this.demuxer,
27969                        r = this.remuxer;
27970                    e && r && (e.resetTimeStamp(t), r.resetTimeStamp(t))
27971                }, e.resetContiguity = function () {
27972                    var t = this.demuxer,
27973                        e = this.remuxer;
27974                    t && e && (t.resetContiguity(), e.resetNextTimestamp())
27975                }, e.resetInitSegment = function (t, e, r, i, n) {
27976                    var a = this.demuxer,
27977                        s = this.remuxer;
27978                    a && s && (a.resetInitSegment(t, e, r, i), s.resetInitSegment(t, e, r, n))
27979                }, e.destroy = function () {
27980                    this.demuxer && (this.demuxer.destroy(), this.demuxer = void 0), this.remuxer && (this.remuxer.destroy(), this.remuxer = void 0)
27981                }, e.transmux = function (t, e, r, i, n) {
27982                    return e && "SAMPLE-AES" === e.method ? this.transmuxSampleAes(t, e, r, i, n) : this.transmuxUnencrypted(t, r, i, n)
27983                }, e.transmuxUnencrypted = function (t, e, r, i) {
27984                    var n = this.demuxer.demux(t, e, !1, !this.config.progressive),
27985                        a = n.audioTrack,
27986                        s = n.videoTrack,
27987                        o = n.id3Track,
27988                        l = n.textTrack;
27989                    return {
27990                        remuxResult: this.remuxer.remux(a, s, o, l, e, r, !1, this.id),
27991                        chunkMeta: i
27992                    }
27993                }, e.transmuxSampleAes = function (t, e, r, i, n) {
27994                    var a = this;
27995                    return this.demuxer.demuxSampleAes(t, e, r).then((function (t) {
27996                        return {
27997                            remuxResult: a.remuxer.remux(t.audioTrack, t.videoTrack, t.id3Track, t.textTrack, r, i, !1, a.id),
27998                            chunkMeta: n
27999                        }
28000                    }))
28001                }, e.configureTransmuxer = function (t) {
28002                    for (var e, r = this.config, i = this.observer, n = this.typeSupported, a = this.vendor, s = 0, o = Cn.length; s < o; s++) {
28003                        var l;
28004                        if (null != (l = Cn[s].demux) && l.probe(t)) {
28005                            e = Cn[s];
28006                            break
28007                        }
28008                    }
28009                    if (!e) return new Error("Failed to find demuxer by probing fragment data");
28010                    var u = this.demuxer,
28011                        h = this.remuxer,
28012                        d = e.remux,
28013                        c = e.demux;
28014                    h && h instanceof d || (this.remuxer = new d(i, r, n, a)), u && u instanceof c || (this.demuxer = new c(i, r, n), this.probe = c.probe)
28015                }, e.needsProbing = function (t, e) {
28016                    return !this.demuxer || !this.remuxer || t || e
28017                }, e.getDecrypter = function () {
28018                    var t = this.decrypter;
28019                    return t || (t = this.decrypter = new ci(this.config)), t
28020                }, t
28021            }(),
28022            xn = function (t) {
28023                return {
28024                    remuxResult: {},
28025                    chunkMeta: t
28026                }
28027            };
28028
28029        function Pn(t) {
28030            return "then" in t && t.then instanceof Function
28031        }
28032        var Fn = function (t, e, r, i, n) {
28033                this.audioCodec = void 0, this.videoCodec = void 0, this.initSegmentData = void 0, this.duration = void 0, this.defaultInitPts = void 0, this.audioCodec = t, this.videoCodec = e, this.initSegmentData = r, this.duration = i, this.defaultInitPts = n || null
28034            },
28035            Mn = function (t, e, r, i, n, a) {
28036                this.discontinuity = void 0, this.contiguous = void 0, this.accurateTimeOffset = void 0, this.trackSwitch = void 0, this.timeOffset = void 0, this.initSegmentChange = void 0, this.discontinuity = t, this.contiguous = e, this.accurateTimeOffset = r, this.trackSwitch = i, this.timeOffset = n, this.initSegmentChange = a
28037            },
28038            On = {
28039                exports: {}
28040            };
28041        ! function (t) {
28042            var e = Object.prototype.hasOwnProperty,
28043                r = "~";
28044
28045            function i() {}
28046
28047            function n(t, e, r) {
28048                this.fn = t, this.context = e, this.once = r || !1
28049            }
28050
28051            function a(t, e, i, a, s) {
28052                if ("function" != typeof i) throw new TypeError("The listener must be a function");
28053                var o = new n(i, a || t, s),
28054                    l = r ? r + e : e;
28055                return t._events[l] ? t._events[l].fn ? t._events[l] = [t._events[l], o] : t._events[l].push(o) : (t._events[l] = o, t._eventsCount++), t
28056            }
28057
28058            function s(t, e) {
28059                0 == --t._eventsCount ? t._events = new i : delete t._events[e]
28060            }
28061
28062            function o() {
28063                this._events = new i, this._eventsCount = 0
28064            }
28065            Object.create && (i.prototype = Object.create(null), (new i).__proto__ || (r = !1)), o.prototype.eventNames = function () {
28066                var t, i, n = [];
28067                if (0 === this._eventsCount) return n;
28068                for (i in t = this._events) e.call(t, i) && n.push(r ? i.slice(1) : i);
28069                return Object.getOwnPropertySymbols ? n.concat(Object.getOwnPropertySymbols(t)) : n
28070            }, o.prototype.listeners = function (t) {
28071                var e = r ? r + t : t,
28072                    i = this._events[e];
28073                if (!i) return [];
28074                if (i.fn) return [i.fn];
28075                for (var n = 0, a = i.length, s = new Array(a); n < a; n++) s[n] = i[n].fn;
28076                return s
28077            }, o.prototype.listenerCount = function (t) {
28078                var e = r ? r + t : t,
28079                    i = this._events[e];
28080                return i ? i.fn ? 1 : i.length : 0
28081            }, o.prototype.emit = function (t, e, i, n, a, s) {
28082                var o = r ? r + t : t;
28083                if (!this._events[o]) return !1;
28084                var l, u, h = this._events[o],
28085                    d = arguments.length;
28086                if (h.fn) {
28087                    switch (h.once && this.removeListener(t, h.fn, void 0, !0), d) {
28088                    case 1:
28089                        return h.fn.call(h.context), !0;
28090                    case 2:
28091                        return h.fn.call(h.context, e), !0;
28092                    case 3:
28093                        return h.fn.call(h.context, e, i), !0;
28094                    case 4:
28095                        return h.fn.call(h.context, e, i, n), !0;
28096                    case 5:
28097                        return h.fn.call(h.context, e, i, n, a), !0;
28098                    case 6:
28099                        return h.fn.call(h.context, e, i, n, a, s), !0
28100                    }
28101                    for (u = 1, l = new Array(d - 1); u < d; u++) l[u - 1] = arguments[u];
28102                    h.fn.apply(h.context, l)
28103                } else {
28104                    var c, f = h.length;
28105                    for (u = 0; u < f; u++) switch (h[u].once && this.removeListener(t, h[u].fn, void 0, !0), d) {
28106                    case 1:
28107                        h[u].fn.call(h[u].context);
28108                        break;
28109                    case 2:
28110                        h[u].fn.call(h[u].context, e);
28111                        break;
28112                    case 3:
28113                        h[u].fn.call(h[u].context, e, i);
28114                        break;
28115                    case 4:
28116                        h[u].fn.call(h[u].context, e, i, n);
28117                        break;
28118                    default:
28119                        if (!l)
28120                            for (c = 1, l = new Array(d - 1); c < d; c++) l[c - 1] = arguments[c];
28121                        h[u].fn.apply(h[u].context, l)
28122                    }
28123                }
28124                return !0
28125            }, o.prototype.on = function (t, e, r) {
28126                return a(this, t, e, r, !1)
28127            }, o.prototype.once = function (t, e, r) {
28128                return a(this, t, e, r, !0)
28129            }, o.prototype.removeListener = function (t, e, i, n) {
28130                var a = r ? r + t : t;
28131                if (!this._events[a]) return this;
28132                if (!e) return s(this, a), this;
28133                var o = this._events[a];
28134                if (o.fn) o.fn !== e || n && !o.once || i && o.context !== i || s(this, a);
28135                else {
28136                    for (var l = 0, u = [], h = o.length; l < h; l++)(o[l].fn !== e || n && !o[l].once || i && o[l].context !== i) && u.push(o[l]);
28137                    u.length ? this._events[a] = 1 === u.length ? u[0] : u : s(this, a)
28138                }
28139                return this
28140            }, o.prototype.removeAllListeners = function (t) {
28141                var e;
28142                return t ? (e = r ? r + t : t, this._events[e] && s(this, e)) : (this._events = new i, this._eventsCount = 0), this
28143            }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = r, o.EventEmitter = o, t.exports = o
28144        }(On);
28145        var Nn = v(On.exports);
28146
28147        function Un(t, e) {
28148            if (!((r = e.remuxResult).audio || r.video || r.text || r.id3 || r.initSegment)) return !1;
28149            var r, i = [],
28150                n = e.remuxResult,
28151                a = n.audio,
28152                s = n.video;
28153            return a && Bn(i, a), s && Bn(i, s), t.postMessage({
28154                event: "transmuxComplete",
28155                data: e
28156            }, i), !0
28157        }
28158
28159        function Bn(t, e) {
28160            e.data1 && t.push(e.data1.buffer), e.data2 && t.push(e.data2.buffer)
28161        }
28162
28163        function Gn(t, e, r) {
28164            e.reduce((function (e, r) {
28165                return Un(t, r) || e
28166            }), !1) || t.postMessage({
28167                event: "transmuxComplete",
28168                data: e[0]
28169            }), t.postMessage({
28170                event: "flush",
28171                data: r
28172            })
28173        }
28174        void 0 !== e && e && function (t) {
28175            var e = new Nn,
28176                r = function (e, r) {
28177                    t.postMessage({
28178                        event: e,
28179                        data: r
28180                    })
28181                };
28182            e.on(S.FRAG_DECRYPTED, r), e.on(S.ERROR, r);
28183            var i = function () {
28184                var t = function (t) {
28185                    var e = function (e) {
28186                        r("workerLog", {
28187                            logType: t,
28188                            message: e
28189                        })
28190                    };
28191                    w[t] = e
28192                };
28193                for (var e in w) t(e)
28194            };
28195            t.addEventListener("message", (function (n) {
28196                var a = n.data;
28197                switch (a.cmd) {
28198                case "init":
28199                    var s = JSON.parse(a.config);
28200                    t.transmuxer = new _n(e, a.typeSupported, s, a.vendor, a.id), I(s.debug, a.id), i(), r("init", null);
28201                    break;
28202                case "configure":
28203                    t.transmuxer.configure(a.config);
28204                    break;
28205                case "demux":
28206                    var o = t.transmuxer.push(a.data, a.decryptdata, a.chunkMeta, a.state);
28207                    Pn(o) ? (t.transmuxer.async = !0, o.then((function (e) {
28208                        Un(t, e)
28209                    })).catch((function (t) {
28210                        r(S.ERROR, {
28211                            type: L.MEDIA_ERROR,
28212                            details: A.FRAG_PARSING_ERROR,
28213                            chunkMeta: a.chunkMeta,
28214                            fatal: !1,
28215                            error: t,
28216                            err: t,
28217                            reason: "transmuxer-worker push error"
28218                        })
28219                    }))) : (t.transmuxer.async = !1, Un(t, o));
28220                    break;
28221                case "flush":
28222                    var l = a.chunkMeta,
28223                        u = t.transmuxer.flush(l);
28224                    Pn(u) || t.transmuxer.async ? (Pn(u) || (u = Promise.resolve(u)), u.then((function (e) {
28225                        Gn(t, e, l)
28226                    })).catch((function (t) {
28227                        r(S.ERROR, {
28228                            type: L.MEDIA_ERROR,
28229                            details: A.FRAG_PARSING_ERROR,
28230                            chunkMeta: a.chunkMeta,
28231                            fatal: !1,
28232                            error: t,
28233                            err: t,
28234                            reason: "transmuxer-worker flush error"
28235                        })
28236                    }))) : Gn(t, u, l)
28237                }
28238            }))
28239        }(self);
28240        var Kn = function () {
28241            function e(e, r, i, n) {
28242                var a = this;
28243                this.error = null, this.hls = void 0, this.id = void 0, this.observer = void 0, this.frag = null, this.part = null, this.useWorker = void 0, this.workerContext = null, this.onwmsg = void 0, this.transmuxer = null, this.onTransmuxComplete = void 0, this.onFlush = void 0;
28244                var s = e.config;
28245                this.hls = e, this.id = r, this.useWorker = !!s.enableWorker, this.onTransmuxComplete = i, this.onFlush = n;
28246                var o = function (t, e) {
28247                    (e = e || {}).frag = a.frag, e.id = a.id, t === S.ERROR && (a.error = e.error), a.hls.trigger(t, e)
28248                };
28249                this.observer = new Nn, this.observer.on(S.FRAG_DECRYPTED, o), this.observer.on(S.ERROR, o);
28250                var l, u, h, d, c = ee(s.preferManagedMediaSource) || {
vendor: 4,227 bytes, lines 28251-28323
28251                        isTypeSupported: function () {
28252                            return !1
28253                        }
28254                    },
28255                    f = {
28256                        mpeg: c.isTypeSupported("audio/mpeg"),
28257                        mp3: c.isTypeSupported('audio/mp4; codecs="mp3"'),
28258                        ac3: c.isTypeSupported('audio/mp4; codecs="ac-3"')
28259                    },
28260                    g = navigator.vendor;
28261                if (!this.useWorker || "undefined" == typeof Worker || (s.workerPath, 0)) this.transmuxer = new _n(this.observer, f, s, g, r);
28262                else try {
28263                    s.workerPath ? (w.log("loading Web Worker " + s.workerPath + ' for "' + r + '"'), this.workerContext = (h = s.workerPath, d = new self.URL(h, self.location.href).href, {
28264                        worker: new self.Worker(d),
28265                        scriptURL: d
28266                    })) : (w.log('injecting Web Worker for "' + r + '"'), this.workerContext = (l = new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(" + t.toString() + ")(true);"], {
28267                        type: "text/javascript"
28268                    }), u = self.URL.createObjectURL(l), {
28269                        worker: new self.Worker(u),
28270                        objectURL: u
28271                    })), this.onwmsg = function (t) {
28272                        return a.onWorkerMessage(t)
28273                    };
28274                    var v = this.workerContext.worker;
28275                    v.addEventListener("message", this.onwmsg), v.onerror = function (t) {
28276                        var e = new Error(t.message + "  (" + t.filename + ":" + t.lineno + ")");
28277                        s.enableWorker = !1, w.warn('Error in "' + r + '" Web Worker, fallback to inline'), a.hls.trigger(S.ERROR, {
28278                            type: L.OTHER_ERROR,
28279                            details: A.INTERNAL_EXCEPTION,
28280                            fatal: !1,
28281                            event: "demuxerWorker",
28282                            error: e
28283                        })
28284                    }, v.postMessage({
28285                        cmd: "init",
28286                        typeSupported: f,
28287                        vendor: g,
28288                        id: r,
28289                        config: JSON.stringify(s)
28290                    })
28291                } catch (t) {
28292                    w.warn('Error setting up "' + r + '" Web Worker, fallback to inline', t), this.resetWorker(), this.error = null, this.transmuxer = new _n(this.observer, f, s, g, r)
28293                }
28294            }
28295            var r = e.prototype;
28296            return r.resetWorker = function () {
28297                if (this.workerContext) {
28298                    var t = this.workerContext,
28299                        e = t.worker,
28300                        r = t.objectURL;
28301                    r && self.URL.revokeObjectURL(r), e.removeEventListener("message", this.onwmsg), e.onerror = null, e.terminate(), this.workerContext = null
28302                }
28303            }, r.destroy = function () {
28304                if (this.workerContext) this.resetWorker(), this.onwmsg = void 0;
28305                else {
28306                    var t = this.transmuxer;
28307                    t && (t.destroy(), this.transmuxer = null)
28308                }
28309                var e = this.observer;
28310                e && e.removeAllListeners(), this.frag = null, this.observer = null, this.hls = null
28311            }, r.push = function (t, e, r, i, n, a, s, o, l, u) {
28312                var h, d, c = this;
28313                l.transmuxing.start = self.performance.now();
28314                var f = this.transmuxer,
28315                    g = a ? a.start : n.start,
28316                    v = n.decryptdata,
28317                    m = this.frag,
28318                    p = !(m && n.cc === m.cc),
28319                    y = !(m && l.level === m.level),
28320                    E = m ? l.sn - m.sn : -1,
28321                    T = this.part ? l.part - this.part.index : -1,
28322                    S = 0 === E && l.id > 1 && l.id === (null == m ? void 0 : m.stats.chunkCount),
28323                    L = !y && (1 === E || 0 === E && (1 === T || S && T <= 0)
vendor: 72,567 bytes, lines 28323-29436
28323),
28324                    A = self.performance.now();
28325                (y || E || 0 === n.stats.parsing.start) && (n.stats.parsing.start = A), !a || !T && L || (a.stats.parsing.start = A);
28326                var R = !(m && (null == (h = n.initSegment) ? void 0 : h.url) === (null == (d = m.initSegment) ? void 0 : d.url)),
28327                    k = new Mn(p, L, o, y, g, R);
28328                if (!L || p || R) {
28329                    w.log("[transmuxer-interface, " + n.type + "]: Starting new transmux session for sn: " + l.sn + " p: " + l.part + " level: " + l.level + " id: " + l.id + "\n        discontinuity: " + p + "\n        trackSwitch: " + y + "\n        contiguous: " + L + "\n        accurateTimeOffset: " + o + "\n        timeOffset: " + g + "\n        initSegmentChange: " + R);
28330                    var b = new Fn(r, i, e, s, u);
28331                    this.configureTransmuxer(b)
28332                }
28333                if (this.frag = n, this.part = a, this.workerContext) this.workerContext.worker.postMessage({
28334                    cmd: "demux",
28335                    data: t,
28336                    decryptdata: v,
28337                    chunkMeta: l,
28338                    state: k
28339                }, t instanceof ArrayBuffer ? [t] : []);
28340                else if (f) {
28341                    var D = f.push(t, v, l, k);
28342                    Pn(D) ? (f.async = !0, D.then((function (t) {
28343                        c.handleTransmuxComplete(t)
28344                    })).catch((function (t) {
28345                        c.transmuxerError(t, l, "transmuxer-interface push error")
28346                    }))) : (f.async = !1, this.handleTransmuxComplete(D))
28347                }
28348            }, r.flush = function (t) {
28349                var e = this;
28350                t.transmuxing.start = self.performance.now();
28351                var r = this.transmuxer;
28352                if (this.workerContext) this.workerContext.worker.postMessage({
28353                    cmd: "flush",
28354                    chunkMeta: t
28355                });
28356                else if (r) {
28357                    var i = r.flush(t);
28358                    Pn(i) || r.async ? (Pn(i) || (i = Promise.resolve(i)), i.then((function (r) {
28359                        e.handleFlushResult(r, t)
28360                    })).catch((function (r) {
28361                        e.transmuxerError(r, t, "transmuxer-interface flush error")
28362                    }))) : this.handleFlushResult(i, t)
28363                }
28364            }, r.transmuxerError = function (t, e, r) {
28365                this.hls && (this.error = t, this.hls.trigger(S.ERROR, {
28366                    type: L.MEDIA_ERROR,
28367                    details: A.FRAG_PARSING_ERROR,
28368                    chunkMeta: e,
28369                    frag: this.frag || void 0,
28370                    fatal: !1,
28371                    error: t,
28372                    err: t,
28373                    reason: r
28374                }))
28375            }, r.handleFlushResult = function (t, e) {
28376                var r = this;
28377                t.forEach((function (t) {
28378                    r.handleTransmuxComplete(t)
28379                })), this.onFlush(e)
28380            }, r.onWorkerMessage = function (t) {
28381                var e = t.data,
28382                    r = this.hls;
28383                switch (e.event) {
28384                case "init":
28385                    var i, n = null == (i = this.workerContext) ? void 0 : i.objectURL;
28386                    n && self.URL.revokeObjectURL(n);
28387                    break;
28388                case "transmuxComplete":
28389                    this.handleTransmuxComplete(e.data);
28390                    break;
28391                case "flush":
28392                    this.onFlush(e.data);
28393                    break;
28394                case "workerLog":
28395                    w[e.data.logType] && w[e.data.logType](e.data.message);
28396                    break;
28397                default:
28398                    e.data = e.data || {}, e.data.frag = this.frag, e.data.id = this.id, r.trigger(e.event, e.data)
28399                }
28400            }, r.configureTransmuxer = function (t) {
28401                var e = this.transmuxer;
28402                this.workerContext ? this.workerContext.worker.postMessage({
28403                    cmd: "configure",
28404                    config: t
28405                }) : e && e.configure(t)
28406            }, r.handleTransmuxComplete = function (t) {
28407                t.chunkMeta.transmuxing.end = self.performance.now(), this.onTransmuxComplete(t)
28408            }, e
28409        }();
28410
28411        function Hn(t, e) {
28412            if (t.length !== e.length) return !1;
28413            for (var r = 0; r < t.length; r++)
28414                if (!Vn(t[r].attrs, e[r].attrs)) return !1;
28415            return !0
28416        }
28417
28418        function Vn(t, e, r) {
28419            var i = t["STABLE-RENDITION-ID"];
28420            return i && !r ? i === e["STABLE-RENDITION-ID"] : !(r || ["LANGUAGE", "NAME", "CHARACTERISTICS", "AUTOSELECT", "DEFAULT", "FORCED", "ASSOC-LANGUAGE"]).some((function (r) {
28421                return t[r] !== e[r]
28422            }))
28423        }
28424
28425        function Yn(t, e) {
28426            return e.label.toLowerCase() === t.name.toLowerCase() && (!e.language || e.language.toLowerCase() === (t.lang || "").toLowerCase())
28427        }
28428        var Wn = function (t) {
28429                function e(e, r, i) {
28430                    var n;
28431                    return (n = t.call(this, e, r, i, "[audio-stream-controller]", Ce) || this).videoBuffer = null, n.videoTrackCC = -1, n.waitingVideoCC = -1, n.bufferedTrack = null, n.switchingTrack = null, n.trackId = -1, n.waitingData = null, n.mainDetails = null, n.flushing = !1, n.bufferFlushed = !1, n.cachedTrackLoadedData = null, n._registerListeners(), n
28432                }
28433                l(e, t);
28434                var r = e.prototype;
28435                return r.onHandlerDestroying = function () {
28436                    this._unregisterListeners(), t.prototype.onHandlerDestroying.call(this), this.mainDetails = null, this.bufferedTrack = null, this.switchingTrack = null
28437                }, r._registerListeners = function () {
28438                    var t = this.hls;
28439                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.LEVEL_LOADED, this.onLevelLoaded, this), t.on(S.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), t.on(S.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.on(S.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.on(S.ERROR, this.onError, this), t.on(S.BUFFER_RESET, this.onBufferReset, this), t.on(S.BUFFER_CREATED, this.onBufferCreated, this), t.on(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(S.BUFFER_FLUSHED, this.onBufferFlushed, this), t.on(S.INIT_PTS_FOUND, this.onInitPtsFound, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this)
28440                }, r._unregisterListeners = function () {
28441                    var t = this.hls;
28442                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.LEVEL_LOADED, this.onLevelLoaded, this), t.off(S.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), t.off(S.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.off(S.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.off(S.ERROR, this.onError, this), t.off(S.BUFFER_RESET, this.onBufferReset, this), t.off(S.BUFFER_CREATED, this.onBufferCreated, this), t.off(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(S.BUFFER_FLUSHED, this.onBufferFlushed, this), t.off(S.INIT_PTS_FOUND, this.onInitPtsFound, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this)
28443                }, r.onInitPtsFound = function (t, e) {
28444                    var r = e.frag,
28445                        i = e.id,
28446                        n = e.initPTS,
28447                        a = e.timescale;
28448                    if ("main" === i) {
28449                        var s = r.cc;
28450                        this.initPTS[r.cc] = {
28451                            baseTime: n,
28452                            timescale: a
28453                        }, this.log("InitPTS for cc: " + s + " found from main: " + n), this.videoTrackCC = s, this.state === Ri && this.tick()
28454                    }
28455                }, r.startLoad = function (t) {
28456                    if (!this.levels) return this.startPosition = t, void(this.state = gi);
28457                    var e = this.lastCurrentTime;
28458                    this.stopLoad(), this.setInterval(100), e > 0 && -1 === t ? (this.log("Override startPosition with lastCurrentTime @" + e.toFixed(3)), t = e, this.state = vi) : (this.loadedmetadata = !1, this.state = Ei), this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t, this.tick()
28459                }, r.doTick = function () {
28460                    switch (this.state) {
28461                    case vi:
28462                        this.doTickIdle();
28463                        break;
28464                    case Ei:
28465                        var e, r = this.levels,
28466                            i = this.trackId,
28467                            n = null == r || null == (e = r[i]) ? void 0 : e.details;
28468                        if (n) {
28469                            if (this.waitForCdnTuneIn(n)) break;
28470                            this.state = Ri
28471                        }
28472                        break;
28473                    case yi:
28474                        var a, s = performance.now(),
28475                            o = this.retryDate;
28476                        if (!o || s >= o || null != (a = this.media) && a.seeking) {
28477                            var l = this.levels,
28478                                u = this.trackId;
28479                            this.log("RetryDate reached, switch back to IDLE state"), this.resetStartWhenNotLoaded((null == l ? void 0 : l[u]) || null), this.state = vi
28480                        }
28481                        break;
28482                    case Ri:
28483                        var h = this.waitingData;
28484                        if (h) {
28485                            var d = h.frag,
28486                                c = h.part,
28487                                f = h.cache,
28488                                g = h.complete;
28489                            if (void 0 !== this.initPTS[d.cc]) {
28490                                this.waitingData = null, this.waitingVideoCC = -1, this.state = pi;
28491                                var v = {
28492                                    frag: d,
28493                                    part: c,
28494                                    payload: f.flush(),
28495                                    networkDetails: null
28496                                };
28497                                this._handleFragmentLoadProgress(v), g && t.prototype._handleFragmentLoadComplete.call(this, v)
28498                            } else if (this.videoTrackCC !== this.waitingVideoCC) this.log("Waiting fragment cc (" + d.cc + ") cancelled because video is at cc " + this.videoTrackCC), this.clearWaitingFragment();
28499                            else {
28500                                var m = this.getLoadPosition(),
28501                                    p = Jr.bufferInfo(this.mediaBuffer, m, this.config.maxBufferHole);
28502                                Er(p.end, this.config.maxFragLookUpTolerance, d) < 0 && (this.log("Waiting fragment cc (" + d.cc + ") @ " + d.start + " cancelled because another fragment at " + p.end + " is needed"), this.clearWaitingFragment())
28503                            }
28504                        } else this.state = vi
28505                    }
28506                    this.onTickEnd()
28507                }, r.clearWaitingFragment = function () {
28508                    var t = this.waitingData;
28509                    t && (this.fragmentTracker.removeFragment(t.frag), this.waitingData = null, this.waitingVideoCC = -1, this.state = vi)
28510                }, r.resetLoadingState = function () {
28511                    this.clearWaitingFragment(), t.prototype.resetLoadingState.call(this)
28512                }, r.onTickEnd = function () {
28513                    var t = this.media;
28514                    null != t && t.readyState && (this.lastCurrentTime = t.currentTime)
28515                }, r.doTickIdle = function () {
28516                    var t = this.hls,
28517                        e = this.levels,
28518                        r = this.media,
28519                        i = this.trackId,
28520                        n = t.config;
28521                    if ((r || !this.startFragRequested && n.startFragPrefetch) && null != e && e[i]) {
28522                        var a = e[i],
28523                            s = a.details;
28524                        if (!s || s.live && this.levelLastLoaded !== a || this.waitForCdnTuneIn(s)) this.state = Ei;
28525                        else {
28526                            var o = this.mediaBuffer ? this.mediaBuffer : this.media;
28527                            this.bufferFlushed && o && (this.bufferFlushed = !1, this.afterBufferFlushed(o, O, Ce));
28528                            var l = this.getFwdBufferInfo(o, Ce);
28529                            if (null !== l) {
28530                                var u = this.bufferedTrack,
28531                                    h = this.switchingTrack;
28532                                if (!h && this._streamEnded(l, s)) return t.trigger(S.BUFFER_EOS, {
28533                                    type: "audio"
28534                                }), void(this.state = Li);
28535                                var d = this.getFwdBufferInfo(this.videoBuffer ? this.videoBuffer : this.media, we),
28536                                    c = l.len,
28537                                    f = this.getMaxBufferLength(null == d ? void 0 : d.len),
28538                                    g = s.fragments,
28539                                    v = g[0].start,
28540                                    m = this.flushing ? this.getLoadPosition() : l.end;
28541                                if (h && r) {
28542                                    var p = this.getLoadPosition();
28543                                    u && !Vn(h.attrs, u.attrs) && (m = p), s.PTSKnown && p < v && (l.end > v || l.nextStart) && (this.log("Alt audio track ahead of main track, seek to start of alt audio track"), r.currentTime = v + .05)
28544                                }
28545                                if (!(c >= f && !h && m < g[g.length - 1].start)) {
28546                                    var y = this.getNextFragment(m, s),
28547                                        E = !1;
28548                                    if (y && this.isLoopLoading(y, m) && (E = !!y.gap, y = this.getNextFragmentLoopLoading(y, s, l, we, f)), y) {
28549                                        var T = d && y.start > d.end + s.targetduration;
28550                                        if (T || (null == d || !d.len) && l.len) {
28551                                            var L = this.getAppendedFrag(y.start, we);
28552                                            if (null === L) return;
28553                                            if (E || (E = !!L.gap || !!T && 0 === d.len), T && !E || E && l.nextStart && l.nextStart < L.end) return
28554                                        }
28555                                        this.loadFragment(y, a, m)
28556                                    } else this.bufferFlushed = !0
28557                                }
28558                            }
28559                        }
28560                    }
28561                }, r.getMaxBufferLength = function (e) {
28562                    var r = t.prototype.getMaxBufferLength.call(this);
28563                    return e ? Math.min(Math.max(r, e), this.config.maxMaxBufferLength) : r
28564                }, r.onMediaDetaching = function () {
28565                    this.videoBuffer = null, this.bufferFlushed = this.flushing = !1, t.prototype.onMediaDetaching.call(this)
28566                }, r.onAudioTracksUpdated = function (t, e) {
28567                    var r = e.audioTracks;
28568                    this.resetTransmuxer(), this.levels = r.map((function (t) {
28569                        return new rr(t)
28570                    }))
28571                }, r.onAudioTrackSwitching = function (t, e) {
28572                    var r = !!e.url;
28573                    this.trackId = e.id;
28574                    var i = this.fragCurrent;
28575                    i && (i.abortRequests(), this.removeUnbufferedFrags(i.start)), this.resetLoadingState(), r ? this.setInterval(100) : this.resetTransmuxer(), r ? (this.switchingTrack = e, this.state = vi, this.flushAudioIfNeeded(e)) : (this.switchingTrack = null, this.bufferedTrack = e, this.state = gi), this.tick()
28576                }, r.onManifestLoading = function () {
28577                    this.fragmentTracker.removeAllFragments(), this.startPosition = this.lastCurrentTime = 0, this.bufferFlushed = this.flushing = !1, this.levels = this.mainDetails = this.waitingData = this.bufferedTrack = this.cachedTrackLoadedData = this.switchingTrack = null, this.startFragRequested = !1, this.trackId = this.videoTrackCC = this.waitingVideoCC = -1
28578                }, r.onLevelLoaded = function (t, e) {
28579                    this.mainDetails = e.details, null !== this.cachedTrackLoadedData && (this.hls.trigger(S.AUDIO_TRACK_LOADED, this.cachedTrackLoadedData), this.cachedTrackLoadedData = null)
28580                }, r.onAudioTrackLoaded = function (t, e) {
28581                    var r;
28582                    if (null != this.mainDetails) {
28583                        var i = this.levels,
28584                            n = e.details,
28585                            a = e.id;
28586                        if (i) {
28587                            this.log("Audio track " + a + " loaded [" + n.startSN + "," + n.endSN + "]" + (n.lastPartSn ? "[part-" + n.lastPartSn + "-" + n.lastPartIndex + "]" : "") + ",duration:" + n.totalduration);
28588                            var s = i[a],
28589                                o = 0;
28590                            if (n.live || null != (r = s.details) && r.live) {
28591                                this.checkLiveUpdate(n);
28592                                var l, u = this.mainDetails;
28593                                if (n.deltaUpdateFailed || !u) return;
28594                                !s.details && n.hasProgramDateTime && u.hasProgramDateTime ? (ii(n, u), o = n.fragments[0].start) : o = this.alignPlaylists(n, s.details, null == (l = this.levelLastLoaded) ? void 0 : l.details)
28595                            }
28596                            s.details = n, this.levelLastLoaded = s, this.startFragRequested || !this.mainDetails && n.live || this.setStartPosition(this.mainDetails || n, o), this.state !== Ei || this.waitForCdnTuneIn(n) || (this.state = vi), this.tick()
28597                        } else this.warn("Audio tracks were reset while loading level " + a)
28598                    } else this.cachedTrackLoadedData = e
28599                }, r._handleFragmentLoadProgress = function (t) {
28600                    var e, r = t.frag,
28601                        i = t.part,
28602                        n = t.payload,
28603                        a = this.config,
28604                        s = this.trackId,
28605                        o = this.levels;
28606                    if (o) {
28607                        var l = o[s];
28608                        if (l) {
28609                            var u = l.details;
28610                            if (!u) return this.warn("Audio track details undefined on fragment load progress"), void this.removeUnbufferedFrags(r.start);
28611                            var h = a.defaultAudioCodec || l.audioCodec || "mp4a.40.2",
28612                                d = this.transmuxer;
28613                            d || (d = this.transmuxer = new Kn(this.hls, Ce, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)));
28614                            var c = this.initPTS[r.cc],
28615                                f = null == (e = r.initSegment) ? void 0 : e.data;
28616                            if (void 0 !== c) {
28617                                var g = i ? i.index : -1,
28618                                    v = -1 !== g,
28619                                    m = new $r(r.level, r.sn, r.stats.chunkCount, n.byteLength, g, v);
28620                                d.push(n, f, h, "", r, i, u.totalduration, !1, m, c)
28621                            } else this.log("Unknown video PTS for cc " + r.cc + ", waiting for video PTS before demuxing audio frag " + r.sn + " of [" + u.startSN + " ," + u.endSN + "],track " + s), (this.waitingData = this.waitingData || {
28622                                frag: r,
28623                                part: i,
28624                                cache: new Di,
28625                                complete: !1
28626                            }).cache.push(new Uint8Array(n)), this.waitingVideoCC = this.videoTrackCC, this.state = Ri
28627                        } else this.warn("Audio track is undefined on fragment load progress")
28628                    } else this.warn("Audio tracks were reset while fragment load was in progress. Fragment " + r.sn + " of level " + r.level + " will not be buffered")
28629                }, r._handleFragmentLoadComplete = function (e) {
28630                    this.waitingData ? this.waitingData.complete = !0 : t.prototype._handleFragmentLoadComplete.call(this, e)
28631                }, r.onBufferReset = function () {
28632                    this.mediaBuffer = this.videoBuffer = null, this.loadedmetadata = !1
28633                }, r.onBufferCreated = function (t, e) {
28634                    var r = e.tracks.audio;
28635                    r && (this.mediaBuffer = r.buffer || null), e.tracks.video && (this.videoBuffer = e.tracks.video.buffer || null)
28636                }, r.onFragBuffered = function (t, e) {
28637                    var r = e.frag,
28638                        n = e.part;
28639                    if (r.type === Ce)
28640                        if (this.fragContextChanged(r)) this.warn("Fragment " + r.sn + (n ? " p: " + n.index : "") + " of level " + r.level + " finished buffering, but was aborted. state: " + this.state + ", audioSwitch: " + (this.switchingTrack ? this.switchingTrack.name : "false"));
28641                        else {
28642                            if ("initSegment" !== r.sn) {
28643                                this.fragPrevious = r;
28644                                var a = this.switchingTrack;
28645                                a && (this.bufferedTrack = a, this.switchingTrack = null, this.hls.trigger(S.AUDIO_TRACK_SWITCHED, i({}, a)))
28646                            }
28647                            this.fragBufferedComplete(r, n)
28648                        }
28649                    else if (!this.loadedmetadata && r.type === we) {
28650                        var s = this.videoBuffer || this.media;
28651                        s && Jr.getBuffered(s).length && (this.loadedmetadata = !0)
28652                    }
28653                }, r.onError = function (e, r) {
28654                    var i;
28655                    if (r.fatal) this.state = Ai;
28656                    else switch (r.details) {
28657                    case A.FRAG_GAP:
28658                    case A.FRAG_PARSING_ERROR:
28659                    case A.FRAG_DECRYPT_ERROR:
28660                    case A.FRAG_LOAD_ERROR:
28661                    case A.FRAG_LOAD_TIMEOUT:
28662                    case A.KEY_LOAD_ERROR:
28663                    case A.KEY_LOAD_TIMEOUT:
28664                        this.onFragmentOrKeyLoadError(Ce, r);
28665                        break;
28666                    case A.AUDIO_TRACK_LOAD_ERROR:
28667                    case A.AUDIO_TRACK_LOAD_TIMEOUT:
28668                    case A.LEVEL_PARSING_ERROR:
28669                        r.levelRetry || this.state !== Ei || (null == (i = r.context) ? void 0 : i.type) !== De || (this.state = vi);
28670                        break;
28671                    case A.BUFFER_APPEND_ERROR:
28672                    case A.BUFFER_FULL_ERROR:
28673                        if (!r.parent || "audio" !== r.parent) return;
28674                        if (r.details === A.BUFFER_APPEND_ERROR) return void this.resetLoadingState();
28675                        this.reduceLengthAndFlushBuffer(r) && (this.bufferedTrack = null, t.prototype.flushMainBuffer.call(this, 0, Number.POSITIVE_INFINITY, "audio"));
28676                        break;
28677                    case A.INTERNAL_EXCEPTION:
28678                        this.recoverWorkerError(r)
28679                    }
28680                }, r.onBufferFlushing = function (t, e) {
28681                    e.type !== N && (this.flushing = !0)
28682                }, r.onBufferFlushed = function (t, e) {
28683                    var r = e.type;
28684                    if (r !== N) {
28685                        this.flushing = !1, this.bufferFlushed = !0, this.state === Li && (this.state = vi);
28686                        var i = this.mediaBuffer || this.media;
28687                        i && (this.afterBufferFlushed(i, r, Ce), this.tick())
28688                    }
28689                }, r._handleTransmuxComplete = function (t) {
28690                    var e, r = "audio",
28691                        i = this.hls,
28692                        n = t.remuxResult,
28693                        a = t.chunkMeta,
28694                        s = this.getCurrentContext(a);
28695                    if (s) {
28696                        var l = s.frag,
28697                            u = s.part,
28698                            h = s.level,
28699                            d = h.details,
28700                            c = n.audio,
28701                            f = n.text,
28702                            g = n.id3,
28703                            v = n.initSegment;
28704                        if (!this.fragContextChanged(l) && d) {
28705                            if (this.state = Ti, this.switchingTrack && c && this.completeAudioSwitch(this.switchingTrack), null != v && v.tracks) {
28706                                var m = l.initSegment || l;
28707                                this._bufferInitSegment(h, v.tracks, m, a), i.trigger(S.FRAG_PARSING_INIT_SEGMENT, {
28708                                    frag: m,
28709                                    id: r,
28710                                    tracks: v.tracks
28711                                })
28712                            }
28713                            if (c) {
28714                                var p = c.startPTS,
28715                                    y = c.endPTS,
28716                                    E = c.startDTS,
28717                                    T = c.endDTS;
28718                                u && (u.elementaryStreams[O] = {
28719                                    startPTS: p,
28720                                    endPTS: y,
28721                                    startDTS: E,
28722                                    endDTS: T
28723                                }), l.setElementaryStreamInfo(O, p, y, E, T), this.bufferFragmentData(c, l, u, a)
28724                            }
28725                            if (null != g && null != (e = g.samples) && e.length) {
28726                                var L = o({
28727                                    id: r,
28728                                    frag: l,
28729                                    details: d
28730                                }, g);
28731                                i.trigger(S.FRAG_PARSING_METADATA, L)
28732                            }
28733                            if (f) {
28734                                var A = o({
28735                                    id: r,
28736                                    frag: l,
28737                                    details: d
28738                                }, f);
28739                                i.trigger(S.FRAG_PARSING_USERDATA, A)
28740                            }
28741                        } else this.fragmentTracker.removeFragment(l)
28742                    } else this.resetWhenMissingContext(a)
28743                }, r._bufferInitSegment = function (t, e, r, i) {
28744                    if (this.state === Ti) {
28745                        e.video && delete e.video;
28746                        var n = e.audio;
28747                        if (n) {
28748                            n.id = "audio";
28749                            var a = t.audioCodec;
28750                            this.log("Init audio buffer, container:" + n.container + ", codecs[level/parsed]=[" + a + "/" + n.codec + "]"), a && 1 === a.split(",").length && (n.levelCodec = a), this.hls.trigger(S.BUFFER_CODECS, e);
28751                            var s = n.initSegment;
28752                            if (null != s && s.byteLength) {
28753                                var o = {
28754                                    type: "audio",
28755                                    frag: r,
28756                                    part: null,
28757                                    chunkMeta: i,
28758                                    parent: r.type,
28759                                    data: s
28760                                };
28761                                this.hls.trigger(S.BUFFER_APPENDING, o)
28762                            }
28763                            this.tickImmediate()
28764                        }
28765                    }
28766                }, r.loadFragment = function (e, r, i) {
28767                    var n, a = this.fragmentTracker.getState(e);
28768                    if (this.fragCurrent = e, this.switchingTrack || a === Vr || a === Wr)
28769                        if ("initSegment" === e.sn) this._loadInitSegment(e, r);
28770                        else if (null != (n = r.details) && n.live && !this.initPTS[e.cc]) {
28771                        this.log("Waiting for video PTS in continuity counter " + e.cc + " of live stream before loading audio fragment " + e.sn + " of level " + this.trackId), this.state = Ri;
28772                        var s = this.mainDetails;
28773                        s && s.fragments[0].start !== r.details.fragments[0].start && ii(r.details, s)
28774                    } else this.startFragRequested = !0, t.prototype.loadFragment.call(this, e, r, i);
28775                    else this.clearTrackerIfNeeded(e)
28776                }, r.flushAudioIfNeeded = function (e) {
28777                    var r = this.media,
28778                        i = this.bufferedTrack,
28779                        n = null == i ? void 0 : i.attrs,
28780                        a = e.attrs;
28781                    r && n && (n.CHANNELS !== a.CHANNELS || i.name !== e.name || i.lang !== e.lang) && (this.log("Switching audio track : flushing all audio"), t.prototype.flushMainBuffer.call(this, 0, Number.POSITIVE_INFINITY, "audio"), this.bufferedTrack = null)
28782                }, r.completeAudioSwitch = function (t) {
28783                    var e = this.hls;
28784                    this.flushAudioIfNeeded(t), this.bufferedTrack = t, this.switchingTrack = null, e.trigger(S.AUDIO_TRACK_SWITCHED, i({}, t))
28785                }, e
28786            }(bi),
28787            jn = function (t) {
28788                function e(e) {
28789                    var r;
28790                    return (r = t.call(this, e, "[audio-track-controller]") || this).tracks = [], r.groupIds = null, r.tracksInGroup = [], r.trackId = -1, r.currentTrack = null, r.selectDefaultTrack = !0, r.registerListeners(), r
28791                }
28792                l(e, t);
28793                var r = e.prototype;
28794                return r.registerListeners = function () {
28795                    var t = this.hls;
28796                    t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.LEVEL_LOADING, this.onLevelLoading, this), t.on(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(S.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.on(S.ERROR, this.onError, this)
28797                }, r.unregisterListeners = function () {
28798                    var t = this.hls;
28799                    t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.LEVEL_LOADING, this.onLevelLoading, this), t.off(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(S.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.off(S.ERROR, this.onError, this)
28800                }, r.destroy = function () {
28801                    this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, this.currentTrack = null, t.prototype.destroy.call(this)
28802                }, r.onManifestLoading = function () {
28803                    this.tracks = [], this.tracksInGroup = [], this.groupIds = null, this.currentTrack = null, this.trackId = -1, this.selectDefaultTrack = !0
28804                }, r.onManifestParsed = function (t, e) {
28805                    this.tracks = e.audioTracks || []
28806                }, r.onAudioTrackLoaded = function (t, e) {
28807                    var r = e.id,
28808                        i = e.groupId,
28809                        n = e.details,
28810                        a = this.tracksInGroup[r];
28811                    if (a && a.groupId === i) {
28812                        var s = a.details;
28813                        a.details = e.details, this.log("Audio track " + r + ' "' + a.name + '" lang:' + a.lang + " group:" + i + " loaded [" + n.startSN + "-" + n.endSN + "]"), r === this.trackId && this.playlistLoaded(r, e, s)
28814                    } else this.warn("Audio track with id:" + r + " and group:" + i + " not found in active group " + (null == a ? void 0 : a.groupId))
28815                }, r.onLevelLoading = function (t, e) {
28816                    this.switchLevel(e.level)
28817                }, r.onLevelSwitching = function (t, e) {
28818                    this.switchLevel(e.level)
28819                }, r.switchLevel = function (t) {
28820                    var e = this.hls.levels[t];
28821                    if (e) {
28822                        var r = e.audioGroups || null,
28823                            i = this.groupIds,
28824                            n = this.currentTrack;
28825                        if (!r || (null == i ? void 0 : i.length) !== (null == r ? void 0 : r.length) || null != r && r.some((function (t) {
28826                                return -1 === (null == i ? void 0 : i.indexOf(t))
28827                            }))) {
28828                            this.groupIds = r, this.trackId = -1, this.currentTrack = null;
28829                            var a = this.tracks.filter((function (t) {
28830                                return !r || -1 !== r.indexOf(t.groupId)
28831                            }));
28832                            if (a.length) this.selectDefaultTrack && !a.some((function (t) {
28833                                return t.default
28834                            })) && (this.selectDefaultTrack = !1), a.forEach((function (t, e) {
28835                                t.id = e
28836                            }));
28837                            else if (!n && !this.tracksInGroup.length) return;
28838                            this.tracksInGroup = a;
28839                            var s = this.hls.config.audioPreference;
28840                            if (!n && s) {
28841                                var o = Nr(s, a, Br);
28842                                if (o > -1) n = a[o];
28843                                else {
28844                                    var l = Nr(s, this.tracks);
28845                                    n = this.tracks[l]
28846                                }
28847                            }
28848                            var u = this.findTrackId(n); - 1 === u && n && (u = this.findTrackId(null));
28849                            var h = {
28850                                audioTracks: a
28851                            };
28852                            this.log("Updating audio tracks, " + a.length + " track(s) found in group(s): " + (null == r ? void 0 : r.join(","))), this.hls.trigger(S.AUDIO_TRACKS_UPDATED, h);
28853                            var d = this.trackId;
28854                            if (-1 !== u && -1 === d) this.setAudioTrack(u);
28855                            else if (a.length && -1 === d) {
28856                                var c, f = new Error("No audio track selected for current audio group-ID(s): " + (null == (c = this.groupIds) ? void 0 : c.join(",")) + " track count: " + a.length);
28857                                this.warn(f.message), this.hls.trigger(S.ERROR, {
28858                                    type: L.MEDIA_ERROR,
28859                                    details: A.AUDIO_TRACK_LOAD_ERROR,
28860                                    fatal: !0,
28861                                    error: f
28862                                })
28863                            }
28864                        } else this.shouldReloadPlaylist(n) && this.setAudioTrack(this.trackId)
28865                    }
28866                }, r.onError = function (t, e) {
28867                    !e.fatal && e.context && (e.context.type !== De || e.context.id !== this.trackId || this.groupIds && -1 === this.groupIds.indexOf(e.context.groupId) || (this.requestScheduled = -1, this.checkRetry(e)))
28868                }, r.setAudioOption = function (t) {
28869                    var e = this.hls;
28870                    if (e.config.audioPreference = t, t) {
28871                        var r = this.allAudioTracks;
28872                        if (this.selectDefaultTrack = !1, r.length) {
28873                            var i = this.currentTrack;
28874                            if (i && Ur(t, i, Br)) return i;
28875                            var n = Nr(t, this.tracksInGroup, Br);
28876                            if (n > -1) {
28877                                var a = this.tracksInGroup[n];
28878                                return this.setAudioTrack(n), a
28879                            }
28880                            if (i) {
28881                                var s = e.loadLevel; - 1 === s && (s = e.firstAutoLevel);
28882                                var o = function (t, e, r, i, n) {
28883                                    var a = e[i],
28884                                        s = e.reduce((function (t, e, r) {
28885                                            var i = e.uri;
28886                                            return (t[i] || (t[i] = [])).push(r), t
28887                                        }), {})[a.uri];
28888                                    s.length > 1 && (i = Math.max.apply(Math, s));
28889                                    var o = a.videoRange,
28890                                        l = a.frameRate,
28891                                        u = a.codecSet.substring(0, 4),
28892                                        h = Gr(e, i, (function (e) {
28893                                            if (e.videoRange !== o || e.frameRate !== l || e.codecSet.substring(0, 4) !== u) return !1;
28894                                            var i = e.audioGroups,
28895                                                a = r.filter((function (t) {
28896                                                    return !i || -1 !== i.indexOf(t.groupId)
28897                                                }));
28898                                            return Nr(t, a, n) > -1
28899                                        }));
28900                                    return h > -1 ? h : Gr(e, i, (function (e) {
28901                                        var i = e.audioGroups,
28902                                            a = r.filter((function (t) {
28903                                                return !i || -1 !== i.indexOf(t.groupId)
28904                                            }));
28905                                        return Nr(t, a, n) > -1
28906                                    }))
28907                                }(t, e.levels, r, s, Br);
28908                                if (-1 === o) return null;
28909                                e.nextLoadLevel = o
28910                            }
28911                            if (t.channels || t.audioCodec) {
28912                                var l = Nr(t, r);
28913                                if (l > -1) return r[l]
28914                            }
28915                        }
28916                    }
28917                    return null
28918                }, r.setAudioTrack = function (t) {
28919                    var e = this.tracksInGroup;
28920                    if (t < 0 || t >= e.length) this.warn("Invalid audio track id: " + t);
28921                    else {
28922                        this.clearTimer(), this.selectDefaultTrack = !1;
28923                        var r = this.currentTrack,
28924                            n = e[t],
28925                            a = n.details && !n.details.live;
28926                        if (!(t === this.trackId && n === r && a || (this.log("Switching to audio-track " + t + ' "' + n.name + '" lang:' + n.lang + " group:" + n.groupId + " channels:" + n.channels), this.trackId = t, this.currentTrack = n, this.hls.trigger(S.AUDIO_TRACK_SWITCHING, i({}, n)), a))) {
28927                            var s = this.switchParams(n.url, null == r ? void 0 : r.details, n.details);
28928                            this.loadPlaylist(s)
28929                        }
28930                    }
28931                }, r.findTrackId = function (t) {
28932                    for (var e = this.tracksInGroup, r = 0; r < e.length; r++) {
28933                        var i = e[r];
28934                        if ((!this.selectDefaultTrack || i.default) && (!t || Ur(t, i, Br))) return r
28935                    }
28936                    if (t) {
28937                        for (var n = t.name, a = t.lang, s = t.assocLang, o = t.characteristics, l = t.audioCodec, u = t.channels, h = 0; h < e.length; h++)
28938                            if (Ur({
28939                                    name: n,
28940                                    lang: a,
28941                                    assocLang: s,
28942                                    characteristics: o,
28943                                    audioCodec: l,
28944                                    channels: u
28945                                }, e[h], Br)) return h;
28946                        for (var d = 0; d < e.length; d++) {
28947                            var c = e[d];
28948                            if (Vn(t.attrs, c.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"])) return d
28949                        }
28950                        for (var f = 0; f < e.length; f++) {
28951                            var g = e[f];
28952                            if (Vn(t.attrs, g.attrs, ["LANGUAGE"])) return f
28953                        }
28954                    }
28955                    return -1
28956                }, r.loadPlaylist = function (e) {
28957                    var r = this.currentTrack;
28958                    if (this.shouldLoadPlaylist(r) && r) {
28959                        t.prototype.loadPlaylist.call(this);
28960                        var i = r.id,
28961                            n = r.groupId,
28962                            a = r.url;
28963                        if (e) try {
28964                            a = e.addDirectives(a)
28965                        } catch (t) {
28966                            this.warn("Could not construct new URL with HLS Delivery Directives: " + t)
28967                        }
28968                        this.log("loading audio-track playlist " + i + ' "' + r.name + '" lang:' + r.lang + " group:" + n), this.clearTimer(), this.hls.trigger(S.AUDIO_TRACK_LOADING, {
28969                            url: a,
28970                            id: i,
28971                            groupId: n,
28972                            deliveryDirectives: e || null
28973                        })
28974                    }
28975                }, s(e, [{
28976                    key: "allAudioTracks",
28977                    get: function () {
28978                        return this.tracks
28979                    }
28980                }, {
28981                    key: "audioTracks",
28982                    get: function () {
28983                        return this.tracksInGroup
28984                    }
28985                }, {
28986                    key: "audioTrack",
28987                    get: function () {
28988                        return this.trackId
28989                    },
28990                    set: function (t) {
28991                        this.selectDefaultTrack = !1, this.setAudioTrack(t)
28992                    }
28993                }]), e
28994            }(wr),
28995            qn = function (t) {
28996                function e(e, r, i) {
28997                    var n;
28998                    return (n = t.call(this, e, r, i, "[subtitle-stream-controller]", _e) || this).currentTrackId = -1, n.tracksBuffered = [], n.mainDetails = null, n._registerListeners(), n
28999                }
29000                l(e, t);
29001                var r = e.prototype;
29002                return r.onHandlerDestroying = function () {
29003                    this._unregisterListeners(), t.prototype.onHandlerDestroying.call(this), this.mainDetails = null
29004                }, r._registerListeners = function () {
29005                    var t = this.hls;
29006                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.LEVEL_LOADED, this.onLevelLoaded, this), t.on(S.ERROR, this.onError, this), t.on(S.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.on(S.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), t.on(S.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.on(S.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), t.on(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this)
29007                }, r._unregisterListeners = function () {
29008                    var t = this.hls;
29009                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.LEVEL_LOADED, this.onLevelLoaded, this), t.off(S.ERROR, this.onError, this), t.off(S.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.off(S.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), t.off(S.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.off(S.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), t.off(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this)
29010                }, r.startLoad = function (t) {
29011                    this.stopLoad(), this.state = vi, this.setInterval(500), this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t, this.tick()
29012                }, r.onManifestLoading = function () {
29013                    this.mainDetails = null, this.fragmentTracker.removeAllFragments()
29014                }, r.onMediaDetaching = function () {
29015                    this.tracksBuffered = [], t.prototype.onMediaDetaching.call(this)
29016                }, r.onLevelLoaded = function (t, e) {
29017                    this.mainDetails = e.details
29018                }, r.onSubtitleFragProcessed = function (t, e) {
29019                    var r = e.frag,
29020                        i = e.success;
29021                    if (this.fragPrevious = r, this.state = vi, i) {
29022                        var n = this.tracksBuffered[this.currentTrackId];
29023                        if (n) {
29024                            for (var a, s = r.start, o = 0; o < n.length; o++)
29025                                if (s >= n[o].start && s <= n[o].end) {
29026                                    a = n[o];
29027                                    break
29028                                } var l = r.start + r.duration;
29029                            a ? a.end = l : (a = {
29030                                start: s,
29031                                end: l
29032                            }, n.push(a)), this.fragmentTracker.fragBuffered(r), this.fragBufferedComplete(r, null)
29033                        }
29034                    }
29035                }, r.onBufferFlushing = function (t, e) {
29036                    var r = e.startOffset,
29037                        i = e.endOffset;
29038                    if (0 === r && i !== Number.POSITIVE_INFINITY) {
29039                        var n = i - 1;
29040                        if (n <= 0) return;
29041                        e.endOffsetSubtitles = Math.max(0, n), this.tracksBuffered.forEach((function (t) {
29042                            for (var e = 0; e < t.length;)
29043                                if (t[e].end <= n) t.shift();
29044                                else {
29045                                    if (!(t[e].start < n)) break;
29046                                    t[e].start = n, e++
29047                                }
29048                        })), this.fragmentTracker.removeFragmentsInRange(r, n, _e)
29049                    }
29050                }, r.onFragBuffered = function (t, e) {
29051                    var r;
29052                    this.loadedmetadata || e.frag.type !== we || null != (r = this.media) && r.buffered.length && (this.loadedmetadata = !0)
29053                }, r.onError = function (t, e) {
29054                    var r = e.frag;
29055                    (null == r ? void 0 : r.type) === _e && (this.fragCurrent && this.fragCurrent.abortRequests(), this.state !== gi && (this.state = vi))
29056                }, r.onSubtitleTracksUpdated = function (t, e) {
29057                    var r = this,
29058                        i = e.subtitleTracks;
29059                    this.levels && Hn(this.levels, i) ? this.levels = i.map((function (t) {
29060                        return new rr(t)
29061                    })) : (this.tracksBuffered = [], this.levels = i.map((function (t) {
29062                        var e = new rr(t);
29063                        return r.tracksBuffered[e.id] = [], e
29064                    })), this.fragmentTracker.removeFragmentsInRange(0, Number.POSITIVE_INFINITY, _e), this.fragPrevious = null, this.mediaBuffer = null)
29065                }, r.onSubtitleTrackSwitch = function (t, e) {
29066                    var r;
29067                    if (this.currentTrackId = e.id, null != (r = this.levels) && r.length && -1 !== this.currentTrackId) {
29068                        var i = this.levels[this.currentTrackId];
29069                        null != i && i.details ? this.mediaBuffer = this.mediaBufferTimeRanges : this.mediaBuffer = null, i && this.setInterval(500)
29070                    } else this.clearInterval()
29071                }, r.onSubtitleTrackLoaded = function (t, e) {
29072                    var r, i = this.currentTrackId,
29073                        n = this.levels,
29074                        a = e.details,
29075                        s = e.id;
29076                    if (n) {
29077                        var o = n[s];
29078                        if (!(s >= n.length) && o) {
29079                            this.log("Subtitle track " + s + " loaded [" + a.startSN + "," + a.endSN + "]" + (a.lastPartSn ? "[part-" + a.lastPartSn + "-" + a.lastPartIndex + "]" : "") + ",duration:" + a.totalduration), this.mediaBuffer = this.mediaBufferTimeRanges;
29080                            var l = 0;
29081                            if (a.live || null != (r = o.details) && r.live) {
29082                                var u = this.mainDetails;
29083                                if (a.deltaUpdateFailed || !u) return;
29084                                var h, d = u.fragments[0];
29085                                o.details ? 0 === (l = this.alignPlaylists(a, o.details, null == (h = this.levelLastLoaded) ? void 0 : h.details)) && d && lr(a, l = d.start) : a.hasProgramDateTime && u.hasProgramDateTime ? (ii(a, u), l = a.fragments[0].start) : d && lr(a, l = d.start)
29086                            }
29087                            o.details = a, this.levelLastLoaded = o, s === i && (this.startFragRequested || !this.mainDetails && a.live || this.setStartPosition(this.mainDetails || a, l), this.tick(), a.live && !this.fragCurrent && this.media && this.state === vi && (yr(null, a.fragments, this.media.currentTime, 0) || (this.warn("Subtitle playlist not aligned with playback"), o.details = void 0)))
29088                        }
29089                    } else this.warn("Subtitle tracks were reset while loading level " + s)
29090                }, r._handleFragmentLoadComplete = function (t) {
29091                    var e = this,
29092                        r = t.frag,
29093                        i = t.payload,
29094                        n = r.decryptdata,
29095                        a = this.hls;
29096                    if (!this.fragContextChanged(r) && i && i.byteLength > 0 && null != n && n.key && n.iv && "AES-128" === n.method) {
29097                        var s = performance.now();
29098                        this.decrypter.decrypt(new Uint8Array(i), n.key.buffer, n.iv.buffer).catch((function (t) {
29099                            throw a.trigger(S.ERROR, {
29100                                type: L.MEDIA_ERROR,
29101                                details: A.FRAG_DECRYPT_ERROR,
29102                                fatal: !1,
29103                                error: t,
29104                                reason: t.message,
29105                                frag: r
29106                            }), t
29107                        })).then((function (t) {
29108                            var e = performance.now();
29109                            a.trigger(S.FRAG_DECRYPTED, {
29110                                frag: r,
29111                                payload: t,
29112                                stats: {
29113                                    tstart: s,
29114                                    tdecrypt: e
29115                                }
29116                            })
29117                        })).catch((function (t) {
29118                            e.warn(t.name + ": " + t.message), e.state = vi
29119                        }))
29120                    }
29121                }, r.doTick = function () {
29122                    if (this.media) {
29123                        if (this.state === vi) {
29124                            var t = this.currentTrackId,
29125                                e = this.levels,
29126                                r = null == e ? void 0 : e[t];
29127                            if (!r || !e.length || !r.details) return;
29128                            var i = this.config,
29129                                n = this.getLoadPosition(),
29130                                a = Jr.bufferedInfo(this.tracksBuffered[this.currentTrackId] || [], n, i.maxBufferHole),
29131                                s = a.end,
29132                                o = a.len,
29133                                l = this.getFwdBufferInfo(this.media, we),
29134                                u = r.details;
29135                            if (o > this.getMaxBufferLength(null == l ? void 0 : l.len) + u.levelTargetDuration) return;
29136                            var h = u.fragments,
29137                                d = h.length,
29138                                c = u.edge,
29139                                f = null,
29140                                g = this.fragPrevious;
29141                            if (s < c) {
29142                                var v = i.maxFragLookUpTolerance,
29143                                    m = s > c - v ? 0 : v;
29144                                !(f = yr(g, h, Math.max(h[0].start, s), m)) && g && g.start < h[0].start && (f = h[0])
29145                            } else f = h[d - 1];
29146                            if (!f) return;
29147                            if ("initSegment" !== (f = this.mapToInitFragWhenRequired(f)).sn) {
29148                                var p = h[f.sn - u.startSN - 1];
29149                                p && p.cc === f.cc && this.fragmentTracker.getState(p) === Vr && (f = p)
29150                            }
29151                            this.fragmentTracker.getState(f) === Vr && this.loadFragment(f, r, s)
29152                        }
29153                    } else this.state = vi
29154                }, r.getMaxBufferLength = function (e) {
29155                    var r = t.prototype.getMaxBufferLength.call(this);
29156                    return e ? Math.max(r, e) : r
29157                }, r.loadFragment = function (e, r, i) {
29158                    this.fragCurrent = e, "initSegment" === e.sn ? this._loadInitSegment(e, r) : (this.startFragRequested = !0, t.prototype.loadFragment.call(this, e, r, i))
29159                }, s(e, [{
29160                    key: "mediaBufferTimeRanges",
29161                    get: function () {
29162                        return new Xn(this.tracksBuffered[this.currentTrackId] || [])
29163                    }
29164                }]), e
29165            }(bi),
29166            Xn = function (t) {
29167                this.buffered = void 0;
29168                var e = function (e, r, i) {
29169                    if ((r >>>= 0) > i - 1) throw new DOMException("Failed to execute '" + e + "' on 'TimeRanges': The index provided (" + r + ") is greater than the maximum bound (" + i + ")");
29170                    return t[r][e]
29171                };
29172                this.buffered = {
29173                    get length() {
29174                        return t.length
29175                    },
29176                    end: function (r) {
29177                        return e("end", r, t.length)
29178                    },
29179                    start: function (r) {
29180                        return e("start", r, t.length)
29181                    }
29182                }
29183            },
29184            zn = function (t) {
29185                function e(e) {
29186                    var r;
29187                    return (r = t.call(this, e, "[subtitle-track-controller]") || this).media = null, r.tracks = [], r.groupIds = null, r.tracksInGroup = [], r.trackId = -1, r.currentTrack = null, r.selectDefaultTrack = !0, r.queuedDefaultTrack = -1, r.asyncPollTrackChange = function () {
29188                        return r.pollTrackChange(0)
29189                    }, r.useTextTrackPolling = !1, r.subtitlePollingInterval = -1, r._subtitleDisplay = !0, r.onTextTracksChanged = function () {
29190                        if (r.useTextTrackPolling || self.clearInterval(r.subtitlePollingInterval), r.media && r.hls.config.renderTextTracksNatively) {
29191                            for (var t = null, e = Be(r.media.textTracks), i = 0; i < e.length; i++)
29192                                if ("hidden" === e[i].mode) t = e[i];
29193                                else if ("showing" === e[i].mode) {
29194                                t = e[i];
29195                                break
29196                            }
29197                            var n = r.findTrackForTextTrack(t);
29198                            r.subtitleTrack !== n && r.setSubtitleTrack(n)
29199                        }
29200                    }, r.registerListeners(), r
29201                }
29202                l(e, t);
29203                var r = e.prototype;
29204                return r.destroy = function () {
29205                    this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, this.currentTrack = null, this.onTextTracksChanged = this.asyncPollTrackChange = null, t.prototype.destroy.call(this)
29206                }, r.registerListeners = function () {
29207                    var t = this.hls;
29208                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.LEVEL_LOADING, this.onLevelLoading, this), t.on(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(S.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.on(S.ERROR, this.onError, this)
29209                }, r.unregisterListeners = function () {
29210                    var t = this.hls;
29211                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.LEVEL_LOADING, this.onLevelLoading, this), t.off(S.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(S.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.off(S.ERROR, this.onError, this)
29212                }, r.onMediaAttached = function (t, e) {
29213                    this.media = e.media, this.media && (this.queuedDefaultTrack > -1 && (this.subtitleTrack = this.queuedDefaultTrack, this.queuedDefaultTrack = -1), this.useTextTrackPolling = !(this.media.textTracks && "onchange" in this.media.textTracks), this.useTextTrackPolling ? this.pollTrackChange(500) : this.media.textTracks.addEventListener("change", this.asyncPollTrackChange))
29214                }, r.pollTrackChange = function (t) {
29215                    self.clearInterval(this.subtitlePollingInterval), this.subtitlePollingInterval = self.setInterval(this.onTextTracksChanged, t)
29216                }, r.onMediaDetaching = function () {
29217                    this.media && (self.clearInterval(this.subtitlePollingInterval), this.useTextTrackPolling || this.media.textTracks.removeEventListener("change", this.asyncPollTrackChange), this.trackId > -1 && (this.queuedDefaultTrack = this.trackId), Be(this.media.textTracks).forEach((function (t) {
29218                        Ne(t)
29219                    })), this.subtitleTrack = -1, this.media = null)
29220                }, r.onManifestLoading = function () {
29221                    this.tracks = [], this.groupIds = null, this.tracksInGroup = [], this.trackId = -1, this.currentTrack = null, this.selectDefaultTrack = !0
29222                }, r.onManifestParsed = function (t, e) {
29223                    this.tracks = e.subtitleTracks
29224                }, r.onSubtitleTrackLoaded = function (t, e) {
29225                    var r = e.id,
29226                        i = e.groupId,
29227                        n = e.details,
29228                        a = this.tracksInGroup[r];
29229                    if (a && a.groupId === i) {
29230                        var s = a.details;
29231                        a.details = e.details, this.log("Subtitle track " + r + ' "' + a.name + '" lang:' + a.lang + " group:" + i + " loaded [" + n.startSN + "-" + n.endSN + "]"), r === this.trackId && this.playlistLoaded(r, e, s)
29232                    } else this.warn("Subtitle track with id:" + r + " and group:" + i + " not found in active group " + (null == a ? void 0 : a.groupId))
29233                }, r.onLevelLoading = function (t, e) {
29234                    this.switchLevel(e.level)
29235                }, r.onLevelSwitching = function (t, e) {
29236                    this.switchLevel(e.level)
29237                }, r.switchLevel = function (t) {
29238                    var e = this.hls.levels[t];
29239                    if (e) {
29240                        var r = e.subtitleGroups || null,
29241                            i = this.groupIds,
29242                            n = this.currentTrack;
29243                        if (!r || (null == i ? void 0 : i.length) !== (null == r ? void 0 : r.length) || null != r && r.some((function (t) {
29244                                return -1 === (null == i ? void 0 : i.indexOf(t))
29245                            }))) {
29246                            this.groupIds = r, this.trackId = -1, this.currentTrack = null;
29247                            var a = this.tracks.filter((function (t) {
29248                                return !r || -1 !== r.indexOf(t.groupId)
29249                            }));
29250                            if (a.length) this.selectDefaultTrack && !a.some((function (t) {
29251                                return t.default
29252                            })) && (this.selectDefaultTrack = !1), a.forEach((function (t, e) {
29253                                t.id = e
29254                            }));
29255                            else if (!n && !this.tracksInGroup.length) return;
29256                            this.tracksInGroup = a;
29257                            var s = this.hls.config.subtitlePreference;
29258                            if (!n && s) {
29259                                this.selectDefaultTrack = !1;
29260                                var o = Nr(s, a);
29261                                if (o > -1) n = a[o];
29262                                else {
29263                                    var l = Nr(s, this.tracks);
29264                                    n = this.tracks[l]
29265                                }
29266                            }
29267                            var u = this.findTrackId(n); - 1 === u && n && (u = this.findTrackId(null));
29268                            var h = {
29269                                subtitleTracks: a
29270                            };
29271                            this.log("Updating subtitle tracks, " + a.length + ' track(s) found in "' + (null == r ? void 0 : r.join(",")) + '" group-id'), this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED, h), -1 !== u && -1 === this.trackId && this.setSubtitleTrack(u)
29272                        } else this.shouldReloadPlaylist(n) && this.setSubtitleTrack(this.trackId)
29273                    }
29274                }, r.findTrackId = function (t) {
29275                    for (var e = this.tracksInGroup, r = this.selectDefaultTrack, i = 0; i < e.length; i++) {
29276                        var n = e[i];
29277                        if ((!r || n.default) && (r || t) && (!t || Ur(n, t))) return i
29278                    }
29279                    if (t) {
29280                        for (var a = 0; a < e.length; a++) {
29281                            var s = e[a];
29282                            if (Vn(t.attrs, s.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"])) return a
29283                        }
29284                        for (var o = 0; o < e.length; o++) {
29285                            var l = e[o];
29286                            if (Vn(t.attrs, l.attrs, ["LANGUAGE"])) return o
29287                        }
29288                    }
29289                    return -1
29290                }, r.findTrackForTextTrack = function (t) {
29291                    if (t)
29292                        for (var e = this.tracksInGroup, r = 0; r < e.length; r++)
29293                            if (Yn(e[r], t)) return r;
29294                    return -1
29295                }, r.onError = function (t, e) {
29296                    !e.fatal && e.context && (e.context.type !== Ie || e.context.id !== this.trackId || this.groupIds && -1 === this.groupIds.indexOf(e.context.groupId) || this.checkRetry(e))
29297                }, r.setSubtitleOption = function (t) {
29298                    if (this.hls.config.subtitlePreference = t, t) {
29299                        var e = this.allSubtitleTracks;
29300                        if (this.selectDefaultTrack = !1, e.length) {
29301                            var r = this.currentTrack;
29302                            if (r && Ur(t, r)) return r;
29303                            var i = Nr(t, this.tracksInGroup);
29304                            if (i > -1) {
29305                                var n = this.tracksInGroup[i];
29306                                return this.setSubtitleTrack(i), n
29307                            }
29308                            if (r) return null;
29309                            var a = Nr(t, e);
29310                            if (a > -1) return e[a]
29311                        }
29312                    }
29313                    return null
29314                }, r.loadPlaylist = function (e) {
29315                    t.prototype.loadPlaylist.call(this);
29316                    var r = this.currentTrack;
29317                    if (this.shouldLoadPlaylist(r) && r) {
29318                        var i = r.id,
29319                            n = r.groupId,
29320                            a = r.url;
29321                        if (e) try {
29322                            a = e.addDirectives(a)
29323                        } catch (t) {
29324                            this.warn("Could not construct new URL with HLS Delivery Directives: " + t)
29325                        }
29326                        this.log("Loading subtitle playlist for id " + i), this.hls.trigger(S.SUBTITLE_TRACK_LOADING, {
29327                            url: a,
29328                            id: i,
29329                            groupId: n,
29330                            deliveryDirectives: e || null
29331                        })
29332                    }
29333                }, r.toggleTrackModes = function () {
29334                    var t = this.media;
29335                    if (t) {
29336                        var e, r = Be(t.textTracks),
29337                            i = this.currentTrack;
29338                        if (i && ((e = r.filter((function (t) {
29339                                return Yn(i, t)
29340                            }))[0]) || this.warn('Unable to find subtitle TextTrack with name "' + i.name + '" and language "' + i.lang + '"')), [].slice.call(r).forEach((function (t) {
29341                                "disabled" !== t.mode && t !== e && (t.mode = "disabled")
29342                            })), e) {
29343                            var n = this.subtitleDisplay ? "showing" : "hidden";
29344                            e.mode !== n && (e.mode = n)
29345                        }
29346                    }
29347                }, r.setSubtitleTrack = function (t) {
29348                    var e = this.tracksInGroup;
29349                    if (this.media)
29350                        if (t < -1 || t >= e.length || !y(t)) this.warn("Invalid subtitle track id: " + t);
29351                        else {
29352                            this.clearTimer(), this.selectDefaultTrack = !1;
29353                            var r = this.currentTrack,
29354                                i = e[t] || null;
29355                            if (this.trackId = t, this.currentTrack = i, this.toggleTrackModes(), i) {
29356                                var n = !!i.details && !i.details.live;
29357                                if (t !== this.trackId || i !== r || !n) {
29358                                    this.log("Switching to subtitle-track " + t + (i ? ' "' + i.name + '" lang:' + i.lang + " group:" + i.groupId : ""));
29359                                    var a = i.id,
29360                                        s = i.groupId,
29361                                        o = void 0 === s ? "" : s,
29362                                        l = i.name,
29363                                        u = i.type,
29364                                        h = i.url;
29365                                    this.hls.trigger(S.SUBTITLE_TRACK_SWITCH, {
29366                                        id: a,
29367                                        groupId: o,
29368                                        name: l,
29369                                        type: u,
29370                                        url: h
29371                                    });
29372                                    var d = this.switchParams(i.url, null == r ? void 0 : r.details, i.details);
29373                                    this.loadPlaylist(d)
29374                                }
29375                            } else this.hls.trigger(S.SUBTITLE_TRACK_SWITCH, {
29376                                id: t
29377                            })
29378                        }
29379                    else this.queuedDefaultTrack = t
29380                }, s(e, [{
29381                    key: "subtitleDisplay",
29382                    get: function () {
29383                        return this._subtitleDisplay
29384                    },
29385                    set: function (t) {
29386                        this._subtitleDisplay = t, this.trackId > -1 && this.toggleTrackModes()
29387                    }
29388                }, {
29389                    key: "allSubtitleTracks",
29390                    get: function () {
29391                        return this.tracks
29392                    }
29393                }, {
29394                    key: "subtitleTracks",
29395                    get: function () {
29396                        return this.tracksInGroup
29397                    }
29398                }, {
29399                    key: "subtitleTrack",
29400                    get: function () {
29401                        return this.trackId
29402                    },
29403                    set: function (t) {
29404                        this.selectDefaultTrack = !1, this.setSubtitleTrack(t)
29405                    }
29406                }]), e
29407            }(wr),
29408            Qn = function () {
29409                function t(t) {
29410                    this.buffers = void 0, this.queues = {
29411                        video: [],
29412                        audio: [],
29413                        audiovideo: []
29414                    }, this.buffers = t
29415                }
29416                var e = t.prototype;
29417                return e.append = function (t, e, r) {
29418                    var i = this.queues[e];
29419                    i.push(t), 1 !== i.length || r || this.executeNext(e)
29420                }, e.insertAbort = function (t, e) {
29421                    this.queues[e].unshift(t), this.executeNext(e)
29422                }, e.appendBlocker = function (t) {
29423                    var e, r = new Promise((function (t) {
29424                            e = t
29425                        })),
29426                        i = {
29427                            execute: e,
29428                            onStart: function () {},
29429                            onComplete: function () {},
29430                            onError: function () {}
29431                        };
29432                    return this.append(i, t), r
29433                }, e.executeNext = function (t) {
29434                    var e = this.queues[t];
29435                    if (e.length) {
29436                        var r = e[0];
vendor: 4,338 bytes, lines 29437-29491
29437                        try {
29438                            r.execute()
29439                        } catch (e) {
29440                            w.warn('[buffer-operation-queue]: Exception executing "' + t + '" SourceBuffer operation: ' + e), r.onError(e);
29441                            var i = this.buffers[t];
29442                            null != i && i.updating || this.shiftAndExecuteNext(t)
29443                        }
29444                    }
29445                }, e.shiftAndExecuteNext = function (t) {
29446                    this.queues[t].shift(), this.executeNext(t)
29447                }, e.current = function (t) {
29448                    return this.queues[t][0]
29449                }, t
29450            }(),
29451            Jn = /(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,
29452            $n = function () {
29453                function t(t) {
29454                    var e = this;
29455                    this.details = null, this._objectUrl = null, this.operationQueue = void 0, this.listeners = void 0, this.hls = void 0, this.bufferCodecEventsExpected = 0, this._bufferCodecEventsTotal = 0, this.media = null, this.mediaSource = null, this.lastMpegAudioChunk = null, this.appendSource = void 0, this.appendErrors = {
29456                        audio: 0,
29457                        video: 0,
29458                        audiovideo: 0
29459                    }, this.tracks = {}, this.pendingTracks = {}, this.sourceBuffer = void 0, this.log = void 0, this.warn = void 0, this.error = void 0, this._onEndStreaming = function (t) {
29460                        e.hls && e.hls.pauseBuffering()
29461                    }, this._onStartStreaming = function (t) {
29462                        e.hls && e.hls.resumeBuffering()
29463                    }, this._onMediaSourceOpen = function () {
29464                        var t = e.media,
29465                            r = e.mediaSource;
29466                        e.log("Media source opened"), t && (t.removeEventListener("emptied", e._onMediaEmptied), e.updateMediaElementDuration(), e.hls.trigger(S.MEDIA_ATTACHED, {
29467                            media: t,
29468                            mediaSource: r
29469                        })), r && r.removeEventListener("sourceopen", e._onMediaSourceOpen), e.checkPendingTracks()
29470                    }, this._onMediaSourceClose = function () {
29471                        e.log("Media source closed")
29472                    }, this._onMediaSourceEnded = function () {
29473                        e.log("Media source ended")
29474                    }, this._onMediaEmptied = function () {
29475                        var t = e.mediaSrc,
29476                            r = e._objectUrl;
29477                        t !== r && w.error("Media element src was set while attaching MediaSource (" + r + " > " + t + ")")
29478                    }, this.hls = t;
29479                    var r, i = "[buffer-controller]";
29480                    this.appendSource = (r = ee(t.config.preferManagedMediaSource), "undefined" != typeof self && r === self.ManagedMediaSource), this.log = w.log.bind(w, i), this.warn = w.warn.bind(w, i), this.error = w.error.bind(w, i), this._initSourceBuffer(), this.registerListeners()
29481                }
29482                var e = t.prototype;
29483                return e.hasSourceTypes = function () {
29484                    return this.getSourceBufferTypes().length > 0 || Object.keys(this.pendingTracks).length > 0
29485                }, e.destroy = function () {
29486                    this.unregisterListeners(), this.details = null, this.lastMpegAudioChunk = null, this.hls = null
29487                }, e.registerListeners = function () {
29488                    var t = this.hls;
29489                    t.on(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.BUFFER_RESET, this.onBufferReset, this), t.on(S.BUFFER_APPENDING, this.onBufferAppending, this), t.on(S.BUFFER_CODECS, this.onBufferCodecs, this), t.on(S.BUFFER_EOS, this.onBufferEos, this), t.on(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(S.LEVEL_UPDATED, this.onLevelUpdated, this), t.on(S.FRAG_PARSED, this.onFragParsed, this), t.on(S.FRAG_CHANGED, this.onFragChanged, this)
29490                }, e.unregisterListeners = function () {
29491                    var t = this.hls;
vendor: 4,678 bytes, lines 29492-29542
29492                    t.off(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.BUFFER_RESET, this.onBufferReset, this), t.off(S.BUFFER_APPENDING, this.onBufferAppending, this), t.off(S.BUFFER_CODECS, this.onBufferCodecs, this), t.off(S.BUFFER_EOS, this.onBufferEos, this), t.off(S.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(S.LEVEL_UPDATED, this.onLevelUpdated, this), t.off(S.FRAG_PARSED, this.onFragParsed, this), t.off(S.FRAG_CHANGED, this.onFragChanged, this)
29493                }, e._initSourceBuffer = function () {
29494                    this.sourceBuffer = {}, this.operationQueue = new Qn(this.sourceBuffer), this.listeners = {
29495                        audio: [],
29496                        video: [],
29497                        audiovideo: []
29498                    }, this.appendErrors = {
29499                        audio: 0,
29500                        video: 0,
29501                        audiovideo: 0
29502                    }, this.lastMpegAudioChunk = null
29503                }, e.onManifestLoading = function () {
29504                    this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = 0, this.details = null
29505                }, e.onManifestParsed = function (t, e) {
29506                    var r = 2;
29507                    (e.audio && !e.video || !e.altAudio) && (r = 1), this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = r, this.log(this.bufferCodecEventsExpected + " bufferCodec event(s) expected")
29508                }, e.onMediaAttaching = function (t, e) {
29509                    var r = this.media = e.media,
29510                        i = ee(this.appendSource);
29511                    if (r && i) {
29512                        var n, a = this.mediaSource = new i;
29513                        this.log("created media source: " + (null == (n = a.constructor) ? void 0 : n.name)), a.addEventListener("sourceopen", this._onMediaSourceOpen), a.addEventListener("sourceended", this._onMediaSourceEnded), a.addEventListener("sourceclose", this._onMediaSourceClose), this.appendSource && (a.addEventListener("startstreaming", this._onStartStreaming), a.addEventListener("endstreaming", this._onEndStreaming));
29514                        var s = this._objectUrl = self.URL.createObjectURL(a);
29515                        if (this.appendSource) try {
29516                            r.removeAttribute("src");
29517                            var o = self.ManagedMediaSource;
29518                            r.disableRemotePlayback = r.disableRemotePlayback || o && a instanceof o, Zn(r),
29519                                function (t, e) {
29520                                    var r = self.document.createElement("source");
29521                                    r.type = "video/mp4", r.src = e, t.appendChild(r)
29522                                }(r, s), r.load()
29523                        } catch (t) {
29524                            r.src = s
29525                        } else r.src = s;
29526                        r.addEventListener("emptied", this._onMediaEmptied)
29527                    }
29528                }, e.onMediaDetaching = function () {
29529                    var t = this.media,
29530                        e = this.mediaSource,
29531                        r = this._objectUrl;
29532                    if (e) {
29533                        if (this.log("media source detaching"), "open" === e.readyState) try {
29534                            e.endOfStream()
29535                        } catch (t) {
29536                            this.warn("onMediaDetaching: " + t.message + " while calling endOfStream")
29537                        }
29538                        this.onBufferReset(), e.removeEventListener("sourceopen", this._onMediaSourceOpen), e.removeEventListener("sourceended", this._onMediaSourceEnded), e.removeEventListener("sourceclose", this._onMediaSourceClose), this.appendSource && (e.removeEventListener("startstreaming", this._onStartStreaming), e.removeEventListener("endstreaming", this._onEndStreaming)), t && (t.removeEventListener("emptied", this._onMediaEmptied), r && self.URL.revokeObjectURL(r), this.mediaSrc === r ? (t.removeAttribute("src"), this.appendSource && Zn(t), t.load()) : this.warn("media|source.src was changed by a third party - skip cleanup")), this.mediaSource = null, this.media = null, this._objectUrl = null, this.bufferCodecEventsExpected = this._bufferCodecEventsTotal, this.pendingTracks = {}, this.tracks = {}
29539                    }
29540                    this.hls.trigger(S.MEDIA_DETACHED, void 0)
29541                }, e.onBufferReset = function () {
29542                    var t = this;
vendor: 22,579 bytes, lines 29543-29913
29543                    this.getSourceBufferTypes().forEach((function (e) {
29544                        t.resetBuffer(e)
29545                    })), this._initSourceBuffer()
29546                }, e.resetBuffer = function (t) {
29547                    var e = this.sourceBuffer[t];
29548                    try {
29549                        var r;
29550                        e && (this.removeBufferListeners(t), this.sourceBuffer[t] = void 0, null != (r = this.mediaSource) && r.sourceBuffers.length && this.mediaSource.removeSourceBuffer(e))
29551                    } catch (e) {
29552                        this.warn("onBufferReset " + t, e)
29553                    }
29554                }, e.onBufferCodecs = function (t, e) {
29555                    var r = this,
29556                        i = this.getSourceBufferTypes().length,
29557                        n = Object.keys(e);
29558                    if (n.forEach((function (t) {
29559                            if (i) {
29560                                var n = r.tracks[t];
29561                                if (n && "function" == typeof n.buffer.changeType) {
29562                                    var a, s = e[t],
29563                                        o = s.id,
29564                                        l = s.codec,
29565                                        u = s.levelCodec,
29566                                        h = s.container,
29567                                        d = s.metadata,
29568                                        c = de(n.codec, n.levelCodec),
29569                                        f = null == c ? void 0 : c.replace(Jn, "$1"),
29570                                        g = de(l, u),
29571                                        v = null == (a = g) ? void 0 : a.replace(Jn, "$1");
29572                                    if (g && f !== v) {
29573                                        "audio" === t.slice(0, 5) && (g = he(g, r.appendSource));
29574                                        var m = h + ";codecs=" + g;
29575                                        r.appendChangeType(t, m), r.log("switching codec " + c + " to " + g), r.tracks[t] = {
29576                                            buffer: n.buffer,
29577                                            codec: l,
29578                                            container: h,
29579                                            levelCodec: u,
29580                                            metadata: d,
29581                                            id: o
29582                                        }
29583                                    }
29584                                }
29585                            } else r.pendingTracks[t] = e[t]
29586                        })), !i) {
29587                        var a = Math.max(this.bufferCodecEventsExpected - 1, 0);
29588                        this.bufferCodecEventsExpected !== a && (this.log(a + " bufferCodec event(s) expected " + n.join(",")), this.bufferCodecEventsExpected = a), this.mediaSource && "open" === this.mediaSource.readyState && this.checkPendingTracks()
29589                    }
29590                }, e.appendChangeType = function (t, e) {
29591                    var r = this,
29592                        i = this.operationQueue,
29593                        n = {
29594                            execute: function () {
29595                                var n = r.sourceBuffer[t];
29596                                n && (r.log("changing " + t + " sourceBuffer type to " + e), n.changeType(e)), i.shiftAndExecuteNext(t)
29597                            },
29598                            onStart: function () {},
29599                            onComplete: function () {},
29600                            onError: function (e) {
29601                                r.warn("Failed to change " + t + " SourceBuffer type", e)
29602                            }
29603                        };
29604                    i.append(n, t, !!this.pendingTracks[t])
29605                }, e.onBufferAppending = function (t, e) {
29606                    var r = this,
29607                        i = this.hls,
29608                        n = this.operationQueue,
29609                        a = this.tracks,
29610                        s = e.data,
29611                        o = e.type,
29612                        l = e.frag,
29613                        u = e.part,
29614                        h = e.chunkMeta,
29615                        d = h.buffering[o],
29616                        c = self.performance.now();
29617                    d.start = c;
29618                    var f = l.stats.buffering,
29619                        g = u ? u.stats.buffering : null;
29620                    0 === f.start && (f.start = c), g && 0 === g.start && (g.start = c);
29621                    var v = a.audio,
29622                        m = !1;
29623                    "audio" === o && "audio/mpeg" === (null == v ? void 0 : v.container) && (m = !this.lastMpegAudioChunk || 1 === h.id || this.lastMpegAudioChunk.sn !== h.sn, this.lastMpegAudioChunk = h);
29624                    var p = l.start,
29625                        y = {
29626                            execute: function () {
29627                                if (d.executeStart = self.performance.now(), m) {
29628                                    var t = r.sourceBuffer[o];
29629                                    if (t) {
29630                                        var e = p - t.timestampOffset;
29631                                        Math.abs(e) >= .1 && (r.log("Updating audio SourceBuffer timestampOffset to " + p + " (delta: " + e + ") sn: " + l.sn + ")"), t.timestampOffset = p)
29632                                    }
29633                                }
29634                                r.appendExecutor(s, o)
29635                            },
29636                            onStart: function () {},
29637                            onComplete: function () {
29638                                var t = self.performance.now();
29639                                d.executeEnd = d.end = t, 0 === f.first && (f.first = t), g && 0 === g.first && (g.first = t);
29640                                var e = r.sourceBuffer,
29641                                    i = {};
29642                                for (var n in e) i[n] = Jr.getBuffered(e[n]);
29643                                r.appendErrors[o] = 0, "audio" === o || "video" === o ? r.appendErrors.audiovideo = 0 : (r.appendErrors.audio = 0, r.appendErrors.video = 0), r.hls.trigger(S.BUFFER_APPENDED, {
29644                                    type: o,
29645                                    frag: l,
29646                                    part: u,
29647                                    chunkMeta: h,
29648                                    parent: l.type,
29649                                    timeRanges: i
29650                                })
29651                            },
29652                            onError: function (t) {
29653                                var e = {
29654                                    type: L.MEDIA_ERROR,
29655                                    parent: l.type,
29656                                    details: A.BUFFER_APPEND_ERROR,
29657                                    sourceBufferName: o,
29658                                    frag: l,
29659                                    part: u,
29660                                    chunkMeta: h,
29661                                    error: t,
29662                                    err: t,
29663                                    fatal: !1
29664                                };
29665                                if (t.code === DOMException.QUOTA_EXCEEDED_ERR) e.details = A.BUFFER_FULL_ERROR;
29666                                else {
29667                                    var n = ++r.appendErrors[o];
29668                                    e.details = A.BUFFER_APPEND_ERROR, r.warn("Failed " + n + "/" + i.config.appendErrorMaxRetry + ' times to append segment in "' + o + '" sourceBuffer'), n >= i.config.appendErrorMaxRetry && (e.fatal = !0)
29669                                }
29670                                i.trigger(S.ERROR, e)
29671                            }
29672                        };
29673                    n.append(y, o, !!this.pendingTracks[o])
29674                }, e.onBufferFlushing = function (t, e) {
29675                    var r = this,
29676                        i = this.operationQueue,
29677                        n = function (t) {
29678                            return {
29679                                execute: r.removeExecutor.bind(r, t, e.startOffset, e.endOffset),
29680                                onStart: function () {},
29681                                onComplete: function () {
29682                                    r.hls.trigger(S.BUFFER_FLUSHED, {
29683                                        type: t
29684                                    })
29685                                },
29686                                onError: function (e) {
29687                                    r.warn("Failed to remove from " + t + " SourceBuffer", e)
29688                                }
29689                            }
29690                        };
29691                    e.type ? i.append(n(e.type), e.type) : this.getSourceBufferTypes().forEach((function (t) {
29692                        i.append(n(t), t)
29693                    }))
29694                }, e.onFragParsed = function (t, e) {
29695                    var r = this,
29696                        i = e.frag,
29697                        n = e.part,
29698                        a = [],
29699                        s = n ? n.elementaryStreams : i.elementaryStreams;
29700                    s[U] ? a.push("audiovideo") : (s[O] && a.push("audio"), s[N] && a.push("video")), 0 === a.length && this.warn("Fragments must have at least one ElementaryStreamType set. type: " + i.type + " level: " + i.level + " sn: " + i.sn), this.blockBuffers((function () {
29701                        var t = self.performance.now();
29702                        i.stats.buffering.end = t, n && (n.stats.buffering.end = t);
29703                        var e = n ? n.stats : i.stats;
29704                        r.hls.trigger(S.FRAG_BUFFERED, {
29705                            frag: i,
29706                            part: n,
29707                            stats: e,
29708                            id: i.type
29709                        })
29710                    }), a)
29711                }, e.onFragChanged = function (t, e) {
29712                    this.trimBuffers()
29713                }, e.onBufferEos = function (t, e) {
29714                    var r = this;
29715                    this.getSourceBufferTypes().reduce((function (t, i) {
29716                        var n = r.sourceBuffer[i];
29717                        return !n || e.type && e.type !== i || (n.ending = !0, n.ended || (n.ended = !0, r.log(i + " sourceBuffer now EOS"))), t && !(n && !n.ended)
29718                    }), !0) && (this.log("Queueing mediaSource.endOfStream()"), this.blockBuffers((function () {
29719                        r.getSourceBufferTypes().forEach((function (t) {
29720                            var e = r.sourceBuffer[t];
29721                            e && (e.ending = !1)
29722                        }));
29723                        var t = r.mediaSource;
29724                        t && "open" === t.readyState ? (r.log("Calling mediaSource.endOfStream()"), t.endOfStream()) : t && r.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: " + t.readyState)
29725                    })))
29726                }, e.onLevelUpdated = function (t, e) {
29727                    var r = e.details;
29728                    r.fragments.length && (this.details = r, this.getSourceBufferTypes().length ? this.blockBuffers(this.updateMediaElementDuration.bind(this)) : this.updateMediaElementDuration())
29729                }, e.trimBuffers = function () {
29730                    var t = this.hls,
29731                        e = this.details,
29732                        r = this.media;
29733                    if (r && null !== e && this.getSourceBufferTypes().length) {
29734                        var i = t.config,
29735                            n = r.currentTime,
29736                            a = e.levelTargetDuration,
29737                            s = e.live && null !== i.liveBackBufferLength ? i.liveBackBufferLength : i.backBufferLength;
29738                        if (y(s) && s > 0) {
29739                            var o = Math.max(s, a),
29740                                l = Math.floor(n / a) * a - o;
29741                            this.flushBackBuffer(n, a, l)
29742                        }
29743                        if (y(i.frontBufferFlushThreshold) && i.frontBufferFlushThreshold > 0) {
29744                            var u = Math.max(i.maxBufferLength, i.frontBufferFlushThreshold),
29745                                h = Math.max(u, a),
29746                                d = Math.floor(n / a) * a + h;
29747                            this.flushFrontBuffer(n, a, d)
29748                        }
29749                    }
29750                }, e.flushBackBuffer = function (t, e, r) {
29751                    var i = this,
29752                        n = this.details,
29753                        a = this.sourceBuffer;
29754                    this.getSourceBufferTypes().forEach((function (s) {
29755                        var o = a[s];
29756                        if (o) {
29757                            var l = Jr.getBuffered(o);
29758                            if (l.length > 0 && r > l.start(0)) {
29759                                if (i.hls.trigger(S.BACK_BUFFER_REACHED, {
29760                                        bufferEnd: r
29761                                    }), null != n && n.live) i.hls.trigger(S.LIVE_BACK_BUFFER_REACHED, {
29762                                    bufferEnd: r
29763                                });
29764                                else if (o.ended && l.end(l.length - 1) - t < 2 * e) return void i.log("Cannot flush " + s + " back buffer while SourceBuffer is in ended state");
29765                                i.hls.trigger(S.BUFFER_FLUSHING, {
29766                                    startOffset: 0,
29767                                    endOffset: r,
29768                                    type: s
29769                                })
29770                            }
29771                        }
29772                    }))
29773                }, e.flushFrontBuffer = function (t, e, r) {
29774                    var i = this,
29775                        n = this.sourceBuffer;
29776                    this.getSourceBufferTypes().forEach((function (a) {
29777                        var s = n[a];
29778                        if (s) {
29779                            var o = Jr.getBuffered(s),
29780                                l = o.length;
29781                            if (l < 2) return;
29782                            var u = o.start(l - 1),
29783                                h = o.end(l - 1);
29784                            if (r > u || t >= u && t <= h) return;
29785                            if (s.ended && t - h < 2 * e) return void i.log("Cannot flush " + a + " front buffer while SourceBuffer is in ended state");
29786                            i.hls.trigger(S.BUFFER_FLUSHING, {
29787                                startOffset: u,
29788                                endOffset: 1 / 0,
29789                                type: a
29790                            })
29791                        }
29792                    }))
29793                }, e.updateMediaElementDuration = function () {
29794                    if (this.details && this.media && this.mediaSource && "open" === this.mediaSource.readyState) {
29795                        var t = this.details,
29796                            e = this.hls,
29797                            r = this.media,
29798                            i = this.mediaSource,
29799                            n = t.fragments[0].start + t.totalduration,
29800                            a = r.duration,
29801                            s = y(i.duration) ? i.duration : 0;
29802                        t.live && e.config.liveDurationInfinity ? (i.duration = 1 / 0, this.updateSeekableRange(t)) : (n > s && n > a || !y(a)) && (this.log("Updating Media Source duration to " + n.toFixed(3)), i.duration = n)
29803                    }
29804                }, e.updateSeekableRange = function (t) {
29805                    var e = this.mediaSource,
29806                        r = t.fragments;
29807                    if (r.length && t.live && null != e && e.setLiveSeekableRange) {
29808                        var i = Math.max(0, r[0].start),
29809                            n = Math.max(i, i + t.totalduration);
29810                        this.log("Media Source duration is set to " + e.duration + ". Setting seekable range to " + i + "-" + n + "."), e.setLiveSeekableRange(i, n)
29811                    }
29812                }, e.checkPendingTracks = function () {
29813                    var t = this.bufferCodecEventsExpected,
29814                        e = this.operationQueue,
29815                        r = this.pendingTracks,
29816                        i = Object.keys(r).length;
29817                    if (i && (!t || 2 === i || "audiovideo" in r)) {
29818                        this.createSourceBuffers(r), this.pendingTracks = {};
29819                        var n = this.getSourceBufferTypes();
29820                        if (n.length) this.hls.trigger(S.BUFFER_CREATED, {
29821                            tracks: this.tracks
29822                        }), n.forEach((function (t) {
29823                            e.executeNext(t)
29824                        }));
29825                        else {
29826                            var a = new Error("could not create source buffer for media codec(s)");
29827                            this.hls.trigger(S.ERROR, {
29828                                type: L.MEDIA_ERROR,
29829                                details: A.BUFFER_INCOMPATIBLE_CODECS_ERROR,
29830                                fatal: !0,
29831                                error: a,
29832                                reason: a.message
29833                            })
29834                        }
29835                    }
29836                }, e.createSourceBuffers = function (t) {
29837                    var e = this,
29838                        r = this.sourceBuffer,
29839                        i = this.mediaSource;
29840                    if (!i) throw Error("createSourceBuffers called when mediaSource was null");
29841                    var n = function (n) {
29842                        if (!r[n]) {
29843                            var a, s = t[n];
29844                            if (!s) throw Error("source buffer exists for track " + n + ", however track does not");
29845                            var o = -1 === (null == (a = s.levelCodec) ? void 0 : a.indexOf(",")) ? s.levelCodec : s.codec;
29846                            o && "audio" === n.slice(0, 5) && (o = he(o, e.appendSource));
29847                            var l = s.container + ";codecs=" + o;
29848                            e.log("creating sourceBuffer(" + l + ")");
29849                            try {
29850                                var u = r[n] = i.addSourceBuffer(l),
29851                                    h = n;
29852                                e.addBufferListener(h, "updatestart", e._onSBUpdateStart), e.addBufferListener(h, "updateend", e._onSBUpdateEnd), e.addBufferListener(h, "error", e._onSBUpdateError), e.appendSource && e.addBufferListener(h, "bufferedchange", (function (t, r) {
29853                                    var i = r.removedRanges;
29854                                    null != i && i.length && e.hls.trigger(S.BUFFER_FLUSHED, {
29855                                        type: n
29856                                    })
29857                                })), e.tracks[n] = {
29858                                    buffer: u,
29859                                    codec: o,
29860                                    container: s.container,
29861                                    levelCodec: s.levelCodec,
29862                                    metadata: s.metadata,
29863                                    id: s.id
29864                                }
29865                            } catch (t) {
29866                                e.error("error while trying to add sourceBuffer: " + t.message), e.hls.trigger(S.ERROR, {
29867                                    type: L.MEDIA_ERROR,
29868                                    details: A.BUFFER_ADD_CODEC_ERROR,
29869                                    fatal: !1,
29870                                    error: t,
29871                                    sourceBufferName: n,
29872                                    mimeType: l
29873                                })
29874                            }
29875                        }
29876                    };
29877                    for (var a in t) n(a)
29878                }, e._onSBUpdateStart = function (t) {
29879                    this.operationQueue.current(t).onStart()
29880                }, e._onSBUpdateEnd = function (t) {
29881                    var e;
29882                    if ("closed" !== (null == (e = this.mediaSource) ? void 0 : e.readyState)) {
29883                        var r = this.operationQueue;
29884                        r.current(t).onComplete(), r.shiftAndExecuteNext(t)
29885                    } else this.resetBuffer(t)
29886                }, e._onSBUpdateError = function (t, e) {
29887                    var r, i = new Error(t + " SourceBuffer error. MediaSource readyState: " + (null == (r = this.mediaSource) ? void 0 : r.readyState));
29888                    this.error("" + i, e), this.hls.trigger(S.ERROR, {
29889                        type: L.MEDIA_ERROR,
29890                        details: A.BUFFER_APPENDING_ERROR,
29891                        sourceBufferName: t,
29892                        error: i,
29893                        fatal: !1
29894                    });
29895                    var n = this.operationQueue.current(t);
29896                    n && n.onError(i)
29897                }, e.removeExecutor = function (t, e, r) {
29898                    var i = this.media,
29899                        n = this.mediaSource,
29900                        a = this.operationQueue,
29901                        s = this.sourceBuffer[t];
29902                    if (!i || !n || !s) return this.warn("Attempting to remove from the " + t + " SourceBuffer, but it does not exist"), void a.shiftAndExecuteNext(t);
29903                    var o = y(i.duration) ? i.duration : 1 / 0,
29904                        l = y(n.duration) ? n.duration : 1 / 0,
29905                        u = Math.max(0, e),
29906                        h = Math.min(r, o, l);
29907                    h > u && (!s.ending || s.ended) ? (s.ended = !1, this.log("Removing [" + u + "," + h + "] from the " + t + " SourceBuffer"), s.remove(u, h)) : a.shiftAndExecuteNext(t)
29908                }, e.appendExecutor = function (t, e) {
29909                    var r = this.sourceBuffer[e];
29910                    if (r) r.ended = !1, r.appendBuffer(t);
29911                    else if (!this.pendingTracks[e]) throw new Error("Attempting to append to the " + e + " SourceBuffer, but it does not exist")
29912                }, e.blockBuffers = function (t, e) {
29913                    var r = this;
vendor: 22,746 bytes, lines 29914-30367
29914                    if (void 0 === e && (e = this.getSourceBufferTypes()), !e.length) return this.log("Blocking operation requested, but no SourceBuffers exist"), void Promise.resolve().then(t);
29915                    var i = this.operationQueue,
29916                        n = e.map((function (t) {
29917                            return i.appendBlocker(t)
29918                        }));
29919                    Promise.all(n).then((function () {
29920                        t(), e.forEach((function (t) {
29921                            var e = r.sourceBuffer[t];
29922                            null != e && e.updating || i.shiftAndExecuteNext(t)
29923                        }))
29924                    }))
29925                }, e.getSourceBufferTypes = function () {
29926                    return Object.keys(this.sourceBuffer)
29927                }, e.addBufferListener = function (t, e, r) {
29928                    var i = this.sourceBuffer[t];
29929                    if (i) {
29930                        var n = r.bind(this, t);
29931                        this.listeners[t].push({
29932                            event: e,
29933                            listener: n
29934                        }), i.addEventListener(e, n)
29935                    }
29936                }, e.removeBufferListeners = function (t) {
29937                    var e = this.sourceBuffer[t];
29938                    e && this.listeners[t].forEach((function (t) {
29939                        e.removeEventListener(t.event, t.listener)
29940                    }))
29941                }, s(t, [{
29942                    key: "mediaSrc",
29943                    get: function () {
29944                        var t, e = (null == (t = this.media) ? void 0 : t.firstChild) || this.media;
29945                        return null == e ? void 0 : e.src
29946                    }
29947                }]), t
29948            }();
29949
29950        function Zn(t) {
29951            var e = t.querySelectorAll("source");
29952            [].slice.call(e).forEach((function (e) {
29953                t.removeChild(e)
29954            }))
29955        }
29956        var ta = {
29957                42: 225,
29958                92: 233,
29959                94: 237,
29960                95: 243,
29961                96: 250,
29962                123: 231,
29963                124: 247,
29964                125: 209,
29965                126: 241,
29966                127: 9608,
29967                128: 174,
29968                129: 176,
29969                130: 189,
29970                131: 191,
29971                132: 8482,
29972                133: 162,
29973                134: 163,
29974                135: 9834,
29975                136: 224,
29976                137: 32,
29977                138: 232,
29978                139: 226,
29979                140: 234,
29980                141: 238,
29981                142: 244,
29982                143: 251,
29983                144: 193,
29984                145: 201,
29985                146: 211,
29986                147: 218,
29987                148: 220,
29988                149: 252,
29989                150: 8216,
29990                151: 161,
29991                152: 42,
29992                153: 8217,
29993                154: 9473,
29994                155: 169,
29995                156: 8480,
29996                157: 8226,
29997                158: 8220,
29998                159: 8221,
29999                160: 192,
30000                161: 194,
30001                162: 199,
30002                163: 200,
30003                164: 202,
30004                165: 203,
30005                166: 235,
30006                167: 206,
30007                168: 207,
30008                169: 239,
30009                170: 212,
30010                171: 217,
30011                172: 249,
30012                173: 219,
30013                174: 171,
30014                175: 187,
30015                176: 195,
30016                177: 227,
30017                178: 205,
30018                179: 204,
30019                180: 236,
30020                181: 210,
30021                182: 242,
30022                183: 213,
30023                184: 245,
30024                185: 123,
30025                186: 125,
30026                187: 92,
30027                188: 94,
30028                189: 95,
30029                190: 124,
30030                191: 8764,
30031                192: 196,
30032                193: 228,
30033                194: 214,
30034                195: 246,
30035                196: 223,
30036                197: 165,
30037                198: 164,
30038                199: 9475,
30039                200: 197,
30040                201: 229,
30041                202: 216,
30042                203: 248,
30043                204: 9487,
30044                205: 9491,
30045                206: 9495,
30046                207: 9499
30047            },
30048            ea = function (t) {
30049                return String.fromCharCode(ta[t] || t)
30050            },
30051            ra = 15,
30052            ia = 100,
30053            na = {
30054                17: 1,
30055                18: 3,
30056                21: 5,
30057                22: 7,
30058                23: 9,
30059                16: 11,
30060                19: 12,
30061                20: 14
30062            },
30063            aa = {
30064                17: 2,
30065                18: 4,
30066                21: 6,
30067                22: 8,
30068                23: 10,
30069                19: 13,
30070                20: 15
30071            },
30072            sa = {
30073                25: 1,
30074                26: 3,
30075                29: 5,
30076                30: 7,
30077                31: 9,
30078                24: 11,
30079                27: 12,
30080                28: 14
30081            },
30082            oa = {
30083                25: 2,
30084                26: 4,
30085                29: 6,
30086                30: 8,
30087                31: 10,
30088                27: 13,
30089                28: 15
30090            },
30091            la = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "black", "transparent"],
30092            ua = function () {
30093                function t() {
30094                    this.time = null, this.verboseLevel = 0
30095                }
30096                return t.prototype.log = function (t, e) {
30097                    if (this.verboseLevel >= t) {
30098                        var r = "function" == typeof e ? e() : e;
30099                        w.log(this.time + " [" + t + "] " + r)
30100                    }
30101                }, t
30102            }(),
30103            ha = function (t) {
30104                for (var e = [], r = 0; r < t.length; r++) e.push(t[r].toString(16));
30105                return e
30106            },
30107            da = function () {
30108                function t() {
30109                    this.foreground = "white", this.underline = !1, this.italics = !1, this.background = "black", this.flash = !1
30110                }
30111                var e = t.prototype;
30112                return e.reset = function () {
30113                    this.foreground = "white", this.underline = !1, this.italics = !1, this.background = "black", this.flash = !1
30114                }, e.setStyles = function (t) {
30115                    for (var e = ["foreground", "underline", "italics", "background", "flash"], r = 0; r < e.length; r++) {
30116                        var i = e[r];
30117                        t.hasOwnProperty(i) && (this[i] = t[i])
30118                    }
30119                }, e.isDefault = function () {
30120                    return "white" === this.foreground && !this.underline && !this.italics && "black" === this.background && !this.flash
30121                }, e.equals = function (t) {
30122                    return this.foreground === t.foreground && this.underline === t.underline && this.italics === t.italics && this.background === t.background && this.flash === t.flash
30123                }, e.copy = function (t) {
30124                    this.foreground = t.foreground, this.underline = t.underline, this.italics = t.italics, this.background = t.background, this.flash = t.flash
30125                }, e.toString = function () {
30126                    return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this.italics + ", background=" + this.background + ", flash=" + this.flash
30127                }, t
30128            }(),
30129            ca = function () {
30130                function t() {
30131                    this.uchar = " ", this.penState = new da
30132                }
30133                var e = t.prototype;
30134                return e.reset = function () {
30135                    this.uchar = " ", this.penState.reset()
30136                }, e.setChar = function (t, e) {
30137                    this.uchar = t, this.penState.copy(e)
30138                }, e.setPenState = function (t) {
30139                    this.penState.copy(t)
30140                }, e.equals = function (t) {
30141                    return this.uchar === t.uchar && this.penState.equals(t.penState)
30142                }, e.copy = function (t) {
30143                    this.uchar = t.uchar, this.penState.copy(t.penState)
30144                }, e.isEmpty = function () {
30145                    return " " === this.uchar && this.penState.isDefault()
30146                }, t
30147            }(),
30148            fa = function () {
30149                function t(t) {
30150                    this.chars = [], this.pos = 0, this.currPenState = new da, this.cueStartTime = null, this.logger = void 0;
30151                    for (var e = 0; e < ia; e++) this.chars.push(new ca);
30152                    this.logger = t
30153                }
30154                var e = t.prototype;
30155                return e.equals = function (t) {
30156                    for (var e = 0; e < ia; e++)
30157                        if (!this.chars[e].equals(t.chars[e])) return !1;
30158                    return !0
30159                }, e.copy = function (t) {
30160                    for (var e = 0; e < ia; e++) this.chars[e].copy(t.chars[e])
30161                }, e.isEmpty = function () {
30162                    for (var t = !0, e = 0; e < ia; e++)
30163                        if (!this.chars[e].isEmpty()) {
30164                            t = !1;
30165                            break
30166                        } return t
30167                }, e.setCursor = function (t) {
30168                    this.pos !== t && (this.pos = t), this.pos < 0 ? (this.logger.log(3, "Negative cursor position " + this.pos), this.pos = 0) : this.pos > ia && (this.logger.log(3, "Too large cursor position " + this.pos), this.pos = ia)
30169                }, e.moveCursor = function (t) {
30170                    var e = this.pos + t;
30171                    if (t > 1)
30172                        for (var r = this.pos + 1; r < e + 1; r++) this.chars[r].setPenState(this.currPenState);
30173                    this.setCursor(e)
30174                }, e.backSpace = function () {
30175                    this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState)
30176                }, e.insertChar = function (t) {
30177                    var e = this;
30178                    t >= 144 && this.backSpace();
30179                    var r = ea(t);
30180                    this.pos >= ia ? this.logger.log(0, (function () {
30181                        return "Cannot insert " + t.toString(16) + " (" + r + ") at position " + e.pos + ". Skipping it!"
30182                    })) : (this.chars[this.pos].setChar(r, this.currPenState), this.moveCursor(1))
30183                }, e.clearFromPos = function (t) {
30184                    var e;
30185                    for (e = t; e < ia; e++) this.chars[e].reset()
30186                }, e.clear = function () {
30187                    this.clearFromPos(0), this.pos = 0, this.currPenState.reset()
30188                }, e.clearToEndOfRow = function () {
30189                    this.clearFromPos(this.pos)
30190                }, e.getTextString = function () {
30191                    for (var t = [], e = !0, r = 0; r < ia; r++) {
30192                        var i = this.chars[r].uchar;
30193                        " " !== i && (e = !1), t.push(i)
30194                    }
30195                    return e ? "" : t.join("")
30196                }, e.setPenStyles = function (t) {
30197                    this.currPenState.setStyles(t), this.chars[this.pos].setPenState(this.currPenState)
30198                }, t
30199            }(),
30200            ga = function () {
30201                function t(t) {
30202                    this.rows = [], this.currRow = 14, this.nrRollUpRows = null, this.lastOutputScreen = null, this.logger = void 0;
30203                    for (var e = 0; e < ra; e++) this.rows.push(new fa(t));
30204                    this.logger = t
30205                }
30206                var e = t.prototype;
30207                return e.reset = function () {
30208                    for (var t = 0; t < ra; t++) this.rows[t].clear();
30209                    this.currRow = 14
30210                }, e.equals = function (t) {
30211                    for (var e = !0, r = 0; r < ra; r++)
30212                        if (!this.rows[r].equals(t.rows[r])) {
30213                            e = !1;
30214                            break
30215                        } return e
30216                }, e.copy = function (t) {
30217                    for (var e = 0; e < ra; e++) this.rows[e].copy(t.rows[e])
30218                }, e.isEmpty = function () {
30219                    for (var t = !0, e = 0; e < ra; e++)
30220                        if (!this.rows[e].isEmpty()) {
30221                            t = !1;
30222                            break
30223                        } return t
30224                }, e.backSpace = function () {
30225                    this.rows[this.currRow].backSpace()
30226                }, e.clearToEndOfRow = function () {
30227                    this.rows[this.currRow].clearToEndOfRow()
30228                }, e.insertChar = function (t) {
30229                    this.rows[this.currRow].insertChar(t)
30230                }, e.setPen = function (t) {
30231                    this.rows[this.currRow].setPenStyles(t)
30232                }, e.moveCursor = function (t) {
30233                    this.rows[this.currRow].moveCursor(t)
30234                }, e.setCursor = function (t) {
30235                    this.logger.log(2, "setCursor: " + t), this.rows[this.currRow].setCursor(t)
30236                }, e.setPAC = function (t) {
30237                    this.logger.log(2, (function () {
30238                        return "pacData = " + JSON.stringify(t)
30239                    }));
30240                    var e = t.row - 1;
30241                    if (this.nrRollUpRows && e < this.nrRollUpRows - 1 && (e = this.nrRollUpRows - 1), this.nrRollUpRows && this.currRow !== e) {
30242                        for (var r = 0; r < ra; r++) this.rows[r].clear();
30243                        var i = this.currRow + 1 - this.nrRollUpRows,
30244                            n = this.lastOutputScreen;
30245                        if (n) {
30246                            var a = n.rows[i].cueStartTime,
30247                                s = this.logger.time;
30248                            if (null !== a && null !== s && a < s)
30249                                for (var o = 0; o < this.nrRollUpRows; o++) this.rows[e - this.nrRollUpRows + o + 1].copy(n.rows[i + o])
30250                        }
30251                    }
30252                    this.currRow = e;
30253                    var l = this.rows[this.currRow];
30254                    if (null !== t.indent) {
30255                        var u = t.indent,
30256                            h = Math.max(u - 1, 0);
30257                        l.setCursor(t.indent), t.color = l.chars[h].penState.foreground
30258                    }
30259                    var d = {
30260                        foreground: t.color,
30261                        underline: t.underline,
30262                        italics: t.italics,
30263                        background: "black",
30264                        flash: !1
30265                    };
30266                    this.setPen(d)
30267                }, e.setBkgData = function (t) {
30268                    this.logger.log(2, (function () {
30269                        return "bkgData = " + JSON.stringify(t)
30270                    })), this.backSpace(), this.setPen(t), this.insertChar(32)
30271                }, e.setRollUpRows = function (t) {
30272                    this.nrRollUpRows = t
30273                }, e.rollUp = function () {
30274                    var t = this;
30275                    if (null !== this.nrRollUpRows) {
30276                        this.logger.log(1, (function () {
30277                            return t.getDisplayText()
30278                        }));
30279                        var e = this.currRow + 1 - this.nrRollUpRows,
30280                            r = this.rows.splice(e, 1)[0];
30281                        r.clear(), this.rows.splice(this.currRow, 0, r), this.logger.log(2, "Rolling up")
30282                    } else this.logger.log(3, "roll_up but nrRollUpRows not set yet")
30283                }, e.getDisplayText = function (t) {
30284                    t = t || !1;
30285                    for (var e = [], r = "", i = -1, n = 0; n < ra; n++) {
30286                        var a = this.rows[n].getTextString();
30287                        a && (i = n + 1, t ? e.push("Row " + i + ": '" + a + "'") : e.push(a.trim()))
30288                    }
30289                    return e.length > 0 && (r = t ? "[" + e.join(" | ") + "]" : e.join("\n")), r
30290                }, e.getTextAndFormat = function () {
30291                    return this.rows
30292                }, t
30293            }(),
30294            va = function () {
30295                function t(t, e, r) {
30296                    this.chNr = void 0, this.outputFilter = void 0, this.mode = void 0, this.verbose = void 0, this.displayedMemory = void 0, this.nonDisplayedMemory = void 0, this.lastOutputScreen = void 0, this.currRollUpRow = void 0, this.writeScreen = void 0, this.cueStartTime = void 0, this.logger = void 0, this.chNr = t, this.outputFilter = e, this.mode = null, this.verbose = 0, this.displayedMemory = new ga(r), this.nonDisplayedMemory = new ga(r), this.lastOutputScreen = new ga(r), this.currRollUpRow = this.displayedMemory.rows[14], this.writeScreen = this.displayedMemory, this.mode = null, this.cueStartTime = null, this.logger = r
30297                }
30298                var e = t.prototype;
30299                return e.reset = function () {
30300                    this.mode = null, this.displayedMemory.reset(), this.nonDisplayedMemory.reset(), this.lastOutputScreen.reset(), this.outputFilter.reset(), this.currRollUpRow = this.displayedMemory.rows[14], this.writeScreen = this.displayedMemory, this.mode = null, this.cueStartTime = null
30301                }, e.getHandler = function () {
30302                    return this.outputFilter
30303                }, e.setHandler = function (t) {
30304                    this.outputFilter = t
30305                }, e.setPAC = function (t) {
30306                    this.writeScreen.setPAC(t)
30307                }, e.setBkgData = function (t) {
30308                    this.writeScreen.setBkgData(t)
30309                }, e.setMode = function (t) {
30310                    t !== this.mode && (this.mode = t, this.logger.log(2, (function () {
30311                        return "MODE=" + t
30312                    })), "MODE_POP-ON" === this.mode ? this.writeScreen = this.nonDisplayedMemory : (this.writeScreen = this.displayedMemory, this.writeScreen.reset()), "MODE_ROLL-UP" !== this.mode && (this.displayedMemory.nrRollUpRows = null, this.nonDisplayedMemory.nrRollUpRows = null), this.mode = t)
30313                }, e.insertChars = function (t) {
30314                    for (var e = this, r = 0; r < t.length; r++) this.writeScreen.insertChar(t[r]);
30315                    var i = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP";
30316                    this.logger.log(2, (function () {
30317                        return i + ": " + e.writeScreen.getDisplayText(!0)
30318                    })), "MODE_PAINT-ON" !== this.mode && "MODE_ROLL-UP" !== this.mode || (this.logger.log(1, (function () {
30319                        return "DISPLAYED: " + e.displayedMemory.getDisplayText(!0)
30320                    })), this.outputDataUpdate())
30321                }, e.ccRCL = function () {
30322                    this.logger.log(2, "RCL - Resume Caption Loading"), this.setMode("MODE_POP-ON")
30323                }, e.ccBS = function () {
30324                    this.logger.log(2, "BS - BackSpace"), "MODE_TEXT" !== this.mode && (this.writeScreen.backSpace(), this.writeScreen === this.displayedMemory && this.outputDataUpdate())
30325                }, e.ccAOF = function () {}, e.ccAON = function () {}, e.ccDER = function () {
30326                    this.logger.log(2, "DER- Delete to End of Row"), this.writeScreen.clearToEndOfRow(), this.outputDataUpdate()
30327                }, e.ccRU = function (t) {
30328                    this.logger.log(2, "RU(" + t + ") - Roll Up"), this.writeScreen = this.displayedMemory, this.setMode("MODE_ROLL-UP"), this.writeScreen.setRollUpRows(t)
30329                }, e.ccFON = function () {
30330                    this.logger.log(2, "FON - Flash On"), this.writeScreen.setPen({
30331                        flash: !0
30332                    })
30333                }, e.ccRDC = function () {
30334                    this.logger.log(2, "RDC - Resume Direct Captioning"), this.setMode("MODE_PAINT-ON")
30335                }, e.ccTR = function () {
30336                    this.logger.log(2, "TR"), this.setMode("MODE_TEXT")
30337                }, e.ccRTD = function () {
30338                    this.logger.log(2, "RTD"), this.setMode("MODE_TEXT")
30339                }, e.ccEDM = function () {
30340                    this.logger.log(2, "EDM - Erase Displayed Memory"), this.displayedMemory.reset(), this.outputDataUpdate(!0)
30341                }, e.ccCR = function () {
30342                    this.logger.log(2, "CR - Carriage Return"), this.writeScreen.rollUp(), this.outputDataUpdate(!0)
30343                }, e.ccENM = function () {
30344                    this.logger.log(2, "ENM - Erase Non-displayed Memory"), this.nonDisplayedMemory.reset()
30345                }, e.ccEOC = function () {
30346                    var t = this;
30347                    if (this.logger.log(2, "EOC - End Of Caption"), "MODE_POP-ON" === this.mode) {
30348                        var e = this.displayedMemory;
30349                        this.displayedMemory = this.nonDisplayedMemory, this.nonDisplayedMemory = e, this.writeScreen = this.nonDisplayedMemory, this.logger.log(1, (function () {
30350                            return "DISP: " + t.displayedMemory.getDisplayText()
30351                        }))
30352                    }
30353                    this.outputDataUpdate(!0)
30354                }, e.ccTO = function (t) {
30355                    this.logger.log(2, "TO(" + t + ") - Tab Offset"), this.writeScreen.moveCursor(t)
30356                }, e.ccMIDROW = function (t) {
30357                    var e = {
30358                        flash: !1
30359                    };
30360                    if (e.underline = t % 2 == 1, e.italics = t >= 46, e.italics) e.foreground = "white";
30361                    else {
30362                        var r = Math.floor(t / 2) - 16;
30363                        e.foreground = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"][r]
30364                    }
30365                    this.logger.log(2, "MIDROW: " + JSON.stringify(e)), this.writeScreen.setPen(e)
30366                }, e.outputDataUpdate = function (t) {
30367                    void 0 === t && (t = !1);
vendor: 6,296 bytes, lines 30368-30452
30368                    var e = this.logger.time;
30369                    null !== e && this.outputFilter && (null !== this.cueStartTime || this.displayedMemory.isEmpty() ? this.displayedMemory.equals(this.lastOutputScreen) || (this.outputFilter.newCue(this.cueStartTime, e, this.lastOutputScreen), t && this.outputFilter.dispatchCue && this.outputFilter.dispatchCue(), this.cueStartTime = this.displayedMemory.isEmpty() ? null : e) : this.cueStartTime = e, this.lastOutputScreen.copy(this.displayedMemory))
30370                }, e.cueSplitAtTime = function (t) {
30371                    this.outputFilter && (this.displayedMemory.isEmpty() || (this.outputFilter.newCue && this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory), this.cueStartTime = t))
30372                }, t
30373            }(),
30374            ma = function () {
30375                function t(t, e, r) {
30376                    this.channels = void 0, this.currentChannel = 0, this.cmdHistory = {
30377                        a: null,
30378                        b: null
30379                    }, this.logger = void 0;
30380                    var i = this.logger = new ua;
30381                    this.channels = [null, new va(t, e, i), new va(t + 1, r, i)]
30382                }
30383                var e = t.prototype;
30384                return e.getHandler = function (t) {
30385                    return this.channels[t].getHandler()
30386                }, e.setHandler = function (t, e) {
30387                    this.channels[t].setHandler(e)
30388                }, e.addData = function (t, e) {
30389                    var r = this;
30390                    this.logger.time = t;
30391                    for (var i = function (t) {
30392                            var i = 127 & e[t],
30393                                n = 127 & e[t + 1],
30394                                a = !1,
30395                                s = null;
30396                            if (0 === i && 0 === n) return 0;
30397                            r.logger.log(3, (function () {
30398                                return "[" + ha([e[t], e[t + 1]]) + "] -> (" + ha([i, n]) + ")"
30399                            }));
30400                            var o = r.cmdHistory;
30401                            if (i >= 16 && i <= 31) {
30402                                if (function (t, e, r) {
30403                                        return r.a === t && r.b === e
30404                                    }(i, n, o)) return pa(null, null, o), r.logger.log(3, (function () {
30405                                    return "Repeated command (" + ha([i, n]) + ") is dropped"
30406                                })), 0;
30407                                pa(i, n, r.cmdHistory), (a = r.parseCmd(i, n)) || (a = r.parseMidrow(i, n)), a || (a = r.parsePAC(i, n)), a || (a = r.parseBackgroundAttributes(i, n))
30408                            } else pa(null, null, o);
30409                            if (!a && (s = r.parseChars(i, n))) {
30410                                var l = r.currentChannel;
30411                                l && l > 0 ? r.channels[l].insertChars(s) : r.logger.log(2, "No channel found yet. TEXT-MODE?")
30412                            }
30413                            a || s || r.logger.log(2, (function () {
30414                                return "Couldn't parse cleaned data " + ha([i, n]) + " orig: " + ha([e[t], e[t + 1]])
30415                            }))
30416                        }, n = 0; n < e.length; n += 2) i(n)
30417                }, e.parseCmd = function (t, e) {
30418                    if (!((20 === t || 28 === t || 21 === t || 29 === t) && e >= 32 && e <= 47 || (23 === t || 31 === t) && e >= 33 && e <= 35)) return !1;
30419                    var r = 20 === t || 21 === t || 23 === t ? 1 : 2,
30420                        i = this.channels[r];
30421                    return 20 === t || 21 === t || 28 === t || 29 === t ? 32 === e ? i.ccRCL() : 33 === e ? i.ccBS() : 34 === e ? i.ccAOF() : 35 === e ? i.ccAON() : 36 === e ? i.ccDER() : 37 === e ? i.ccRU(2) : 38 === e ? i.ccRU(3) : 39 === e ? i.ccRU(4) : 40 === e ? i.ccFON() : 41 === e ? i.ccRDC() : 42 === e ? i.ccTR() : 43 === e ? i.ccRTD() : 44 === e ? i.ccEDM() : 45 === e ? i.ccCR() : 46 === e ? i.ccENM() : 47 === e && i.ccEOC() : i.ccTO(e - 32), this.currentChannel = r, !0
30422                }, e.parseMidrow = function (t, e) {
30423                    var r = 0;
30424                    if ((17 === t || 25 === t) && e >= 32 && e <= 47) {
30425                        if ((r = 17 === t ? 1 : 2) !== this.currentChannel) return this.logger.log(0, "Mismatch channel in midrow parsing"), !1;
30426                        var i = this.channels[r];
30427                        return !!i && (i.ccMIDROW(e), this.logger.log(3, (function () {
30428                            return "MIDROW (" + ha([t, e]) + ")"
30429                        })), !0)
30430                    }
30431                    return !1
30432                }, e.parsePAC = function (t, e) {
30433                    var r;
30434                    if (!((t >= 17 && t <= 23 || t >= 25 && t <= 31) && e >= 64 && e <= 127 || (16 === t || 24 === t) && e >= 64 && e <= 95)) return !1;
30435                    var i = t <= 23 ? 1 : 2;
30436                    r = e >= 64 && e <= 95 ? 1 === i ? na[t] : sa[t] : 1 === i ? aa[t] : oa[t];
30437                    var n = this.channels[i];
30438                    return !!n && (n.setPAC(this.interpretPAC(r, e)), this.currentChannel = i, !0)
30439                }, e.interpretPAC = function (t, e) {
30440                    var r, i = {
30441                        color: null,
30442                        italics: !1,
30443                        indent: null,
30444                        underline: !1,
30445                        row: t
30446                    };
30447                    return r = e > 95 ? e - 96 : e - 64, i.underline = 1 == (1 & r), r <= 13 ? i.color = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "white"][Math.floor(r / 2)] : r <= 15 ? (i.italics = !0, i.color = "white") : i.indent = 4 * Math.floor((r - 16) / 2), i
30448                }, e.parseChars = function (t, e) {
30449                    var r, i, n = null,
30450                        a = null;
30451                    return t >= 25 ? (r = 2, a = t - 8) : (r = 1, a = t), a >= 17 && a <= 19 ? (i = 17 === a ? e + 80 : 18 === a ? e + 112 : e + 144, this.logger.log(2, (function () {
30452                        return "Special char '" + ea(i) + "' in channel " + r
vendor: 10,643 bytes, lines 30453-30670
30453                    })), n = [i]) : t >= 32 && t <= 127 && (n = 0 === e ? [t] : [t, e]), n && this.logger.log(3, (function () {
30454                        return "Char codes =  " + ha(n).join(",")
30455                    })), n
30456                }, e.parseBackgroundAttributes = function (t, e) {
30457                    var r;
30458                    if (!((16 === t || 24 === t) && e >= 32 && e <= 47 || (23 === t || 31 === t) && e >= 45 && e <= 47)) return !1;
30459                    var i = {};
30460                    16 === t || 24 === t ? (r = Math.floor((e - 32) / 2), i.background = la[r], e % 2 == 1 && (i.background = i.background + "_semi")) : 45 === e ? i.background = "transparent" : (i.foreground = "black", 47 === e && (i.underline = !0));
30461                    var n = t <= 23 ? 1 : 2;
30462                    return this.channels[n].setBkgData(i), !0
30463                }, e.reset = function () {
30464                    for (var t = 0; t < Object.keys(this.channels).length; t++) {
30465                        var e = this.channels[t];
30466                        e && e.reset()
30467                    }
30468                    pa(null, null, this.cmdHistory)
30469                }, e.cueSplitAtTime = function (t) {
30470                    for (var e = 0; e < this.channels.length; e++) {
30471                        var r = this.channels[e];
30472                        r && r.cueSplitAtTime(t)
30473                    }
30474                }, t
30475            }();
30476
30477        function pa(t, e, r) {
30478            r.a = t, r.b = e
30479        }
30480        var ya = function () {
30481                function t(t, e) {
30482                    this.timelineController = void 0, this.cueRanges = [], this.trackName = void 0, this.startTime = null, this.endTime = null, this.screen = null, this.timelineController = t, this.trackName = e
30483                }
30484                var e = t.prototype;
30485                return e.dispatchCue = function () {
30486                    null !== this.startTime && (this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen, this.cueRanges), this.startTime = null)
30487                }, e.newCue = function (t, e, r) {
30488                    (null === this.startTime || this.startTime > t) && (this.startTime = t), this.endTime = e, this.screen = r, this.timelineController.createCaptionsTrack(this.trackName)
30489                }, e.reset = function () {
30490                    this.cueRanges = [], this.startTime = null
30491                }, t
30492            }(),
30493            Ea = function () {
30494                if (null != j && j.VTTCue) return self.VTTCue;
30495                var t = ["", "lr", "rl"],
30496                    e = ["start", "middle", "end", "left", "right"];
30497
30498                function r(t, e) {
30499                    if ("string" != typeof e) return !1;
30500                    if (!Array.isArray(t)) return !1;
30501                    var r = e.toLowerCase();
30502                    return !!~t.indexOf(r) && r
30503                }
30504
30505                function i(t) {
30506                    return r(e, t)
30507                }
30508
30509                function n(t) {
30510                    for (var e = arguments.length, r = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) r[i - 1] = arguments[i];
30511                    for (var n = 1; n < arguments.length; n++) {
30512                        var a = arguments[n];
30513                        for (var s in a) t[s] = a[s]
30514                    }
30515                    return t
30516                }
30517
30518                function a(e, a, s) {
30519                    var o = this,
30520                        l = {
30521                            enumerable: !0
30522                        };
30523                    o.hasBeenReset = !1;
30524                    var u = "",
30525                        h = !1,
30526                        d = e,
30527                        c = a,
30528                        f = s,
30529                        g = null,
30530                        v = "",
30531                        m = !0,
30532                        p = "auto",
30533                        y = "start",
30534                        E = 50,
30535                        T = "middle",
30536                        S = 50,
30537                        L = "middle";
30538                    Object.defineProperty(o, "id", n({}, l, {
30539                        get: function () {
30540                            return u
30541                        },
30542                        set: function (t) {
30543                            u = "" + t
30544                        }
30545                    })), Object.defineProperty(o, "pauseOnExit", n({}, l, {
30546                        get: function () {
30547                            return h
30548                        },
30549                        set: function (t) {
30550                            h = !!t
30551                        }
30552                    })), Object.defineProperty(o, "startTime", n({}, l, {
30553                        get: function () {
30554                            return d
30555                        },
30556                        set: function (t) {
30557                            if ("number" != typeof t) throw new TypeError("Start time must be set to a number.");
30558                            d = t, this.hasBeenReset = !0
30559                        }
30560                    })), Object.defineProperty(o, "endTime", n({}, l, {
30561                        get: function () {
30562                            return c
30563                        },
30564                        set: function (t) {
30565                            if ("number" != typeof t) throw new TypeError("End time must be set to a number.");
30566                            c = t, this.hasBeenReset = !0
30567                        }
30568                    })), Object.defineProperty(o, "text", n({}, l, {
30569                        get: function () {
30570                            return f
30571                        },
30572                        set: function (t) {
30573                            f = "" + t, this.hasBeenReset = !0
30574                        }
30575                    })), Object.defineProperty(o, "region", n({}, l, {
30576                        get: function () {
30577                            return g
30578                        },
30579                        set: function (t) {
30580                            g = t, this.hasBeenReset = !0
30581                        }
30582                    })), Object.defineProperty(o, "vertical", n({}, l, {
30583                        get: function () {
30584                            return v
30585                        },
30586                        set: function (e) {
30587                            var i = function (e) {
30588                                return r(t, e)
30589                            }(e);
30590                            if (!1 === i) throw new SyntaxError("An invalid or illegal string was specified.");
30591                            v = i, this.hasBeenReset = !0
30592                        }
30593                    })), Object.defineProperty(o, "snapToLines", n({}, l, {
30594                        get: function () {
30595                            return m
30596                        },
30597                        set: function (t) {
30598                            m = !!t, this.hasBeenReset = !0
30599                        }
30600                    })), Object.defineProperty(o, "line", n({}, l, {
30601                        get: function () {
30602                            return p
30603                        },
30604                        set: function (t) {
30605                            if ("number" != typeof t && "auto" !== t) throw new SyntaxError("An invalid number or illegal string was specified.");
30606                            p = t, this.hasBeenReset = !0
30607                        }
30608                    })), Object.defineProperty(o, "lineAlign", n({}, l, {
30609                        get: function () {
30610                            return y
30611                        },
30612                        set: function (t) {
30613                            var e = i(t);
30614                            if (!e) throw new SyntaxError("An invalid or illegal string was specified.");
30615                            y = e, this.hasBeenReset = !0
30616                        }
30617                    })), Object.defineProperty(o, "position", n({}, l, {
30618                        get: function () {
30619                            return E
30620                        },
30621                        set: function (t) {
30622                            if (t < 0 || t > 100) throw new Error("Position must be between 0 and 100.");
30623                            E = t, this.hasBeenReset = !0
30624                        }
30625                    })), Object.defineProperty(o, "positionAlign", n({}, l, {
30626                        get: function () {
30627                            return T
30628                        },
30629                        set: function (t) {
30630                            var e = i(t);
30631                            if (!e) throw new SyntaxError("An invalid or illegal string was specified.");
30632                            T = e, this.hasBeenReset = !0
30633                        }
30634                    })), Object.defineProperty(o, "size", n({}, l, {
30635                        get: function () {
30636                            return S
30637                        },
30638                        set: function (t) {
30639                            if (t < 0 || t > 100) throw new Error("Size must be between 0 and 100.");
30640                            S = t, this.hasBeenReset = !0
30641                        }
30642                    })), Object.defineProperty(o, "align", n({}, l, {
30643                        get: function () {
30644                            return L
30645                        },
30646                        set: function (t) {
30647                            var e = i(t);
30648                            if (!e) throw new SyntaxError("An invalid or illegal string was specified.");
30649                            L = e, this.hasBeenReset = !0
30650                        }
30651                    })), o.displayState = void 0
30652                }
30653                return a.prototype.getCueAsHTML = function () {
30654                    return self.WebVTT.convertCueToDOMTree(self, this.text)
30655                }, a
30656            }(),
30657            Ta = function () {
30658                function t() {}
30659                return t.prototype.decode = function (t, e) {
30660                    if (!t) return "";
30661                    if ("string" != typeof t) throw new Error("Error - expected string data.");
30662                    return decodeURIComponent(encodeURIComponent(t))
30663                }, t
30664            }();
30665
30666        function Sa(t) {
30667            function e(t, e, r, i) {
30668                return 3600 * (0 | t) + 60 * (0 | e) + (0 | r) + parseFloat(i || 0)
30669            }
30670            var r = t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);
vendor: 15,943 bytes, lines 30671-30977
30671            return r ? parseFloat(r[2]) > 59 ? e(r[2], r[3], 0, r[4]) : e(r[1], r[2], r[3], r[4]) : null
30672        }
30673        var La = function () {
30674            function t() {
30675                this.values = Object.create(null)
30676            }
30677            var e = t.prototype;
30678            return e.set = function (t, e) {
30679                this.get(t) || "" === e || (this.values[t] = e)
30680            }, e.get = function (t, e, r) {
30681                return r ? this.has(t) ? this.values[t] : e[r] : this.has(t) ? this.values[t] : e
30682            }, e.has = function (t) {
30683                return t in this.values
30684            }, e.alt = function (t, e, r) {
30685                for (var i = 0; i < r.length; ++i)
30686                    if (e === r[i]) {
30687                        this.set(t, e);
30688                        break
30689                    }
30690            }, e.integer = function (t, e) {
30691                /^-?\d+$/.test(e) && this.set(t, parseInt(e, 10))
30692            }, e.percent = function (t, e) {
30693                if (/^([\d]{1,3})(\.[\d]*)?%$/.test(e)) {
30694                    var r = parseFloat(e);
30695                    if (r >= 0 && r <= 100) return this.set(t, r), !0
30696                }
30697                return !1
30698            }, t
30699        }();
30700
30701        function Aa(t, e, r, i) {
30702            var n = i ? t.split(i) : [t];
30703            for (var a in n)
30704                if ("string" == typeof n[a]) {
30705                    var s = n[a].split(r);
30706                    2 === s.length && e(s[0], s[1])
30707                }
30708        }
30709        var Ra = new Ea(0, 0, ""),
30710            ka = "middle" === Ra.align ? "middle" : "center";
30711
30712        function ba(t, e, r) {
30713            var i = t;
30714
30715            function n() {
30716                var e = Sa(t);
30717                if (null === e) throw new Error("Malformed timestamp: " + i);
30718                return t = t.replace(/^[^\sa-zA-Z-]+/, ""), e
30719            }
30720
30721            function a() {
30722                t = t.replace(/^\s+/, "")
30723            }
30724            if (a(), e.startTime = n(), a(), "-->" !== t.slice(0, 3)) throw new Error("Malformed time stamp (time stamps must be separated by '-->'): " + i);
30725            t = t.slice(3), a(), e.endTime = n(), a(),
30726                function (t, e) {
30727                    var i = new La;
30728                    Aa(t, (function (t, e) {
30729                        var n;
30730                        switch (t) {
30731                        case "region":
30732                            for (var a = r.length - 1; a >= 0; a--)
30733                                if (r[a].id === e) {
30734                                    i.set(t, r[a].region);
30735                                    break
30736                                } break;
30737                        case "vertical":
30738                            i.alt(t, e, ["rl", "lr"]);
30739                            break;
30740                        case "line":
30741                            n = e.split(","), i.integer(t, n[0]), i.percent(t, n[0]) && i.set("snapToLines", !1), i.alt(t, n[0], ["auto"]), 2 === n.length && i.alt("lineAlign", n[1], ["start", ka, "end"]);
30742                            break;
30743                        case "position":
30744                            n = e.split(","), i.percent(t, n[0]), 2 === n.length && i.alt("positionAlign", n[1], ["start", ka, "end", "line-left", "line-right", "auto"]);
30745                            break;
30746                        case "size":
30747                            i.percent(t, e);
30748                            break;
30749                        case "align":
30750                            i.alt(t, e, ["start", ka, "end", "left", "right"])
30751                        }
30752                    }), /:/, /\s/), e.region = i.get("region", null), e.vertical = i.get("vertical", "");
30753                    var n = i.get("line", "auto");
30754                    "auto" === n && -1 === Ra.line && (n = -1), e.line = n, e.lineAlign = i.get("lineAlign", "start"), e.snapToLines = i.get("snapToLines", !0), e.size = i.get("size", 100), e.align = i.get("align", ka);
30755                    var a = i.get("position", "auto");
30756                    "auto" === a && 50 === Ra.position && (a = "start" === e.align || "left" === e.align ? 0 : "end" === e.align || "right" === e.align ? 100 : 50), e.position = a
30757                }(t, e)
30758        }
30759
30760        function Da(t) {
30761            return t.replace(/<br(?: \/)?>/gi, "\n")
30762        }
30763        var Ia = function () {
30764                function t() {
30765                    this.state = "INITIAL", this.buffer = "", this.decoder = new Ta, this.regionList = [], this.cue = null, this.oncue = void 0, this.onparsingerror = void 0, this.onflush = void 0
30766                }
30767                var e = t.prototype;
30768                return e.parse = function (t) {
30769                    var e = this;
30770
30771                    function r() {
30772                        var t = e.buffer,
30773                            r = 0;
30774                        for (t = Da(t); r < t.length && "\r" !== t[r] && "\n" !== t[r];) ++r;
30775                        var i = t.slice(0, r);
30776                        return "\r" === t[r] && ++r, "\n" === t[r] && ++r, e.buffer = t.slice(r), i
30777                    }
30778                    t && (e.buffer += e.decoder.decode(t, {
30779                        stream: !0
30780                    }));
30781                    try {
30782                        var i = "";
30783                        if ("INITIAL" === e.state) {
30784                            if (!/\r\n|\n/.test(e.buffer)) return this;
30785                            var n = (i = r()).match(/^()?WEBVTT([ \t].*)?$/);
30786                            if (null == n || !n[0]) throw new Error("Malformed WebVTT signature.");
30787                            e.state = "HEADER"
30788                        }
30789                        for (var a = !1; e.buffer;) {
30790                            if (!/\r\n|\n/.test(e.buffer)) return this;
30791                            switch (a ? a = !1 : i = r(), e.state) {
30792                            case "HEADER":
30793                                /:/.test(i) ? Aa(i, (function (t, e) {}), /:/) : i || (e.state = "ID");
30794                                continue;
30795                            case "NOTE":
30796                                i || (e.state = "ID");
30797                                continue;
30798                            case "ID":
30799                                if (/^NOTE($|[ \t])/.test(i)) {
30800                                    e.state = "NOTE";
30801                                    break
30802                                }
30803                                if (!i) continue;
30804                                if (e.cue = new Ea(0, 0, ""), e.state = "CUE", -1 === i.indexOf("-->")) {
30805                                    e.cue.id = i;
30806                                    continue
30807                                }
30808                                case "CUE":
30809                                    if (!e.cue) {
30810                                        e.state = "BADCUE";
30811                                        continue
30812                                    }
30813                                    try {
30814                                        ba(i, e.cue, e.regionList)
30815                                    } catch (t) {
30816                                        e.cue = null, e.state = "BADCUE";
30817                                        continue
30818                                    }
30819                                    e.state = "CUETEXT";
30820                                    continue;
30821                                case "CUETEXT":
30822                                    var s = -1 !== i.indexOf("-->");
30823                                    if (!i || s && (a = !0)) {
30824                                        e.oncue && e.cue && e.oncue(e.cue), e.cue = null, e.state = "ID";
30825                                        continue
30826                                    }
30827                                    if (null === e.cue) continue;
30828                                    e.cue.text && (e.cue.text += "\n"), e.cue.text += i;
30829                                    continue;
30830                                case "BADCUE":
30831                                    i || (e.state = "ID")
30832                            }
30833                        }
30834                    } catch (t) {
30835                        "CUETEXT" === e.state && e.cue && e.oncue && e.oncue(e.cue), e.cue = null, e.state = "INITIAL" === e.state ? "BADWEBVTT" : "BADCUE"
30836                    }
30837                    return this
30838                }, e.flush = function () {
30839                    var t = this;
30840                    try {
30841                        if ((t.cue || "HEADER" === t.state) && (t.buffer += "\n\n", t.parse()), "INITIAL" === t.state || "BADWEBVTT" === t.state) throw new Error("Malformed WebVTT signature.")
30842                    } catch (e) {
30843                        t.onparsingerror && t.onparsingerror(e)
30844                    }
30845                    return t.onflush && t.onflush(), this
30846                }, t
30847            }(),
30848            wa = /\r\n|\n\r|\n|\r/g,
30849            Ca = function (t, e, r) {
30850                return void 0 === r && (r = 0), t.slice(r, r + e.length) === e
30851            },
30852            _a = function (t) {
30853                for (var e = 5381, r = t.length; r;) e = 33 * e ^ t.charCodeAt(--r);
30854                return (e >>> 0).toString()
30855            };
30856
30857        function xa(t, e, r) {
30858            return _a(t.toString()) + _a(e.toString()) + _a(r)
30859        }
30860
30861        function Pa(t, e, r, i, n, a, s) {
30862            var o, l, u, h = new Ia,
30863                d = Tt(new Uint8Array(t)).trim().replace(wa, "\n").split("\n"),
30864                c = [],
30865                f = e ? (o = e.baseTime, void 0 === (l = e.timescale) && (l = 1), yn(o, pn, 1 / l)) : 0,
30866                g = "00:00.000",
30867                v = 0,
30868                m = 0,
30869                p = !0;
30870            h.oncue = function (t) {
30871                var a = r[i],
30872                    s = r.ccOffset,
30873                    o = (v - f) / 9e4;
30874                if (null != a && a.new && (void 0 !== m ? s = r.ccOffset = a.start : function (t, e, r) {
30875                        var i = t[e],
30876                            n = t[i.prevCC];
30877                        if (!n || !n.new && i.new) return t.ccOffset = t.presentationOffset = i.start, void(i.new = !1);
30878                        for (; null != (a = n) && a.new;) {
30879                            var a;
30880                            t.ccOffset += i.start - n.start, i.new = !1, n = t[(i = n).prevCC]
30881                        }
30882                        t.presentationOffset = r
30883                    }(r, i, o)), o) {
30884                    if (!e) return void(u = new Error("Missing initPTS for VTT MPEGTS"));
30885                    s = o - r.presentationOffset
30886                }
30887                var l = t.endTime - t.startTime,
30888                    h = An(9e4 * (t.startTime + s - m), 9e4 * n) / 9e4;
30889                t.startTime = Math.max(h, 0), t.endTime = Math.max(h + l, 0);
30890                var d = t.text.trim();
30891                t.text = decodeURIComponent(encodeURIComponent(d)), t.id || (t.id = xa(t.startTime, t.endTime, d)), t.endTime > 0 && c.push(t)
30892            }, h.onparsingerror = function (t) {
30893                u = t
30894            }, h.onflush = function () {
30895                u ? s(u) : a(c)
30896            }, d.forEach((function (t) {
30897                if (p) {
30898                    if (Ca(t, "X-TIMESTAMP-MAP=")) {
30899                        p = !1, t.slice(16).split(",").forEach((function (t) {
30900                            Ca(t, "LOCAL:") ? g = t.slice(6) : Ca(t, "MPEGTS:") && (v = parseInt(t.slice(7)))
30901                        }));
30902                        try {
30903                            m = function (t) {
30904                                var e = parseInt(t.slice(-3)),
30905                                    r = parseInt(t.slice(-6, -4)),
30906                                    i = parseInt(t.slice(-9, -7)),
30907                                    n = t.length > 9 ? parseInt(t.substring(0, t.indexOf(":"))) : 0;
30908                                if (!(y(e) && y(r) && y(i) && y(n))) throw Error("Malformed X-TIMESTAMP-MAP: Local:" + t);
30909                                return e += 1e3 * r, (e += 6e4 * i) + 36e5 * n
30910                            }(g) / 1e3
30911                        } catch (t) {
30912                            u = t
30913                        }
30914                        return
30915                    }
30916                    "" === t && (p = !1)
30917                }
30918                h.parse(t + "\n")
30919            })), h.flush()
30920        }
30921        var Fa = "stpp.ttml.im1t",
30922            Ma = /^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,
30923            Oa = /^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,
30924            Na = {
30925                left: "start",
30926                center: "center",
30927                right: "end",
30928                start: "start",
30929                end: "end"
30930            };
30931
30932        function Ua(t, e, r, i) {
30933            var n = xt(new Uint8Array(t), ["mdat"]);
30934            if (0 !== n.length) {
30935                var a, s, l, u, h = n.map((function (t) {
30936                        return Tt(t)
30937                    })),
30938                    d = (a = e.baseTime, s = 1, void 0 === (l = e.timescale) && (l = 1), void 0 === u && (u = !1), yn(a, s, 1 / l, u));
30939                try {
30940                    h.forEach((function (t) {
30941                        return r(function (t, e) {
30942                            var r = (new DOMParser).parseFromString(t, "text/xml"),
30943                                i = r.getElementsByTagName("tt")[0];
30944                            if (!i) throw new Error("Invalid ttml");
30945                            var n = {
30946                                    frameRate: 30,
30947                                    subFrameRate: 1,
30948                                    frameRateMultiplier: 0,
30949                                    tickRate: 0
30950                                },
30951                                a = Object.keys(n).reduce((function (t, e) {
30952                                    return t[e] = i.getAttribute("ttp:" + e) || n[e], t
30953                                }), {}),
30954                                s = "preserve" !== i.getAttribute("xml:space"),
30955                                l = Ga(Ba(i, "styling", "style")),
30956                                u = Ga(Ba(i, "layout", "region")),
30957                                h = Ba(i, "body", "[begin]");
30958                            return [].map.call(h, (function (t) {
30959                                var r = Ka(t, s);
30960                                if (!r || !t.hasAttribute("begin")) return null;
30961                                var i = Ya(t.getAttribute("begin"), a),
30962                                    n = Ya(t.getAttribute("dur"), a),
30963                                    h = Ya(t.getAttribute("end"), a);
30964                                if (null === i) throw Va(t);
30965                                if (null === h) {
30966                                    if (null === n) throw Va(t);
30967                                    h = i + n
30968                                }
30969                                var d = new Ea(i - e, h - e, r);
30970                                d.id = xa(d.startTime, d.endTime, d.text);
30971                                var c = function (t, e, r) {
30972                                        var i = "http://www.w3.org/ns/ttml#styling",
30973                                            n = null,
30974                                            a = ["displayAlign", "textAlign", "color", "backgroundColor", "fontSize", "fontFamily"],
30975                                            s = null != t && t.hasAttribute("style") ? t.getAttribute("style") : null;
30976                                        return s && r.hasOwnProperty(s) && (n = r[s]), a.reduce((function (r, a) {
30977                                            var s = Ha(e, i, a) || Ha(t, i, a) || Ha(n, i, a);
vendor: 96,199 bytes, lines 30978-32623
30978                                            return s && (r[a] = s), r
30979                                        }), {})
30980                                    }(u[t.getAttribute("region")], l[t.getAttribute("style")], l),
30981                                    f = c.textAlign;
30982                                if (f) {
30983                                    var g = Na[f];
30984                                    g && (d.lineAlign = g), d.align = f
30985                                }
30986                                return o(d, c), d
30987                            })).filter((function (t) {
30988                                return null !== t
30989                            }))
30990                        }(t, d))
30991                    }))
30992                } catch (t) {
30993                    i(t)
30994                }
30995            } else i(new Error("Could not parse IMSC1 mdat"))
30996        }
30997
30998        function Ba(t, e, r) {
30999            var i = t.getElementsByTagName(e)[0];
31000            return i ? [].slice.call(i.querySelectorAll(r)) : []
31001        }
31002
31003        function Ga(t) {
31004            return t.reduce((function (t, e) {
31005                var r = e.getAttribute("xml:id");
31006                return r && (t[r] = e), t
31007            }), {})
31008        }
31009
31010        function Ka(t, e) {
31011            return [].slice.call(t.childNodes).reduce((function (t, r, i) {
31012                var n;
31013                return "br" === r.nodeName && i ? t + "\n" : null != (n = r.childNodes) && n.length ? Ka(r, e) : e ? t + r.textContent.trim().replace(/\s+/g, " ") : t + r.textContent
31014            }), "")
31015        }
31016
31017        function Ha(t, e, r) {
31018            return t && t.hasAttributeNS(e, r) ? t.getAttributeNS(e, r) : null
31019        }
31020
31021        function Va(t) {
31022            return new Error("Could not parse ttml timestamp " + t)
31023        }
31024
31025        function Ya(t, e) {
31026            if (!t) return null;
31027            var r = Sa(t);
31028            return null === r && (Ma.test(t) ? r = function (t, e) {
31029                var r = Ma.exec(t),
31030                    i = (0 | r[4]) + (0 | r[5]) / e.subFrameRate;
31031                return 3600 * (0 | r[1]) + 60 * (0 | r[2]) + (0 | r[3]) + i / e.frameRate
31032            }(t, e) : Oa.test(t) && (r = function (t, e) {
31033                var r = Oa.exec(t),
31034                    i = Number(r[1]);
31035                switch (r[2]) {
31036                case "h":
31037                    return 3600 * i;
31038                case "m":
31039                    return 60 * i;
31040                case "ms":
31041                    return 1e3 * i;
31042                case "f":
31043                    return i / e.frameRate;
31044                case "t":
31045                    return i / e.tickRate
31046                }
31047                return i
31048            }(t, e))), r
31049        }
31050        var Wa = function () {
31051            function t(t) {
31052                this.hls = void 0, this.media = null, this.config = void 0, this.enabled = !0, this.Cues = void 0, this.textTracks = [], this.tracks = [], this.initPTS = [], this.unparsedVttFrags = [], this.captionsTracks = {}, this.nonNativeCaptionsTracks = {}, this.cea608Parser1 = void 0, this.cea608Parser2 = void 0, this.lastCc = -1, this.lastSn = -1, this.lastPartIndex = -1, this.prevCC = -1, this.vttCCs = {
31053                    ccOffset: 0,
31054                    presentationOffset: 0,
31055                    0: {
31056                        start: 0,
31057                        prevCC: -1,
31058                        new: !0
31059                    }
31060                }, this.captionsProperties = void 0, this.hls = t, this.config = t.config, this.Cues = t.config.cueHandler, this.captionsProperties = {
31061                    textTrack1: {
31062                        label: this.config.captionsTextTrack1Label,
31063                        languageCode: this.config.captionsTextTrack1LanguageCode
31064                    },
31065                    textTrack2: {
31066                        label: this.config.captionsTextTrack2Label,
31067                        languageCode: this.config.captionsTextTrack2LanguageCode
31068                    },
31069                    textTrack3: {
31070                        label: this.config.captionsTextTrack3Label,
31071                        languageCode: this.config.captionsTextTrack3LanguageCode
31072                    },
31073                    textTrack4: {
31074                        label: this.config.captionsTextTrack4Label,
31075                        languageCode: this.config.captionsTextTrack4LanguageCode
31076                    }
31077                }, t.on(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(S.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.on(S.FRAG_LOADING, this.onFragLoading, this), t.on(S.FRAG_LOADED, this.onFragLoaded, this), t.on(S.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), t.on(S.FRAG_DECRYPTED, this.onFragDecrypted, this), t.on(S.INIT_PTS_FOUND, this.onInitPtsFound, this), t.on(S.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), t.on(S.BUFFER_FLUSHING, this.onBufferFlushing, this)
31078            }
31079            var e = t.prototype;
31080            return e.destroy = function () {
31081                var t = this.hls;
31082                t.off(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(S.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.off(S.FRAG_LOADING, this.onFragLoading, this), t.off(S.FRAG_LOADED, this.onFragLoaded, this), t.off(S.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), t.off(S.FRAG_DECRYPTED, this.onFragDecrypted, this), t.off(S.INIT_PTS_FOUND, this.onInitPtsFound, this), t.off(S.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), t.off(S.BUFFER_FLUSHING, this.onBufferFlushing, this), this.hls = this.config = null, this.cea608Parser1 = this.cea608Parser2 = void 0
31083            }, e.initCea608Parsers = function () {
31084                if (this.config.enableCEA708Captions && (!this.cea608Parser1 || !this.cea608Parser2)) {
31085                    var t = new ya(this, "textTrack1"),
31086                        e = new ya(this, "textTrack2"),
31087                        r = new ya(this, "textTrack3"),
31088                        i = new ya(this, "textTrack4");
31089                    this.cea608Parser1 = new ma(1, t, e), this.cea608Parser2 = new ma(3, r, i)
31090                }
31091            }, e.addCues = function (t, e, r, i, n) {
31092                for (var a, s, o, l, u = !1, h = n.length; h--;) {
31093                    var d = n[h],
31094                        c = (a = d[0], s = d[1], o = e, l = r, Math.min(s, l) - Math.max(a, o));
31095                    if (c >= 0 && (d[0] = Math.min(d[0], e), d[1] = Math.max(d[1], r), u = !0, c / (r - e) > .5)) return
31096                }
31097                if (u || n.push([e, r]), this.config.renderTextTracksNatively) {
31098                    var f = this.captionsTracks[t];
31099                    this.Cues.newCue(f, e, r, i)
31100                } else {
31101                    var g = this.Cues.newCue(null, e, r, i);
31102                    this.hls.trigger(S.CUES_PARSED, {
31103                        type: "captions",
31104                        cues: g,
31105                        track: t
31106                    })
31107                }
31108            }, e.onInitPtsFound = function (t, e) {
31109                var r = this,
31110                    i = e.frag,
31111                    n = e.id,
31112                    a = e.initPTS,
31113                    s = e.timescale,
31114                    o = this.unparsedVttFrags;
31115                "main" === n && (this.initPTS[i.cc] = {
31116                    baseTime: a,
31117                    timescale: s
31118                }), o.length && (this.unparsedVttFrags = [], o.forEach((function (t) {
31119                    r.onFragLoaded(S.FRAG_LOADED, t)
31120                })))
31121            }, e.getExistingTrack = function (t, e) {
31122                var r = this.media;
31123                if (r)
31124                    for (var i = 0; i < r.textTracks.length; i++) {
31125                        var n = r.textTracks[i];
31126                        if (qa(n, {
31127                                name: t,
31128                                lang: e,
31129                                attrs: {}
31130                            })) return n
31131                    }
31132                return null
31133            }, e.createCaptionsTrack = function (t) {
31134                this.config.renderTextTracksNatively ? this.createNativeTrack(t) : this.createNonNativeTrack(t)
31135            }, e.createNativeTrack = function (t) {
31136                if (!this.captionsTracks[t]) {
31137                    var e = this.captionsProperties,
31138                        r = this.captionsTracks,
31139                        i = this.media,
31140                        n = e[t],
31141                        a = n.label,
31142                        s = n.languageCode,
31143                        o = this.getExistingTrack(a, s);
31144                    if (o) r[t] = o, Ne(r[t]), Me(r[t], i);
31145                    else {
31146                        var l = this.createTextTrack("captions", a, s);
31147                        l && (l[t] = !0, r[t] = l)
31148                    }
31149                }
31150            }, e.createNonNativeTrack = function (t) {
31151                if (!this.nonNativeCaptionsTracks[t]) {
31152                    var e = this.captionsProperties[t];
31153                    if (e) {
31154                        var r = {
31155                            _id: t,
31156                            label: e.label,
31157                            kind: "captions",
31158                            default: !!e.media && !!e.media.default,
31159                            closedCaptions: e.media
31160                        };
31161                        this.nonNativeCaptionsTracks[t] = r, this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND, {
31162                            tracks: [r]
31163                        })
31164                    }
31165                }
31166            }, e.createTextTrack = function (t, e, r) {
31167                var i = this.media;
31168                if (i) return i.addTextTrack(t, e, r)
31169            }, e.onMediaAttaching = function (t, e) {
31170                this.media = e.media, this._cleanTracks()
31171            }, e.onMediaDetaching = function () {
31172                var t = this.captionsTracks;
31173                Object.keys(t).forEach((function (e) {
31174                    Ne(t[e]), delete t[e]
31175                })), this.nonNativeCaptionsTracks = {}
31176            }, e.onManifestLoading = function () {
31177                this.lastCc = -1, this.lastSn = -1, this.lastPartIndex = -1, this.prevCC = -1, this.vttCCs = {
31178                    ccOffset: 0,
31179                    presentationOffset: 0,
31180                    0: {
31181                        start: 0,
31182                        prevCC: -1,
31183                        new: !0
31184                    }
31185                }, this._cleanTracks(), this.tracks = [], this.captionsTracks = {}, this.nonNativeCaptionsTracks = {}, this.textTracks = [], this.unparsedVttFrags = [], this.initPTS = [], this.cea608Parser1 && this.cea608Parser2 && (this.cea608Parser1.reset(), this.cea608Parser2.reset())
31186            }, e._cleanTracks = function () {
31187                var t = this.media;
31188                if (t) {
31189                    var e = t.textTracks;
31190                    if (e)
31191                        for (var r = 0; r < e.length; r++) Ne(e[r])
31192                }
31193            }, e.onSubtitleTracksUpdated = function (t, e) {
31194                var r = this,
31195                    i = e.subtitleTracks || [],
31196                    n = i.some((function (t) {
31197                        return t.textCodec === Fa
31198                    }));
31199                if (this.config.enableWebVTT || n && this.config.enableIMSC1) {
31200                    if (Hn(this.tracks, i)) return void(this.tracks = i);
31201                    if (this.textTracks = [], this.tracks = i, this.config.renderTextTracksNatively) {
31202                        var a = this.media,
31203                            s = a ? Be(a.textTracks) : null;
31204                        if (this.tracks.forEach((function (t, e) {
31205                                var i;
31206                                if (s) {
31207                                    for (var n = null, a = 0; a < s.length; a++)
31208                                        if (s[a] && qa(s[a], t)) {
31209                                            n = s[a], s[a] = null;
31210                                            break
31211                                        } n && (i = n)
31212                                }
31213                                if (i) Ne(i);
31214                                else {
31215                                    var o = ja(t);
31216                                    (i = r.createTextTrack(o, t.name, t.lang)) && (i.mode = "disabled")
31217                                }
31218                                i && r.textTracks.push(i)
31219                            })), null != s && s.length) {
31220                            var o = s.filter((function (t) {
31221                                return null !== t
31222                            })).map((function (t) {
31223                                return t.label
31224                            }));
31225                            o.length && w.warn("Media element contains unused subtitle tracks: " + o.join(", ") + ". Replace media element for each source to clear TextTracks and captions menu.")
31226                        }
31227                    } else if (this.tracks.length) {
31228                        var l = this.tracks.map((function (t) {
31229                            return {
31230                                label: t.name,
31231                                kind: t.type.toLowerCase(),
31232                                default: t.default,
31233                                subtitleTrack: t
31234                            }
31235                        }));
31236                        this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND, {
31237                            tracks: l
31238                        })
31239                    }
31240                }
31241            }, e.onManifestLoaded = function (t, e) {
31242                var r = this;
31243                this.config.enableCEA708Captions && e.captions && e.captions.forEach((function (t) {
31244                    var e = /(?:CC|SERVICE)([1-4])/.exec(t.instreamId);
31245                    if (e) {
31246                        var i = "textTrack" + e[1],
31247                            n = r.captionsProperties[i];
31248                        n && (n.label = t.name, t.lang && (n.languageCode = t.lang), n.media = t)
31249                    }
31250                }))
31251            }, e.closedCaptionsForLevel = function (t) {
31252                var e = this.hls.levels[t.level];
31253                return null == e ? void 0 : e.attrs["CLOSED-CAPTIONS"]
31254            }, e.onFragLoading = function (t, e) {
31255                if (this.enabled && e.frag.type === we) {
31256                    var r, i, n = this.cea608Parser1,
31257                        a = this.cea608Parser2,
31258                        s = this.lastSn,
31259                        o = e.frag,
31260                        l = o.cc,
31261                        u = o.sn,
31262                        h = null != (r = null == (i = e.part) ? void 0 : i.index) ? r : -1;
31263                    n && a && (u !== s + 1 || u === s && h !== this.lastPartIndex + 1 || l !== this.lastCc) && (n.reset(), a.reset()), this.lastCc = l, this.lastSn = u, this.lastPartIndex = h
31264                }
31265            }, e.onFragLoaded = function (t, e) {
31266                var r = e.frag,
31267                    i = e.payload;
31268                if (r.type === _e)
31269                    if (i.byteLength) {
31270                        var n = r.decryptdata,
31271                            a = "stats" in e;
31272                        if (null == n || !n.encrypted || a) {
31273                            var s = this.tracks[r.level],
31274                                o = this.vttCCs;
31275                            o[r.cc] || (o[r.cc] = {
31276                                start: r.start,
31277                                prevCC: this.prevCC,
31278                                new: !0
31279                            }, this.prevCC = r.cc), s && s.textCodec === Fa ? this._parseIMSC1(r, i) : this._parseVTTs(e)
31280                        }
31281                    } else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED, {
31282                        success: !1,
31283                        frag: r,
31284                        error: new Error("Empty subtitle payload")
31285                    })
31286            }, e._parseIMSC1 = function (t, e) {
31287                var r = this,
31288                    i = this.hls;
31289                Ua(e, this.initPTS[t.cc], (function (e) {
31290                    r._appendCues(e, t.level), i.trigger(S.SUBTITLE_FRAG_PROCESSED, {
31291                        success: !0,
31292                        frag: t
31293                    })
31294                }), (function (e) {
31295                    w.log("Failed to parse IMSC1: " + e), i.trigger(S.SUBTITLE_FRAG_PROCESSED, {
31296                        success: !1,
31297                        frag: t,
31298                        error: e
31299                    })
31300                }))
31301            }, e._parseVTTs = function (t) {
31302                var e, r = this,
31303                    i = t.frag,
31304                    n = t.payload,
31305                    a = this.initPTS,
31306                    s = this.unparsedVttFrags,
31307                    o = a.length - 1;
31308                if (a[i.cc] || -1 !== o) {
31309                    var l = this.hls;
31310                    Pa(null != (e = i.initSegment) && e.data ? Kt(i.initSegment.data, new Uint8Array(n)) : n, this.initPTS[i.cc], this.vttCCs, i.cc, i.start, (function (t) {
31311                        r._appendCues(t, i.level), l.trigger(S.SUBTITLE_FRAG_PROCESSED, {
31312                            success: !0,
31313                            frag: i
31314                        })
31315                    }), (function (e) {
31316                        var a = "Missing initPTS for VTT MPEGTS" === e.message;
31317                        a ? s.push(t) : r._fallbackToIMSC1(i, n), w.log("Failed to parse VTT cue: " + e), a && o > i.cc || l.trigger(S.SUBTITLE_FRAG_PROCESSED, {
31318                            success: !1,
31319                            frag: i,
31320                            error: e
31321                        })
31322                    }))
31323                } else s.push(t)
31324            }, e._fallbackToIMSC1 = function (t, e) {
31325                var r = this,
31326                    i = this.tracks[t.level];
31327                i.textCodec || Ua(e, this.initPTS[t.cc], (function () {
31328                    i.textCodec = Fa, r._parseIMSC1(t, e)
31329                }), (function () {
31330                    i.textCodec = "wvtt"
31331                }))
31332            }, e._appendCues = function (t, e) {
31333                var r = this.hls;
31334                if (this.config.renderTextTracksNatively) {
31335                    var i = this.textTracks[e];
31336                    if (!i || "disabled" === i.mode) return;
31337                    t.forEach((function (t) {
31338                        return Oe(i, t)
31339                    }))
31340                } else {
31341                    var n = this.tracks[e];
31342                    if (!n) return;
31343                    var a = n.default ? "default" : "subtitles" + e;
31344                    r.trigger(S.CUES_PARSED, {
31345                        type: "subtitles",
31346                        cues: t,
31347                        track: a
31348                    })
31349                }
31350            }, e.onFragDecrypted = function (t, e) {
31351                e.frag.type === _e && this.onFragLoaded(S.FRAG_LOADED, e)
31352            }, e.onSubtitleTracksCleared = function () {
31353                this.tracks = [], this.captionsTracks = {}
31354            }, e.onFragParsingUserdata = function (t, e) {
31355                this.initCea608Parsers();
31356                var r = this.cea608Parser1,
31357                    i = this.cea608Parser2;
31358                if (this.enabled && r && i) {
31359                    var n = e.frag,
31360                        a = e.samples;
31361                    if (n.type !== we || "NONE" !== this.closedCaptionsForLevel(n))
31362                        for (var s = 0; s < a.length; s++) {
31363                            var o = a[s].bytes;
31364                            if (o) {
31365                                var l = this.extractCea608Data(o);
31366                                r.addData(a[s].pts, l[0]), i.addData(a[s].pts, l[1])
31367                            }
31368                        }
31369                }
31370            }, e.onBufferFlushing = function (t, e) {
31371                var r = e.startOffset,
31372                    i = e.endOffset,
31373                    n = e.endOffsetSubtitles,
31374                    a = e.type,
31375                    s = this.media;
31376                if (s && !(s.currentTime < i)) {
31377                    if (!a || "video" === a) {
31378                        var o = this.captionsTracks;
31379                        Object.keys(o).forEach((function (t) {
31380                            return Ue(o[t], r, i)
31381                        }))
31382                    }
31383                    if (this.config.renderTextTracksNatively && 0 === r && void 0 !== n) {
31384                        var l = this.textTracks;
31385                        Object.keys(l).forEach((function (t) {
31386                            return Ue(l[t], r, n)
31387                        }))
31388                    }
31389                }
31390            }, e.extractCea608Data = function (t) {
31391                for (var e = [
31392                        [],
31393                        []
31394                    ], r = 31 & t[0], i = 2, n = 0; n < r; n++) {
31395                    var a = t[i++],
31396                        s = 127 & t[i++],
31397                        o = 127 & t[i++];
31398                    if ((0 !== s || 0 !== o) && 0 != (4 & a)) {
31399                        var l = 3 & a;
31400                        0 !== l && 1 !== l || (e[l].push(s), e[l].push(o))
31401                    }
31402                }
31403                return e
31404            }, t
31405        }();
31406
31407        function ja(t) {
31408            return t.characteristics && /transcribes-spoken-dialog/gi.test(t.characteristics) && /describes-music-and-sound/gi.test(t.characteristics) ? "captions" : "subtitles"
31409        }
31410
31411        function qa(t, e) {
31412            return !!t && t.kind === ja(e) && Yn(e, t)
31413        }
31414        var Xa = function () {
31415                function t(t) {
31416                    this.hls = void 0, this.autoLevelCapping = void 0, this.firstLevel = void 0, this.media = void 0, this.restrictedLevels = void 0, this.timer = void 0, this.clientRect = void 0, this.streamController = void 0, this.hls = t, this.autoLevelCapping = Number.POSITIVE_INFINITY, this.firstLevel = -1, this.media = null, this.restrictedLevels = [], this.timer = void 0, this.clientRect = null, this.registerListeners()
31417                }
31418                var e = t.prototype;
31419                return e.setStreamController = function (t) {
31420                    this.streamController = t
31421                }, e.destroy = function () {
31422                    this.hls && this.unregisterListener(), this.timer && this.stopCapping(), this.media = null, this.clientRect = null, this.hls = this.streamController = null
31423                }, e.registerListeners = function () {
31424                    var t = this.hls;
31425                    t.on(S.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), t.on(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(S.BUFFER_CODECS, this.onBufferCodecs, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this)
31426                }, e.unregisterListener = function () {
31427                    var t = this.hls;
31428                    t.off(S.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), t.off(S.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(S.BUFFER_CODECS, this.onBufferCodecs, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this)
31429                }, e.onFpsDropLevelCapping = function (t, e) {
31430                    var r = this.hls.levels[e.droppedLevel];
31431                    this.isLevelAllowed(r) && this.restrictedLevels.push({
31432                        bitrate: r.bitrate,
31433                        height: r.height,
31434                        width: r.width
31435                    })
31436                }, e.onMediaAttaching = function (t, e) {
31437                    this.media = e.media instanceof HTMLVideoElement ? e.media : null, this.clientRect = null, this.timer && this.hls.levels.length && this.detectPlayerSize()
31438                }, e.onManifestParsed = function (t, e) {
31439                    var r = this.hls;
31440                    this.restrictedLevels = [], this.firstLevel = e.firstLevel, r.config.capLevelToPlayerSize && e.video && this.startCapping()
31441                }, e.onLevelsUpdated = function (t, e) {
31442                    this.timer && y(this.autoLevelCapping) && this.detectPlayerSize()
31443                }, e.onBufferCodecs = function (t, e) {
31444                    this.hls.config.capLevelToPlayerSize && e.video && this.startCapping()
31445                }, e.onMediaDetaching = function () {
31446                    this.stopCapping()
31447                }, e.detectPlayerSize = function () {
31448                    if (this.media) {
31449                        if (this.mediaHeight <= 0 || this.mediaWidth <= 0) return void(this.clientRect = null);
31450                        var t = this.hls.levels;
31451                        if (t.length) {
31452                            var e = this.hls,
31453                                r = this.getMaxLevel(t.length - 1);
31454                            r !== this.autoLevelCapping && w.log("Setting autoLevelCapping to " + r + ": " + t[r].height + "p@" + t[r].bitrate + " for media " + this.mediaWidth + "x" + this.mediaHeight), e.autoLevelCapping = r, e.autoLevelCapping > this.autoLevelCapping && this.streamController && this.streamController.nextLevelSwitch(), this.autoLevelCapping = e.autoLevelCapping
31455                        }
31456                    }
31457                }, e.getMaxLevel = function (e) {
31458                    var r = this,
31459                        i = this.hls.levels;
31460                    if (!i.length) return -1;
31461                    var n = i.filter((function (t, i) {
31462                        return r.isLevelAllowed(t) && i <= e
31463                    }));
31464                    return this.clientRect = null, t.getMaxLevelByMediaSize(n, this.mediaWidth, this.mediaHeight)
31465                }, e.startCapping = function () {
31466                    this.timer || (this.autoLevelCapping = Number.POSITIVE_INFINITY, self.clearInterval(this.timer), this.timer = self.setInterval(this.detectPlayerSize.bind(this), 1e3), this.detectPlayerSize())
31467                }, e.stopCapping = function () {
31468                    this.restrictedLevels = [], this.firstLevel = -1, this.autoLevelCapping = Number.POSITIVE_INFINITY, this.timer && (self.clearInterval(this.timer), this.timer = void 0)
31469                }, e.getDimensions = function () {
31470                    if (this.clientRect) return this.clientRect;
31471                    var t = this.media,
31472                        e = {
31473                            width: 0,
31474                            height: 0
31475                        };
31476                    if (t) {
31477                        var r = t.getBoundingClientRect();
31478                        e.width = r.width, e.height = r.height, e.width || e.height || (e.width = r.right - r.left || t.width || 0, e.height = r.bottom - r.top || t.height || 0)
31479                    }
31480                    return this.clientRect = e, e
31481                }, e.isLevelAllowed = function (t) {
31482                    return !this.restrictedLevels.some((function (e) {
31483                        return t.bitrate === e.bitrate && t.width === e.width && t.height === e.height
31484                    }))
31485                }, t.getMaxLevelByMediaSize = function (t, e, r) {
31486                    if (null == t || !t.length) return -1;
31487                    for (var i, n, a = t.length - 1, s = Math.max(e, r), o = 0; o < t.length; o += 1) {
31488                        var l = t[o];
31489                        if ((l.width >= s || l.height >= s) && (i = l, !(n = t[o + 1]) || i.width !== n.width || i.height !== n.height)) {
31490                            a = o;
31491                            break
31492                        }
31493                    }
31494                    return a
31495                }, s(t, [{
31496                    key: "mediaWidth",
31497                    get: function () {
31498                        return this.getDimensions().width * this.contentScaleFactor
31499                    }
31500                }, {
31501                    key: "mediaHeight",
31502                    get: function () {
31503                        return this.getDimensions().height * this.contentScaleFactor
31504                    }
31505                }, {
31506                    key: "contentScaleFactor",
31507                    get: function () {
31508                        var t = 1;
31509                        if (!this.hls.config.ignoreDevicePixelRatio) try {
31510                            t = self.devicePixelRatio
31511                        } catch (t) {}
31512                        return t
31513                    }
31514                }]), t
31515            }(),
31516            za = function () {
31517                function t(t) {
31518                    this.hls = void 0, this.isVideoPlaybackQualityAvailable = !1, this.timer = void 0, this.media = null, this.lastTime = void 0, this.lastDroppedFrames = 0, this.lastDecodedFrames = 0, this.streamController = void 0, this.hls = t, this.registerListeners()
31519                }
31520                var e = t.prototype;
31521                return e.setStreamController = function (t) {
31522                    this.streamController = t
31523                }, e.registerListeners = function () {
31524                    this.hls.on(S.MEDIA_ATTACHING, this.onMediaAttaching, this)
31525                }, e.unregisterListeners = function () {
31526                    this.hls.off(S.MEDIA_ATTACHING, this.onMediaAttaching, this)
31527                }, e.destroy = function () {
31528                    this.timer && clearInterval(this.timer), this.unregisterListeners(), this.isVideoPlaybackQualityAvailable = !1, this.media = null
31529                }, e.onMediaAttaching = function (t, e) {
31530                    var r = this.hls.config;
31531                    if (r.capLevelOnFPSDrop) {
31532                        var i = e.media instanceof self.HTMLVideoElement ? e.media : null;
31533                        this.media = i, i && "function" == typeof i.getVideoPlaybackQuality && (this.isVideoPlaybackQualityAvailable = !0), self.clearInterval(this.timer), this.timer = self.setInterval(this.checkFPSInterval.bind(this), r.fpsDroppedMonitoringPeriod)
31534                    }
31535                }, e.checkFPS = function (t, e, r) {
31536                    var i = performance.now();
31537                    if (e) {
31538                        if (this.lastTime) {
31539                            var n = i - this.lastTime,
31540                                a = r - this.lastDroppedFrames,
31541                                s = e - this.lastDecodedFrames,
31542                                o = 1e3 * a / n,
31543                                l = this.hls;
31544                            if (l.trigger(S.FPS_DROP, {
31545                                    currentDropped: a,
31546                                    currentDecoded: s,
31547                                    totalDroppedFrames: r
31548                                }), o > 0 && a > l.config.fpsDroppedMonitoringThreshold * s) {
31549                                var u = l.currentLevel;
31550                                w.warn("drop FPS ratio greater than max allowed value for currentLevel: " + u), u > 0 && (-1 === l.autoLevelCapping || l.autoLevelCapping >= u) && (u -= 1, l.trigger(S.FPS_DROP_LEVEL_CAPPING, {
31551                                    level: u,
31552                                    droppedLevel: l.currentLevel
31553                                }), l.autoLevelCapping = u, this.streamController.nextLevelSwitch())
31554                            }
31555                        }
31556                        this.lastTime = i, this.lastDroppedFrames = r, this.lastDecodedFrames = e
31557                    }
31558                }, e.checkFPSInterval = function () {
31559                    var t = this.media;
31560                    if (t)
31561                        if (this.isVideoPlaybackQualityAvailable) {
31562                            var e = t.getVideoPlaybackQuality();
31563                            this.checkFPS(t, e.totalVideoFrames, e.droppedVideoFrames)
31564                        } else this.checkFPS(t, t.webkitDecodedFrameCount, t.webkitDroppedFrameCount)
31565                }, t
31566            }(),
31567            Qa = "[eme]",
31568            Ja = function () {
31569                function t(e) {
31570                    this.hls = void 0, this.config = void 0, this.media = null, this.keyFormatPromise = null, this.keySystemAccessPromises = {}, this._requestLicenseFailureCount = 0, this.mediaKeySessions = [], this.keyIdToKeySessionPromise = {}, this.setMediaKeysQueue = t.CDMCleanupPromise ? [t.CDMCleanupPromise] : [], this.onMediaEncrypted = this._onMediaEncrypted.bind(this), this.onWaitingForKey = this._onWaitingForKey.bind(this), this.debug = w.debug.bind(w, Qa), this.log = w.log.bind(w, Qa), this.warn = w.warn.bind(w, Qa), this.error = w.error.bind(w, Qa), this.hls = e, this.config = e.config, this.registerListeners()
31571                }
31572                var e = t.prototype;
31573                return e.destroy = function () {
31574                    this.unregisterListeners(), this.onMediaDetached();
31575                    var t = this.config;
31576                    t.requestMediaKeySystemAccessFunc = null, t.licenseXhrSetup = t.licenseResponseCallback = void 0, t.drmSystems = t.drmSystemOptions = {}, this.hls = this.onMediaEncrypted = this.onWaitingForKey = this.keyIdToKeySessionPromise = null, this.config = null
31577                }, e.registerListeners = function () {
31578                    this.hls.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(S.MEDIA_DETACHED, this.onMediaDetached, this), this.hls.on(S.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.on(S.MANIFEST_LOADED, this.onManifestLoaded, this)
31579                }, e.unregisterListeners = function () {
31580                    this.hls.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(S.MEDIA_DETACHED, this.onMediaDetached, this), this.hls.off(S.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.off(S.MANIFEST_LOADED, this.onManifestLoaded, this)
31581                }, e.getLicenseServerUrl = function (t) {
31582                    var e = this.config,
31583                        r = e.drmSystems,
31584                        i = e.widevineLicenseUrl,
31585                        n = r[t];
31586                    if (n) return n.licenseUrl;
31587                    if (t === q.WIDEVINE && i) return i;
31588                    throw new Error('no license server URL configured for key-system "' + t + '"')
31589                }, e.getServerCertificateUrl = function (t) {
31590                    var e = this.config.drmSystems[t];
31591                    if (e) return e.serverCertificateUrl;
31592                    this.log('No Server Certificate in config.drmSystems["' + t + '"]')
31593                }, e.attemptKeySystemAccess = function (t) {
31594                    var e = this,
31595                        r = this.hls.levels,
31596                        i = function (t, e, r) {
31597                            return !!t && r.indexOf(t) === e
31598                        },
31599                        n = r.map((function (t) {
31600                            return t.audioCodec
31601                        })).filter(i),
31602                        a = r.map((function (t) {
31603                            return t.videoCodec
31604                        })).filter(i);
31605                    return n.length + a.length === 0 && a.push("avc1.42e01e"), new Promise((function (r, i) {
31606                        ! function t(s) {
31607                            var o = s.shift();
31608                            e.getMediaKeysPromise(o, n, a).then((function (t) {
31609                                return r({
31610                                    keySystem: o,
31611                                    mediaKeys: t
31612                                })
31613                            })).catch((function (e) {
31614                                s.length ? t(s) : i(e instanceof rs ? e : new rs({
31615                                    type: L.KEY_SYSTEM_ERROR,
31616                                    details: A.KEY_SYSTEM_NO_ACCESS,
31617                                    error: e,
31618                                    fatal: !0
31619                                }, e.message))
31620                            }))
31621                        }(t)
31622                    }))
31623                }, e.requestMediaKeySystemAccess = function (t, e) {
31624                    var r = this.config.requestMediaKeySystemAccessFunc;
31625                    if ("function" != typeof r) {
31626                        var i = "Configured requestMediaKeySystemAccess is not a function " + r;
31627                        return null === it && "http:" === self.location.protocol && (i = "navigator.requestMediaKeySystemAccess is not available over insecure protocol " + location.protocol), Promise.reject(new Error(i))
31628                    }
31629                    return r(t, e)
31630                }, e.getMediaKeysPromise = function (t, e, r) {
31631                    var i = this,
31632                        n = function (t, e, r, i) {
31633                            var n;
31634                            switch (t) {
31635                            case q.FAIRPLAY:
31636                                n = ["cenc", "sinf"];
31637                                break;
31638                            case q.WIDEVINE:
31639                            case q.PLAYREADY:
31640                                n = ["cenc"];
31641                                break;
31642                            case q.CLEARKEY:
31643                                n = ["cenc", "keyids"];
31644                                break;
31645                            default:
31646                                throw new Error("Unknown key-system: " + t)
31647                            }
31648                            return function (t, e, r, i) {
31649                                return [{
31650                                    initDataTypes: t,
31651                                    persistentState: i.persistentState || "optional",
31652                                    distinctiveIdentifier: i.distinctiveIdentifier || "optional",
31653                                    sessionTypes: i.sessionTypes || [i.sessionType || "temporary"],
31654                                    audioCapabilities: e.map((function (t) {
31655                                        return {
31656                                            contentType: 'audio/mp4; codecs="' + t + '"',
31657                                            robustness: i.audioRobustness || "",
31658                                            encryptionScheme: i.audioEncryptionScheme || null
31659                                        }
31660                                    })),
31661                                    videoCapabilities: r.map((function (t) {
31662                                        return {
31663                                            contentType: 'video/mp4; codecs="' + t + '"',
31664                                            robustness: i.videoRobustness || "",
31665                                            encryptionScheme: i.videoEncryptionScheme || null
31666                                        }
31667                                    }))
31668                                }]
31669                            }(n, e, r, i)
31670                        }(t, e, r, this.config.drmSystemOptions),
31671                        a = this.keySystemAccessPromises[t],
31672                        s = null == a ? void 0 : a.keySystemAccess;
31673                    if (!s) {
31674                        this.log('Requesting encrypted media "' + t + '" key-system access with config: ' + JSON.stringify(n)), s = this.requestMediaKeySystemAccess(t, n);
31675                        var o = this.keySystemAccessPromises[t] = {
31676                            keySystemAccess: s
31677                        };
31678                        return s.catch((function (e) {
31679                            i.log('Failed to obtain access to key-system "' + t + '": ' + e)
31680                        })), s.then((function (e) {
31681                            i.log('Access for key-system "' + e.keySystem + '" obtained');
31682                            var r = i.fetchServerCertificate(t);
31683                            return i.log('Create media-keys for "' + t + '"'), o.mediaKeys = e.createMediaKeys().then((function (e) {
31684                                return i.log('Media-keys created for "' + t + '"'), r.then((function (r) {
31685                                    return r ? i.setMediaKeysServerCertificate(e, t, r) : e
31686                                }))
31687                            })), o.mediaKeys.catch((function (e) {
31688                                i.error('Failed to create media-keys for "' + t + '"}: ' + e)
31689                            })), o.mediaKeys
31690                        }))
31691                    }
31692                    return s.then((function () {
31693                        return a.mediaKeys
31694                    }))
31695                }, e.createMediaKeySessionContext = function (t) {
31696                    var e = t.decryptdata,
31697                        r = t.keySystem,
31698                        i = t.mediaKeys;
31699                    this.log('Creating key-system session "' + r + '" keyId: ' + Lt(e.keyId || []));
31700                    var n = i.createSession(),
31701                        a = {
31702                            decryptdata: e,
31703                            keySystem: r,
31704                            mediaKeys: i,
31705                            mediaKeysSession: n,
31706                            keyStatus: "status-pending"
31707                        };
31708                    return this.mediaKeySessions.push(a), a
31709                }, e.renewKeySession = function (t) {
31710                    var e = t.decryptdata;
31711                    if (e.pssh) {
31712                        var r = this.createMediaKeySessionContext(t),
31713                            i = this.getKeyIdString(e);
31714                        this.keyIdToKeySessionPromise[i] = this.generateRequestWithPreferredKeySession(r, "cenc", e.pssh, "expired")
31715                    } else this.warn("Could not renew expired session. Missing pssh initData.");
31716                    this.removeSession(t)
31717                }, e.getKeyIdString = function (t) {
31718                    if (!t) throw new Error("Could not read keyId of undefined decryptdata");
31719                    if (null === t.keyId) throw new Error("keyId is null");
31720                    return Lt(t.keyId)
31721                }, e.updateKeySession = function (t, e) {
31722                    var r, i = t.mediaKeysSession;
31723                    return this.log('Updating key-session "' + i.sessionId + '" for keyID ' + Lt((null == (r = t.decryptdata) ? void 0 : r.keyId) || []) + "\n      } (data length: " + (e ? e.byteLength : e) + ")"), i.update(e)
31724                }, e.selectKeySystemFormat = function (t) {
31725                    var e = Object.keys(t.levelkeys || {});
31726                    return this.keyFormatPromise || (this.log("Selecting key-system from fragment (sn: " + t.sn + " " + t.type + ": " + t.level + ") key formats " + e.join(", ")), this.keyFormatPromise = this.getKeyFormatPromise(e)), this.keyFormatPromise
31727                }, e.getKeyFormatPromise = function (t) {
31728                    var e = this;
31729                    return new Promise((function (r, i) {
31730                        var n = et(e.config),
31731                            a = t.map($).filter((function (t) {
31732                                return !!t && -1 !== n.indexOf(t)
31733                            }));
31734                        return e.getKeySystemSelectionPromise(a).then((function (t) {
31735                            var e = t.keySystem,
31736                                n = tt(e);
31737                            n ? r(n) : i(new Error('Unable to find format for key-system "' + e + '"'))
31738                        })).catch(i)
31739                    }))
31740                }, e.loadKey = function (t) {
31741                    var e = this,
31742                        r = t.keyInfo.decryptdata,
31743                        i = this.getKeyIdString(r),
31744                        n = "(keyId: " + i + ' format: "' + r.keyFormat + '" method: ' + r.method + " uri: " + r.uri + ")";
31745                    this.log("Starting session for key " + n);
31746                    var a = this.keyIdToKeySessionPromise[i];
31747                    return a || (a = this.keyIdToKeySessionPromise[i] = this.getKeySystemForKeyPromise(r).then((function (i) {
31748                        var a = i.keySystem,
31749                            s = i.mediaKeys;
31750                        return e.throwIfDestroyed(), e.log("Handle encrypted media sn: " + t.frag.sn + " " + t.frag.type + ": " + t.frag.level + " using key " + n), e.attemptSetMediaKeys(a, s).then((function () {
31751                            e.throwIfDestroyed();
31752                            var t = e.createMediaKeySessionContext({
31753                                keySystem: a,
31754                                mediaKeys: s,
31755                                decryptdata: r
31756                            });
31757                            return e.generateRequestWithPreferredKeySession(t, "cenc", r.pssh, "playlist-key")
31758                        }))
31759                    }))).catch((function (t) {
31760                        return e.handleError(t)
31761                    })), a
31762                }, e.throwIfDestroyed = function (t) {
31763                    if (!this.hls) throw new Error("invalid state")
31764                }, e.handleError = function (t) {
31765                    this.hls && (this.error(t.message), t instanceof rs ? this.hls.trigger(S.ERROR, t.data) : this.hls.trigger(S.ERROR, {
31766                        type: L.KEY_SYSTEM_ERROR,
31767                        details: A.KEY_SYSTEM_NO_KEYS,
31768                        error: t,
31769                        fatal: !0
31770                    }))
31771                }, e.getKeySystemForKeyPromise = function (t) {
31772                    var e = this.getKeyIdString(t),
31773                        r = this.keyIdToKeySessionPromise[e];
31774                    if (!r) {
31775                        var i = $(t.keyFormat),
31776                            n = i ? [i] : et(this.config);
31777                        return this.attemptKeySystemAccess(n)
31778                    }
31779                    return r
31780                }, e.getKeySystemSelectionPromise = function (t) {
31781                    if (t.length || (t = et(this.config)), 0 === t.length) throw new rs({
31782                        type: L.KEY_SYSTEM_ERROR,
31783                        details: A.KEY_SYSTEM_NO_CONFIGURED_LICENSE,
31784                        fatal: !0
31785                    }, "Missing key-system license configuration options " + JSON.stringify({
31786                        drmSystems: this.config.drmSystems
31787                    }));
31788                    return this.attemptKeySystemAccess(t)
31789                }, e._onMediaEncrypted = function (t) {
31790                    var e = this,
31791                        r = t.initDataType,
31792                        i = t.initData;
31793                    if (this.debug('"' + t.type + '" event: init data type: "' + r + '"'), null !== i) {
31794                        var n, a;
31795                        if ("sinf" === r && this.config.drmSystems[q.FAIRPLAY]) {
31796                            var s = bt(new Uint8Array(i));
31797                            try {
31798                                var o = V(JSON.parse(s).sinf),
31799                                    l = Bt(new Uint8Array(o));
31800                                if (!l) return;
31801                                n = l.subarray(8, 24), a = q.FAIRPLAY
31802                            } catch (t) {
31803                                return void this.warn('Failed to parse sinf "encrypted" event message initData')
31804                            }
31805                        } else {
31806                            var u = function (t) {
31807                                if (!(t instanceof ArrayBuffer) || t.byteLength < 32) return null;
31808                                var e = {
31809                                        version: 0,
31810                                        systemId: "",
31811                                        kids: null,
31812                                        data: null
31813                                    },
31814                                    r = new DataView(t),
31815                                    i = r.getUint32(0);
31816                                if (t.byteLength !== i && i > 44) return null;
31817                                if (1886614376 !== r.getUint32(4)) return null;
31818                                if (e.version = r.getUint32(8) >>> 24, e.version > 1) return null;
31819                                e.systemId = Lt(new Uint8Array(t, 12, 16));
31820                                var n = r.getUint32(28);
31821                                if (0 === e.version) {
31822                                    if (i - 32 < n) return null;
31823                                    e.data = new Uint8Array(t, 32, n)
31824                                } else if (1 === e.version) {
31825                                    e.kids = [];
31826                                    for (var a = 0; a < n; a++) e.kids.push(new Uint8Array(t, 32 + 16 * a, 16))
31827                                }
31828                                return e
31829                            }(i);
31830                            if (null === u) return;
31831                            0 === u.version && u.systemId === Z && u.data && (n = u.data.subarray(8, 24)), a = function (t) {
31832                                if (t === Z) return q.WIDEVINE
31833                            }(u.systemId)
31834                        }
31835                        if (a && n) {
31836                            for (var h, d = Lt(n), c = this.keyIdToKeySessionPromise, f = this.mediaKeySessions, g = c[d], v = function () {
31837                                    var t = f[m],
31838                                        a = t.decryptdata;
31839                                    if (a.pssh || !a.keyId) return 0;
31840                                    var s = Lt(a.keyId);
31841                                    return d === s || -1 !== a.uri.replace(/-/g, "").indexOf(d) ? (g = c[s], delete c[s], a.pssh = new Uint8Array(i), a.keyId = n, g = c[d] = g.then((function () {
31842                                        return e.generateRequestWithPreferredKeySession(t, r, i, "encrypted-event-key-match")
31843                                    })), 1) : void 0
31844                                }, m = 0; m < f.length && (0 === (h = v()) || 1 !== h); m++);
31845                            g || (g = c[d] = this.getKeySystemSelectionPromise([a]).then((function (t) {
31846                                var a, s = t.keySystem,
31847                                    o = t.mediaKeys;
31848                                e.throwIfDestroyed();
31849                                var l = new Xt("ISO-23001-7", d, null != (a = tt(s)) ? a : "");
31850                                return l.pssh = new Uint8Array(i), l.keyId = n, e.attemptSetMediaKeys(s, o).then((function () {
31851                                    e.throwIfDestroyed();
31852                                    var t = e.createMediaKeySessionContext({
31853                                        decryptdata: l,
31854                                        keySystem: s,
31855                                        mediaKeys: o
31856                                    });
31857                                    return e.generateRequestWithPreferredKeySession(t, r, i, "encrypted-event-no-match")
31858                                }))
31859                            }))), g.catch((function (t) {
31860                                return e.handleError(t)
31861                            }))
31862                        }
31863                    }
31864                }, e._onWaitingForKey = function (t) {
31865                    this.log('"' + t.type + '" event')
31866                }, e.attemptSetMediaKeys = function (t, e) {
31867                    var r = this,
31868                        i = this.setMediaKeysQueue.slice();
31869                    this.log('Setting media-keys for "' + t + '"');
31870                    var n = Promise.all(i).then((function () {
31871                        if (!r.media) throw new Error("Attempted to set mediaKeys without media element attached");
31872                        return r.media.setMediaKeys(e)
31873                    }));
31874                    return this.setMediaKeysQueue.push(n), n.then((function () {
31875                        r.log('Media-keys set for "' + t + '"'), i.push(n), r.setMediaKeysQueue = r.setMediaKeysQueue.filter((function (t) {
31876                            return -1 === i.indexOf(t)
31877                        }))
31878                    }))
31879                }, e.generateRequestWithPreferredKeySession = function (t, e, r, i) {
31880                    var n, a, s = this,
31881                        o = null == (n = this.config.drmSystems) || null == (a = n[t.keySystem]) ? void 0 : a.generateRequest;
31882                    if (o) try {
31883                        var l = o.call(this.hls, e, r, t);
31884                        if (!l) throw new Error("Invalid response from configured generateRequest filter");
31885                        e = l.initDataType, r = t.decryptdata.pssh = l.initData ? new Uint8Array(l.initData) : null
31886                    } catch (t) {
31887                        var u;
31888                        if (this.warn(t.message), null != (u = this.hls) && u.config.debug) throw t
31889                    }
31890                    if (null === r) return this.log('Skipping key-session request for "' + i + '" (no initData)'), Promise.resolve(t);
31891                    var h = this.getKeyIdString(t.decryptdata);
31892                    this.log('Generating key-session request for "' + i + '": ' + h + " (init data type: " + e + " length: " + (r ? r.byteLength : null) + ")");
31893                    var d = new Nn,
31894                        c = t._onmessage = function (e) {
31895                            var r = t.mediaKeysSession;
31896                            if (r) {
31897                                var i = e.messageType,
31898                                    n = e.message;
31899                                s.log('"' + i + '" message event for session "' + r.sessionId + '" message size: ' + n.byteLength), "license-request" === i || "license-renewal" === i ? s.renewLicense(t, n).catch((function (t) {
31900                                    s.handleError(t), d.emit("error", t)
31901                                })) : "license-release" === i ? t.keySystem === q.FAIRPLAY && (s.updateKeySession(t, W("acknowledged")), s.removeSession(t)) : s.warn('unhandled media key message type "' + i + '"')
31902                            } else d.emit("error", new Error("invalid state"))
31903                        },
31904                        f = t._onkeystatuseschange = function (e) {
31905                            if (t.mediaKeysSession) {
31906                                s.onKeyStatusChange(t);
31907                                var r = t.keyStatus;
31908                                d.emit("keyStatus", r), "expired" === r && (s.warn(t.keySystem + " expired for key " + h), s.renewKeySession(t))
31909                            } else d.emit("error", new Error("invalid state"))
31910                        };
31911                    t.mediaKeysSession.addEventListener("message", c), t.mediaKeysSession.addEventListener("keystatuseschange", f);
31912                    var g = new Promise((function (t, e) {
31913                        d.on("error", e), d.on("keyStatus", (function (r) {
31914                            r.startsWith("usable") ? t() : "output-restricted" === r ? e(new rs({
31915                                type: L.KEY_SYSTEM_ERROR,
31916                                details: A.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,
31917                                fatal: !1
31918                            }, "HDCP level output restricted")) : "internal-error" === r ? e(new rs({
31919                                type: L.KEY_SYSTEM_ERROR,
31920                                details: A.KEY_SYSTEM_STATUS_INTERNAL_ERROR,
31921                                fatal: !0
31922                            }, 'key status changed to "' + r + '"')) : "expired" === r ? e(new Error("key expired while generating request")) : s.warn('unhandled key status change "' + r + '"')
31923                        }))
31924                    }));
31925                    return t.mediaKeysSession.generateRequest(e, r).then((function () {
31926                        var e;
31927                        s.log('Request generated for key-session "' + (null == (e = t.mediaKeysSession) ? void 0 : e.sessionId) + '" keyId: ' + h)
31928                    })).catch((function (t) {
31929                        throw new rs({
31930                            type: L.KEY_SYSTEM_ERROR,
31931                            details: A.KEY_SYSTEM_NO_SESSION,
31932                            error: t,
31933                            fatal: !1
31934                        }, "Error generating key-session request: " + t)
31935                    })).then((function () {
31936                        return g
31937                    })).catch((function (e) {
31938                        throw d.removeAllListeners(), s.removeSession(t), e
31939                    })).then((function () {
31940                        return d.removeAllListeners(), t
31941                    }))
31942                }, e.onKeyStatusChange = function (t) {
31943                    var e = this;
31944                    t.mediaKeysSession.keyStatuses.forEach((function (r, i) {
31945                        e.log('key status change "' + r + '" for keyStatuses keyId: ' + Lt("buffer" in i ? new Uint8Array(i.buffer, i.byteOffset, i.byteLength) : new Uint8Array(i)) + " session keyId: " + Lt(new Uint8Array(t.decryptdata.keyId || [])) + " uri: " + t.decryptdata.uri), t.keyStatus = r
31946                    }))
31947                }, e.fetchServerCertificate = function (t) {
31948                    var e = this.config,
31949                        r = new(0, e.loader)(e),
31950                        n = this.getServerCertificateUrl(t);
31951                    return n ? (this.log('Fetching server certificate for "' + t + '"'), new Promise((function (a, s) {
31952                        var o = {
31953                                responseType: "arraybuffer",
31954                                url: n
31955                            },
31956                            l = e.certLoadPolicy.default,
31957                            u = {
31958                                loadPolicy: l,
31959                                timeout: l.maxLoadTimeMs,
31960                                maxRetry: 0,
31961                                retryDelay: 0,
31962                                maxRetryDelay: 0
31963                            },
31964                            h = {
31965                                onSuccess: function (t, e, r, i) {
31966                                    a(t.data)
31967                                },
31968                                onError: function (e, r, a, l) {
31969                                    s(new rs({
31970                                        type: L.KEY_SYSTEM_ERROR,
31971                                        details: A.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,
31972                                        fatal: !0,
31973                                        networkDetails: a,
31974                                        response: i({
31975                                            url: o.url,
31976                                            data: void 0
31977                                        }, e)
31978                                    }, '"' + t + '" certificate request failed (' + n + "). Status: " + e.code + " (" + e.text + ")"))
31979                                },
31980                                onTimeout: function (e, r, i) {
31981                                    s(new rs({
31982                                        type: L.KEY_SYSTEM_ERROR,
31983                                        details: A.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,
31984                                        fatal: !0,
31985                                        networkDetails: i,
31986                                        response: {
31987                                            url: o.url,
31988                                            data: void 0
31989                                        }
31990                                    }, '"' + t + '" certificate request timed out (' + n + ")"))
31991                                },
31992                                onAbort: function (t, e, r) {
31993                                    s(new Error("aborted"))
31994                                }
31995                            };
31996                        r.load(o, u, h)
31997                    }))) : Promise.resolve()
31998                }, e.setMediaKeysServerCertificate = function (t, e, r) {
31999                    var i = this;
32000                    return new Promise((function (n, a) {
32001                        t.setServerCertificate(r).then((function (a) {
32002                            i.log("setServerCertificate " + (a ? "success" : "not supported by CDM") + " (" + (null == r ? void 0 : r.byteLength) + ') on "' + e + '"'), n(t)
32003                        })).catch((function (t) {
32004                            a(new rs({
32005                                type: L.KEY_SYSTEM_ERROR,
32006                                details: A.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,
32007                                error: t,
32008                                fatal: !0
32009                            }, t.message))
32010                        }))
32011                    }))
32012                }, e.renewLicense = function (t, e) {
32013                    var r = this;
32014                    return this.requestLicense(t, new Uint8Array(e)).then((function (e) {
32015                        return r.updateKeySession(t, new Uint8Array(e)).catch((function (t) {
32016                            throw new rs({
32017                                type: L.KEY_SYSTEM_ERROR,
32018                                details: A.KEY_SYSTEM_SESSION_UPDATE_FAILED,
32019                                error: t,
32020                                fatal: !0
32021                            }, t.message)
32022                        }))
32023                    }))
32024                }, e.unpackPlayReadyKeyMessage = function (t, e) {
32025                    var r = String.fromCharCode.apply(null, new Uint16Array(e.buffer));
32026                    if (!r.includes("PlayReadyKeyMessage")) return t.setRequestHeader("Content-Type", "text/xml; charset=utf-8"), e;
32027                    var i = (new DOMParser).parseFromString(r, "application/xml"),
32028                        n = i.querySelectorAll("HttpHeader");
32029                    if (n.length > 0)
32030                        for (var a, s = 0, o = n.length; s < o; s++) {
32031                            var l, u, h = null == (l = (a = n[s]).querySelector("name")) ? void 0 : l.textContent,
32032                                d = null == (u = a.querySelector("value")) ? void 0 : u.textContent;
32033                            h && d && t.setRequestHeader(h, d)
32034                        }
32035                    var c = i.querySelector("Challenge"),
32036                        f = null == c ? void 0 : c.textContent;
32037                    if (!f) throw new Error("Cannot find <Challenge> in key message");
32038                    return W(atob(f))
32039                }, e.setupLicenseXHR = function (t, e, r, i) {
32040                    var n = this,
32041                        a = this.config.licenseXhrSetup;
32042                    return a ? Promise.resolve().then((function () {
32043                        if (!r.decryptdata) throw new Error("Key removed");
32044                        return a.call(n.hls, t, e, r, i)
32045                    })).catch((function (s) {
32046                        if (!r.decryptdata) throw s;
32047                        return t.open("POST", e, !0), a.call(n.hls, t, e, r, i)
32048                    })).then((function (r) {
32049                        return t.readyState || t.open("POST", e, !0), {
32050                            xhr: t,
32051                            licenseChallenge: r || i
32052                        }
32053                    })) : (t.open("POST", e, !0), Promise.resolve({
32054                        xhr: t,
32055                        licenseChallenge: i
32056                    }))
32057                }, e.requestLicense = function (t, e) {
32058                    var r = this,
32059                        i = this.config.keyLoadPolicy.default;
32060                    return new Promise((function (n, a) {
32061                        var s = r.getLicenseServerUrl(t.keySystem);
32062                        r.log("Sending license request to URL: " + s);
32063                        var o = new XMLHttpRequest;
32064                        o.responseType = "arraybuffer", o.onreadystatechange = function () {
32065                            if (!r.hls || !t.mediaKeysSession) return a(new Error("invalid state"));
32066                            if (4 === o.readyState)
32067                                if (200 === o.status) {
32068                                    r._requestLicenseFailureCount = 0;
32069                                    var l = o.response;
32070                                    r.log("License received " + (l instanceof ArrayBuffer ? l.byteLength : l));
32071                                    var u = r.config.licenseResponseCallback;
32072                                    if (u) try {
32073                                        l = u.call(r.hls, o, s, t)
32074                                    } catch (t) {
32075                                        r.error(t)
32076                                    }
32077                                    n(l)
32078                                } else {
32079                                    var h = i.errorRetry,
32080                                        d = h ? h.maxNumRetry : 0;
32081                                    if (r._requestLicenseFailureCount++, r._requestLicenseFailureCount > d || o.status >= 400 && o.status < 500) a(new rs({
32082                                        type: L.KEY_SYSTEM_ERROR,
32083                                        details: A.KEY_SYSTEM_LICENSE_REQUEST_FAILED,
32084                                        fatal: !0,
32085                                        networkDetails: o,
32086                                        response: {
32087                                            url: s,
32088                                            data: void 0,
32089                                            code: o.status,
32090                                            text: o.statusText
32091                                        }
32092                                    }, "License Request XHR failed (" + s + "). Status: " + o.status + " (" + o.statusText + ")"));
32093                                    else {
32094                                        var c = d - r._requestLicenseFailureCount + 1;
32095                                        r.warn("Retrying license request, " + c + " attempts left"), r.requestLicense(t, e).then(n, a)
32096                                    }
32097                                }
32098                        }, t.licenseXhr && t.licenseXhr.readyState !== XMLHttpRequest.DONE && t.licenseXhr.abort(), t.licenseXhr = o, r.setupLicenseXHR(o, s, t, e).then((function (e) {
32099                            var i = e.xhr,
32100                                n = e.licenseChallenge;
32101                            t.keySystem == q.PLAYREADY && (n = r.unpackPlayReadyKeyMessage(i, n)), i.send(n)
32102                        }))
32103                    }))
32104                }, e.onMediaAttached = function (t, e) {
32105                    if (this.config.emeEnabled) {
32106                        var r = e.media;
32107                        this.media = r, r.addEventListener("encrypted", this.onMediaEncrypted), r.addEventListener("waitingforkey", this.onWaitingForKey)
32108                    }
32109                }, e.onMediaDetached = function () {
32110                    var e = this,
32111                        r = this.media,
32112                        i = this.mediaKeySessions;
32113                    r && (r.removeEventListener("encrypted", this.onMediaEncrypted), r.removeEventListener("waitingforkey", this.onWaitingForKey), this.media = null), this._requestLicenseFailureCount = 0, this.setMediaKeysQueue = [], this.mediaKeySessions = [], this.keyIdToKeySessionPromise = {}, Xt.clearKeyUriToKeyIdMap();
32114                    var n = i.length;
32115                    t.CDMCleanupPromise = Promise.all(i.map((function (t) {
32116                        return e.removeSession(t)
32117                    })).concat(null == r ? void 0 : r.setMediaKeys(null).catch((function (t) {
32118                        e.log("Could not clear media keys: " + t)
32119                    })))).then((function () {
32120                        n && (e.log("finished closing key sessions and clearing media keys"), i.length = 0)
32121                    })).catch((function (t) {
32122                        e.log("Could not close sessions and clear media keys: " + t)
32123                    }))
32124                }, e.onManifestLoading = function () {
32125                    this.keyFormatPromise = null
32126                }, e.onManifestLoaded = function (t, e) {
32127                    var r = e.sessionKeys;
32128                    if (r && this.config.emeEnabled && !this.keyFormatPromise) {
32129                        var i = r.reduce((function (t, e) {
32130                            return -1 === t.indexOf(e.keyFormat) && t.push(e.keyFormat), t
32131                        }), []);
32132                        this.log("Selecting key-system from session-keys " + i.join(", ")), this.keyFormatPromise = this.getKeyFormatPromise(i)
32133                    }
32134                }, e.removeSession = function (t) {
32135                    var e = this,
32136                        r = t.mediaKeysSession,
32137                        i = t.licenseXhr;
32138                    if (r) {
32139                        this.log("Remove licenses and keys and close session " + r.sessionId), t._onmessage && (r.removeEventListener("message", t._onmessage), t._onmessage = void 0), t._onkeystatuseschange && (r.removeEventListener("keystatuseschange", t._onkeystatuseschange), t._onkeystatuseschange = void 0), i && i.readyState !== XMLHttpRequest.DONE && i.abort(), t.mediaKeysSession = t.decryptdata = t.licenseXhr = void 0;
32140                        var n = this.mediaKeySessions.indexOf(t);
32141                        return n > -1 && this.mediaKeySessions.splice(n, 1), r.remove().catch((function (t) {
32142                            e.log("Could not remove session: " + t)
32143                        })).then((function () {
32144                            return r.close()
32145                        })).catch((function (t) {
32146                            e.log("Could not close session: " + t)
32147                        }))
32148                    }
32149                }, t
32150            }();
32151        Ja.CDMCleanupPromise = void 0;
32152        var $a, Za, ts, es, rs = function (t) {
32153            function e(e, r) {
32154                var i;
32155                return (i = t.call(this, r) || this).data = void 0, e.error || (e.error = new Error(r)), i.data = e, e.err = e.error, i
32156            }
32157            return l(e, t), e
32158        }(c(Error));
32159        ! function (t) {
32160            t.MANIFEST = "m", t.AUDIO = "a", t.VIDEO = "v", t.MUXED = "av", t.INIT = "i", t.CAPTION = "c", t.TIMED_TEXT = "tt", t.KEY = "k", t.OTHER = "o"
32161        }($a || ($a = {})),
32162        function (t) {
32163            t.DASH = "d", t.HLS = "h", t.SMOOTH = "s", t.OTHER = "o"
32164        }(Za || (Za = {})),
32165        function (t) {
32166            t.OBJECT = "CMCD-Object", t.REQUEST = "CMCD-Request", t.SESSION = "CMCD-Session", t.STATUS = "CMCD-Status"
32167        }(ts || (ts = {}));
32168        var is = ((es = {})[ts.OBJECT] = ["br", "d", "ot", "tb"], es[ts.REQUEST] = ["bl", "dl", "mtp", "nor", "nrr", "su"], es[ts.SESSION] = ["cid", "pr", "sf", "sid", "st", "v"], es[ts.STATUS] = ["bs", "rtp"], es),
32169            ns = function t(e, r) {
32170                this.value = void 0, this.params = void 0, Array.isArray(e) && (e = e.map((function (e) {
32171                    return e instanceof t ? e : new t(e)
32172                }))), this.value = e, this.params = r
32173            },
32174            as = function (t) {
32175                this.description = void 0, this.description = t
32176            },
32177            ss = "Dict";
32178
32179        function os(t, e, r, i) {
32180            return new Error("failed to " + t + ' "' + (n = e, (Array.isArray(n) ? JSON.stringify(n) : n instanceof Map ? "Map{}" : n instanceof Set ? "Set{}" : "object" == typeof n ? JSON.stringify(n) : String(n)) + '" as ') + r, {
32181                cause: i
32182            });
32183            var n
32184        }
32185        var ls = "Bare Item",
32186            us = "Boolean",
32187            hs = "Byte Sequence",
32188            ds = "Decimal",
32189            cs = "Integer",
32190            fs = /[\x00-\x1f\x7f]+/,
32191            gs = "Token",
32192            vs = "Key";
32193
32194        function ms(t, e, r) {
32195            return os("serialize", t, e, r)
32196        }
32197
32198        function ps(t) {
32199            if (!1 === ArrayBuffer.isView(t)) throw ms(t, hs);
32200            return ":" + (e = t, btoa(String.fromCharCode.apply(String, e)) + ":");
32201            var e
32202        }
32203
32204        function ys(t) {
32205            if (function (t) {
32206                    return t < -999999999999999 || 999999999999999 < t
32207                }(t)) throw ms(t, cs);
32208            return t.toString()
32209        }
32210
32211        function Es(t, e) {
32212            if (t < 0) return -Es(-t, e);
32213            var r = Math.pow(10, e);
32214            if (Math.abs(t * r % 1 - .5) < Number.EPSILON) {
32215                var i = Math.floor(t * r);
32216                return (i % 2 == 0 ? i : i + 1) / r
32217            }
32218            return Math.round(t * r) / r
32219        }
32220
32221        function Ts(t) {
32222            var e = Es(t, 3);
32223            if (Math.floor(Math.abs(e)).toString().length > 12) throw ms(t, ds);
32224            var r = e.toString();
32225            return r.includes(".") ? r : r + ".0"
32226        }
32227        var Ss = "String";
32228
32229        function Ls(t) {
32230            var e, r = (e = t).description || e.toString().slice(7, -1);
32231            if (!1 === /^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(r)) throw ms(r, gs);
32232            return r
32233        }
32234
32235        function As(t) {
32236            switch (typeof t) {
32237            case "number":
32238                if (!y(t)) throw ms(t, ls);
32239                return Number.isInteger(t) ? ys(t) : Ts(t);
32240            case "string":
32241                return function (t) {
32242                    if (fs.test(t)) throw ms(t, Ss);
32243                    return '"' + t.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'
32244                }(t);
32245            case "symbol":
32246                return Ls(t);
32247            case "boolean":
32248                return function (t) {
32249                    if ("boolean" != typeof t) throw ms(t, us);
32250                    return t ? "?1" : "?0"
32251                }(t);
32252            case "object":
32253                if (t instanceof Date) return function (t) {
32254                    return "@" + ys(t.getTime() / 1e3)
32255                }(t);
32256                if (t instanceof Uint8Array) return ps(t);
32257                if (t instanceof as) return Ls(t);
32258            default:
32259                throw ms(t, ls)
32260            }
32261        }
32262
32263        function Rs(t) {
32264            if (!1 === /^[a-z*][a-z0-9\-_.*]*$/.test(t)) throw ms(t, vs);
32265            return t
32266        }
32267
32268        function ks(t) {
32269            return null == t ? "" : Object.entries(t).map((function (t) {
32270                var e = t[0],
32271                    r = t[1];
32272                return !0 === r ? ";" + Rs(e) : ";" + Rs(e) + "=" + As(r)
32273            })).join("")
32274        }
32275
32276        function bs(t) {
32277            return t instanceof ns ? "" + As(t.value) + ks(t.params) : As(t)
32278        }
32279
32280        function Ds(t, e) {
32281            var r;
32282            if (void 0 === e && (e = {
32283                    whitespace: !0
32284                }), "object" != typeof t) throw ms(t, ss);
32285            var i = t instanceof Map ? t.entries() : Object.entries(t),
32286                n = null != (r = e) && r.whitespace ? " " : "";
32287            return Array.from(i).map((function (t) {
32288                var e = t[0],
32289                    r = t[1];
32290                r instanceof ns == 0 && (r = new ns(r));
32291                var i, n = Rs(e);
32292                return !0 === r.value ? n += ks(r.params) : (n += "=", Array.isArray(r.value) ? n += "(" + (i = r).value.map(bs).join(" ") + ")" + ks(i.params) : n += bs(r)), n
32293            })).join("," + n)
32294        }
32295        var Is = function (t) {
32296                return "ot" === t || "sf" === t || "st" === t
32297            },
32298            ws = function (t) {
32299                return "number" == typeof t ? y(t) : null != t && "" !== t && !1 !== t
32300            },
32301            Cs = function (t) {
32302                return Math.round(t)
32303            },
32304            _s = function (t) {
32305                return 100 * Cs(t / 100)
32306            },
32307            xs = {
32308                br: Cs,
32309                d: Cs,
32310                bl: _s,
32311                dl: _s,
32312                mtp: _s,
32313                nor: function (t, e) {
32314                    return null != e && e.baseUrl && (t = function (t, e) {
32315                        var r = new URL(t),
32316                            i = new URL(e);
32317                        if (r.origin !== i.origin) return t;
32318                        for (var n = r.pathname.split("/").slice(1), a = i.pathname.split("/").slice(1, -1); n[0] === a[0];) n.shift(), a.shift();
32319                        for (; a.length;) a.shift(), n.unshift("..");
32320                        return n.join("/")
32321                    }(t, e.baseUrl)), encodeURIComponent(t)
32322                },
32323                rtp: _s,
32324                tb: Cs
32325            };
32326
32327        function Ps(t, e) {
32328            return void 0 === e && (e = {}), t ? function (t, e) {
32329                return Ds(t, e)
32330            }(function (t, e) {
32331                var r = {};
32332                if (null == t || "object" != typeof t) return r;
32333                var i = Object.keys(t).sort(),
32334                    n = o({}, xs, null == e ? void 0 : e.formatters),
32335                    a = null == e ? void 0 : e.filter;
32336                return i.forEach((function (i) {
32337                    if (null == a || !a(i)) {
32338                        var s = t[i],
32339                            o = n[i];
32340                        o && (s = o(s, e)), "v" === i && 1 === s || "pr" == i && 1 === s || ws(s) && (Is(i) && "string" == typeof s && (s = new as(s)), r[i] = s)
32341                    }
32342                })), r
32343            }(t, e), o({
32344                whitespace: !1
32345            }, e)) : ""
32346        }
32347
32348        function Fs(t, e, r) {
32349            return o(t, function (t, e) {
32350                var r;
32351                if (void 0 === e && (e = {}), !t) return {};
32352                var i = Object.entries(t),
32353                    n = Object.entries(is).concat(Object.entries((null == (r = e) ? void 0 : r.customHeaderMap) || {})),
32354                    a = i.reduce((function (t, e) {
32355                        var r, i = e[0],
32356                            a = e[1],
32357                            s = (null == (r = n.find((function (t) {
32358                                return t[1].includes(i)
32359                            }))) ? void 0 : r[0]) || ts.REQUEST;
32360                        return null != t[s] || (t[s] = {}), t[s][i] = a, t
32361                    }), {});
32362                return Object.entries(a).reduce((function (t, r) {
32363                    var i = r[0],
32364                        n = r[1];
32365                    return t[i] = Ps(n, e), t
32366                }), {})
32367            }(e, r))
32368        }
32369        var Ms = "CMCD",
32370            Os = /CMCD=[^&#]+/;
32371
32372        function Ns(t, e, r) {
32373            var i = function (t, e) {
32374                if (void 0 === e && (e = {}), !t) return "";
32375                var r = Ps(t, e);
32376                return Ms + "=" + encodeURIComponent(r)
32377            }(e, r);
32378            if (!i) return t;
32379            if (Os.test(t)) return t.replace(Os, i);
32380            var n = t.includes("?") ? "&" : "?";
32381            return "" + t + n + i
32382        }
32383        var Us = function () {
32384                function t(t) {
32385                    var e = this;
32386                    this.hls = void 0, this.config = void 0, this.media = void 0, this.sid = void 0, this.cid = void 0, this.useHeaders = !1, this.includeKeys = void 0, this.initialized = !1, this.starved = !1, this.buffering = !0, this.audioBuffer = void 0, this.videoBuffer = void 0, this.onWaiting = function () {
32387                        e.initialized && (e.starved = !0), e.buffering = !0
32388                    }, this.onPlaying = function () {
32389                        e.initialized || (e.initialized = !0), e.buffering = !1
32390                    }, this.applyPlaylistData = function (t) {
32391                        try {
32392                            e.apply(t, {
32393                                ot: $a.MANIFEST,
32394                                su: !e.initialized
32395                            })
32396                        } catch (t) {
32397                            w.warn("Could not generate manifest CMCD data.", t)
32398                        }
32399                    }, this.applyFragmentData = function (t) {
32400                        try {
32401                            var r = t.frag,
32402                                i = e.hls.levels[r.level],
32403                                n = e.getObjectType(r),
32404                                a = {
32405                                    d: 1e3 * r.duration,
32406                                    ot: n
32407                                };
32408                            n !== $a.VIDEO && n !== $a.AUDIO && n != $a.MUXED || (a.br = i.bitrate / 1e3, a.tb = e.getTopBandwidth(n) / 1e3, a.bl = e.getBufferLength(n)), e.apply(t, a)
32409                        } catch (t) {
32410                            w.warn("Could not generate segment CMCD data.", t)
32411                        }
32412                    }, this.hls = t;
32413                    var r = this.config = t.config,
32414                        i = r.cmcd;
32415                    null != i && (r.pLoader = this.createPlaylistLoader(), r.fLoader = this.createFragmentLoader(), this.sid = i.sessionId || function () {
32416                        try {
32417                            return crypto.randomUUID()
32418                        } catch (i) {
32419                            try {
32420                                var t = URL.createObjectURL(new Blob),
32421                                    e = t.toString();
32422                                return URL.revokeObjectURL(t), e.slice(e.lastIndexOf("/") + 1)
32423                            } catch (t) {
32424                                var r = (new Date).getTime();
32425                                return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function (t) {
32426                                    var e = (r + 16 * Math.random()) % 16 | 0;
32427                                    return r = Math.floor(r / 16), ("x" == t ? e : 3 & e | 8).toString(16)
32428                                }))
32429                            }
32430                        }
32431                    }(), this.cid = i.contentId, this.useHeaders = !0 === i.useHeaders, this.includeKeys = i.includeKeys, this.registerListeners())
32432                }
32433                var e = t.prototype;
32434                return e.registerListeners = function () {
32435                    var t = this.hls;
32436                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHED, this.onMediaDetached, this), t.on(S.BUFFER_CREATED, this.onBufferCreated, this)
32437                }, e.unregisterListeners = function () {
32438                    var t = this.hls;
32439                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHED, this.onMediaDetached, this), t.off(S.BUFFER_CREATED, this.onBufferCreated, this)
32440                }, e.destroy = function () {
32441                    this.unregisterListeners(), this.onMediaDetached(), this.hls = this.config = this.audioBuffer = this.videoBuffer = null, this.onWaiting = this.onPlaying = null
32442                }, e.onMediaAttached = function (t, e) {
32443                    this.media = e.media, this.media.addEventListener("waiting", this.onWaiting), this.media.addEventListener("playing", this.onPlaying)
32444                }, e.onMediaDetached = function () {
32445                    this.media && (this.media.removeEventListener("waiting", this.onWaiting), this.media.removeEventListener("playing", this.onPlaying), this.media = null)
32446                }, e.onBufferCreated = function (t, e) {
32447                    var r, i;
32448                    this.audioBuffer = null == (r = e.tracks.audio) ? void 0 : r.buffer, this.videoBuffer = null == (i = e.tracks.video) ? void 0 : i.buffer
32449                }, e.createData = function () {
32450                    var t;
32451                    return {
32452                        v: 1,
32453                        sf: Za.HLS,
32454                        sid: this.sid,
32455                        cid: this.cid,
32456                        pr: null == (t = this.media) ? void 0 : t.playbackRate,
32457                        mtp: this.hls.bandwidthEstimate / 1e3
32458                    }
32459                }, e.apply = function (t, e) {
32460                    void 0 === e && (e = {}), o(e, this.createData());
32461                    var r = e.ot === $a.INIT || e.ot === $a.VIDEO || e.ot === $a.MUXED;
32462                    this.starved && r && (e.bs = !0, e.su = !0, this.starved = !1), null == e.su && (e.su = this.buffering);
32463                    var i = this.includeKeys;
32464                    i && (e = Object.keys(e).reduce((function (t, r) {
32465                        return i.includes(r) && (t[r] = e[r]), t
32466                    }), {})), this.useHeaders ? (t.headers || (t.headers = {}), Fs(t.headers, e)) : t.url = Ns(t.url, e)
32467                }, e.getObjectType = function (t) {
32468                    var e = t.type;
32469                    return "subtitle" === e ? $a.TIMED_TEXT : "initSegment" === t.sn ? $a.INIT : "audio" === e ? $a.AUDIO : "main" === e ? this.hls.audioTracks.length ? $a.VIDEO : $a.MUXED : void 0
32470                }, e.getTopBandwidth = function (t) {
32471                    var e, r = 0,
32472                        i = this.hls;
32473                    if (t === $a.AUDIO) e = i.audioTracks;
32474                    else {
32475                        var n = i.maxAutoLevel,
32476                            a = n > -1 ? n + 1 : i.levels.length;
32477                        e = i.levels.slice(0, a)
32478                    }
32479                    for (var s, o = g(e); !(s = o()).done;) {
32480                        var l = s.value;
32481                        l.bitrate > r && (r = l.bitrate)
32482                    }
32483                    return r > 0 ? r : NaN
32484                }, e.getBufferLength = function (t) {
32485                    var e = this.hls.media,
32486                        r = t === $a.AUDIO ? this.audioBuffer : this.videoBuffer;
32487                    return r && e ? 1e3 * Jr.bufferInfo(r, e.currentTime, this.config.maxBufferHole).len : NaN
32488                }, e.createPlaylistLoader = function () {
32489                    var t = this.config.pLoader,
32490                        e = this.applyPlaylistData,
32491                        r = t || this.config.loader;
32492                    return function () {
32493                        function t(t) {
32494                            this.loader = void 0, this.loader = new r(t)
32495                        }
32496                        var i = t.prototype;
32497                        return i.destroy = function () {
32498                            this.loader.destroy()
32499                        }, i.abort = function () {
32500                            this.loader.abort()
32501                        }, i.load = function (t, r, i) {
32502                            e(t), this.loader.load(t, r, i)
32503                        }, s(t, [{
32504                            key: "stats",
32505                            get: function () {
32506                                return this.loader.stats
32507                            }
32508                        }, {
32509                            key: "context",
32510                            get: function () {
32511                                return this.loader.context
32512                            }
32513                        }]), t
32514                    }()
32515                }, e.createFragmentLoader = function () {
32516                    var t = this.config.fLoader,
32517                        e = this.applyFragmentData,
32518                        r = t || this.config.loader;
32519                    return function () {
32520                        function t(t) {
32521                            this.loader = void 0, this.loader = new r(t)
32522                        }
32523                        var i = t.prototype;
32524                        return i.destroy = function () {
32525                            this.loader.destroy()
32526                        }, i.abort = function () {
32527                            this.loader.abort()
32528                        }, i.load = function (t, r, i) {
32529                            e(t), this.loader.load(t, r, i)
32530                        }, s(t, [{
32531                            key: "stats",
32532                            get: function () {
32533                                return this.loader.stats
32534                            }
32535                        }, {
32536                            key: "context",
32537                            get: function () {
32538                                return this.loader.context
32539                            }
32540                        }]), t
32541                    }()
32542                }, t
32543            }(),
32544            Bs = function () {
32545                function t(t) {
32546                    this.hls = void 0, this.log = void 0, this.loader = null, this.uri = null, this.pathwayId = ".", this.pathwayPriority = null, this.timeToLoad = 300, this.reloadTimer = -1, this.updated = 0, this.started = !1, this.enabled = !0, this.levels = null, this.audioTracks = null, this.subtitleTracks = null, this.penalizedPathways = {}, this.hls = t, this.log = w.log.bind(w, "[content-steering]:"), this.registerListeners()
32547                }
32548                var e = t.prototype;
32549                return e.registerListeners = function () {
32550                    var t = this.hls;
32551                    t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.ERROR, this.onError, this)
32552                }, e.unregisterListeners = function () {
32553                    var t = this.hls;
32554                    t && (t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.ERROR, this.onError, this))
32555                }, e.startLoad = function () {
32556                    if (this.started = !0, this.clearTimeout(), this.enabled && this.uri) {
32557                        if (this.updated) {
32558                            var t = 1e3 * this.timeToLoad - (performance.now() - this.updated);
32559                            if (t > 0) return void this.scheduleRefresh(this.uri, t)
32560                        }
32561                        this.loadSteeringManifest(this.uri)
32562                    }
32563                }, e.stopLoad = function () {
32564                    this.started = !1, this.loader && (this.loader.destroy(), this.loader = null), this.clearTimeout()
32565                }, e.clearTimeout = function () {
32566                    -1 !== this.reloadTimer && (self.clearTimeout(this.reloadTimer), this.reloadTimer = -1)
32567                }, e.destroy = function () {
32568                    this.unregisterListeners(), this.stopLoad(), this.hls = null, this.levels = this.audioTracks = this.subtitleTracks = null
32569                }, e.removeLevel = function (t) {
32570                    var e = this.levels;
32571                    e && (this.levels = e.filter((function (e) {
32572                        return e !== t
32573                    })))
32574                }, e.onManifestLoading = function () {
32575                    this.stopLoad(), this.enabled = !0, this.timeToLoad = 300, this.updated = 0, this.uri = null, this.pathwayId = ".", this.levels = this.audioTracks = this.subtitleTracks = null
32576                }, e.onManifestLoaded = function (t, e) {
32577                    var r = e.contentSteering;
32578                    null !== r && (this.pathwayId = r.pathwayId, this.uri = r.uri, this.started && this.startLoad())
32579                }, e.onManifestParsed = function (t, e) {
32580                    this.audioTracks = e.audioTracks, this.subtitleTracks = e.subtitleTracks
32581                }, e.onError = function (t, e) {
32582                    var r = e.errorAction;
32583                    if ((null == r ? void 0 : r.action) === Lr && r.flags === br) {
32584                        var i = this.levels,
32585                            n = this.pathwayPriority,
32586                            a = this.pathwayId;
32587                        if (e.context) {
32588                            var s = e.context,
32589                                o = s.groupId,
32590                                l = s.pathwayId,
32591                                u = s.type;
32592                            o && i ? a = this.getPathwayForGroupId(o, u, a) : l && (a = l)
32593                        }
32594                        a in this.penalizedPathways || (this.penalizedPathways[a] = performance.now()), !n && i && (n = i.reduce((function (t, e) {
32595                            return -1 === t.indexOf(e.pathwayId) && t.push(e.pathwayId), t
32596                        }), [])), n && n.length > 1 && (this.updatePathwayPriority(n), r.resolved = this.pathwayId !== a), r.resolved || w.warn("Could not resolve " + e.details + ' ("' + e.error.message + '") with content-steering for Pathway: ' + a + " levels: " + (i ? i.length : i) + " priorities: " + JSON.stringify(n) + " penalized: " + JSON.stringify(this.penalizedPathways))
32597                    }
32598                }, e.filterParsedLevels = function (t) {
32599                    this.levels = t;
32600                    var e = this.getLevelsForPathway(this.pathwayId);
32601                    if (0 === e.length) {
32602                        var r = t[0].pathwayId;
32603                        this.log("No levels found in Pathway " + this.pathwayId + '. Setting initial Pathway to "' + r + '"'), e = this.getLevelsForPathway(r), this.pathwayId = r
32604                    }
32605                    return e.length !== t.length ? (this.log("Found " + e.length + "/" + t.length + ' levels in Pathway "' + this.pathwayId + '"'), e) : t
32606                }, e.getLevelsForPathway = function (t) {
32607                    return null === this.levels ? [] : this.levels.filter((function (e) {
32608                        return t === e.pathwayId
32609                    }))
32610                }, e.updatePathwayPriority = function (t) {
32611                    var e;
32612                    this.pathwayPriority = t;
32613                    var r = this.penalizedPathways,
32614                        i = performance.now();
32615                    Object.keys(r).forEach((function (t) {
32616                        i - r[t] > 3e5 && delete r[t]
32617                    }));
32618                    for (var n = 0; n < t.length; n++) {
32619                        var a = t[n];
32620                        if (!(a in r)) {
32621                            if (a === this.pathwayId) return;
32622                            var s = this.hls.nextLoadLevel,
32623                                o = this.hls.levels[s];
vendor: 9,191 bytes, lines 32624-32772
32624                            if ((e = this.getLevelsForPathway(a)).length > 0) {
32625                                this.log('Setting Pathway to "' + a + '"'), this.pathwayId = a, dr(e), this.hls.trigger(S.LEVELS_UPDATED, {
32626                                    levels: e
32627                                });
32628                                var l = this.hls.levels[s];
32629                                o && l && this.levels && (l.attrs["STABLE-VARIANT-ID"] !== o.attrs["STABLE-VARIANT-ID"] && l.bitrate !== o.bitrate && this.log("Unstable Pathways change from bitrate " + o.bitrate + " to " + l.bitrate), this.hls.nextLoadLevel = s);
32630                                break
32631                            }
32632                        }
32633                    }
32634                }, e.getPathwayForGroupId = function (t, e, r) {
32635                    for (var i = this.getLevelsForPathway(r).concat(this.levels || []), n = 0; n < i.length; n++)
32636                        if (e === De && i[n].hasAudioGroup(t) || e === Ie && i[n].hasSubtitleGroup(t)) return i[n].pathwayId;
32637                    return r
32638                }, e.clonePathways = function (t) {
32639                    var e = this,
32640                        r = this.levels;
32641                    if (r) {
32642                        var i = {},
32643                            n = {};
32644                        t.forEach((function (t) {
32645                            var a = t.ID,
32646                                s = t["BASE-ID"],
32647                                o = t["URI-REPLACEMENT"];
32648                            if (!r.some((function (t) {
32649                                    return t.pathwayId === a
32650                                }))) {
32651                                var l = e.getLevelsForPathway(s).map((function (t) {
32652                                    var e = new x(t.attrs);
32653                                    e["PATHWAY-ID"] = a;
32654                                    var r = e.AUDIO && e.AUDIO + "_clone_" + a,
32655                                        s = e.SUBTITLES && e.SUBTITLES + "_clone_" + a;
32656                                    r && (i[e.AUDIO] = r, e.AUDIO = r), s && (n[e.SUBTITLES] = s, e.SUBTITLES = s);
32657                                    var l = Ks(t.uri, e["STABLE-VARIANT-ID"], "PER-VARIANT-URIS", o),
32658                                        u = new rr({
32659                                            attrs: e,
32660                                            audioCodec: t.audioCodec,
32661                                            bitrate: t.bitrate,
32662                                            height: t.height,
32663                                            name: t.name,
32664                                            url: l,
32665                                            videoCodec: t.videoCodec,
32666                                            width: t.width
32667                                        });
32668                                    if (t.audioGroups)
32669                                        for (var h = 1; h < t.audioGroups.length; h++) u.addGroupId("audio", t.audioGroups[h] + "_clone_" + a);
32670                                    if (t.subtitleGroups)
32671                                        for (var d = 1; d < t.subtitleGroups.length; d++) u.addGroupId("text", t.subtitleGroups[d] + "_clone_" + a);
32672                                    return u
32673                                }));
32674                                r.push.apply(r, l), Gs(e.audioTracks, i, o, a), Gs(e.subtitleTracks, n, o, a)
32675                            }
32676                        }))
32677                    }
32678                }, e.loadSteeringManifest = function (t) {
32679                    var e, r = this,
32680                        i = this.hls.config,
32681                        n = i.loader;
32682                    this.loader && this.loader.destroy(), this.loader = new n(i);
32683                    try {
32684                        e = new self.URL(t)
32685                    } catch (e) {
32686                        return this.enabled = !1, void this.log("Failed to parse Steering Manifest URI: " + t)
32687                    }
32688                    if ("data:" !== e.protocol) {
32689                        var a = 0 | (this.hls.bandwidthEstimate || i.abrEwmaDefaultEstimate);
32690                        e.searchParams.set("_HLS_pathway", this.pathwayId), e.searchParams.set("_HLS_throughput", "" + a)
32691                    }
32692                    var s = {
32693                            responseType: "json",
32694                            url: e.href
32695                        },
32696                        o = i.steeringManifestLoadPolicy.default,
32697                        l = o.errorRetry || o.timeoutRetry || {},
32698                        u = {
32699                            loadPolicy: o,
32700                            timeout: o.maxLoadTimeMs,
32701                            maxRetry: l.maxNumRetry || 0,
32702                            retryDelay: l.retryDelayMs || 0,
32703                            maxRetryDelay: l.maxRetryDelayMs || 0
32704                        },
32705                        h = {
32706                            onSuccess: function (t, i, n, a) {
32707                                r.log('Loaded steering manifest: "' + e + '"');
32708                                var s = t.data;
32709                                if (1 === s.VERSION) {
32710                                    r.updated = performance.now(), r.timeToLoad = s.TTL;
32711                                    var o = s["RELOAD-URI"],
32712                                        l = s["PATHWAY-CLONES"],
32713                                        u = s["PATHWAY-PRIORITY"];
32714                                    if (o) try {
32715                                        r.uri = new self.URL(o, e).href
32716                                    } catch (t) {
32717                                        return r.enabled = !1, void r.log("Failed to parse Steering Manifest RELOAD-URI: " + o)
32718                                    }
32719                                    r.scheduleRefresh(r.uri || n.url), l && r.clonePathways(l);
32720                                    var h = {
32721                                        steeringManifest: s,
32722                                        url: e.toString()
32723                                    };
32724                                    r.hls.trigger(S.STEERING_MANIFEST_LOADED, h), u && r.updatePathwayPriority(u)
32725                                } else r.log("Steering VERSION " + s.VERSION + " not supported!")
32726                            },
32727                            onError: function (t, e, i, n) {
32728                                if (r.log("Error loading steering manifest: " + t.code + " " + t.text + " (" + e.url + ")"), r.stopLoad(), 410 === t.code) return r.enabled = !1, void r.log("Steering manifest " + e.url + " no longer available");
32729                                var a = 1e3 * r.timeToLoad;
32730                                if (429 !== t.code) r.scheduleRefresh(r.uri || e.url, a);
32731                                else {
32732                                    var s = r.loader;
32733                                    if ("function" == typeof (null == s ? void 0 : s.getResponseHeader)) {
32734                                        var o = s.getResponseHeader("Retry-After");
32735                                        o && (a = 1e3 * parseFloat(o))
32736                                    }
32737                                    r.log("Steering manifest " + e.url + " rate limited")
32738                                }
32739                            },
32740                            onTimeout: function (t, e, i) {
32741                                r.log("Timeout loading steering manifest (" + e.url + ")"), r.scheduleRefresh(r.uri || e.url)
32742                            }
32743                        };
32744                    this.log("Requesting steering manifest: " + e), this.loader.load(s, u, h)
32745                }, e.scheduleRefresh = function (t, e) {
32746                    var r = this;
32747                    void 0 === e && (e = 1e3 * this.timeToLoad), this.clearTimeout(), this.reloadTimer = self.setTimeout((function () {
32748                        var e, i = null == (e = r.hls) ? void 0 : e.media;
32749                        !i || i.ended ? r.scheduleRefresh(t, 1e3 * r.timeToLoad) : r.loadSteeringManifest(t)
32750                    }), e)
32751                }, t
32752            }();
32753
32754        function Gs(t, e, r, i) {
32755            t && Object.keys(e).forEach((function (n) {
32756                var a = t.filter((function (t) {
32757                    return t.groupId === n
32758                })).map((function (t) {
32759                    var a = o({}, t);
32760                    return a.details = void 0, a.attrs = new x(a.attrs), a.url = a.attrs.URI = Ks(t.url, t.attrs["STABLE-RENDITION-ID"], "PER-RENDITION-URIS", r), a.groupId = a.attrs["GROUP-ID"] = e[n], a.attrs["PATHWAY-ID"] = i, a
32761                }));
32762                t.push.apply(t, a)
32763            }))
32764        }
32765
32766        function Ks(t, e, r, i) {
32767            var n, a = i.HOST,
32768                s = i.PARAMS,
32769                o = i[r];
32770            e && (n = null == o ? void 0 : o[e]) && (t = n);
32771            var l = new self.URL(t);
32772            return a && !n && (l.host = a), s && Object.keys(s).sort().forEac
vendor: 6,877 bytes, lines 32772-32872
32772h((function (t) {
32773                t && l.searchParams.set(t, s[t])
32774            })), l.href
32775        }
32776        var Hs = /^age:\s*[\d.]+\s*$/im,
32777            Vs = function () {
32778                function t(t) {
32779                    this.xhrSetup = void 0, this.requestTimeout = void 0, this.retryTimeout = void 0, this.retryDelay = void 0, this.config = null, this.callbacks = null, this.context = null, this.loader = null, this.stats = void 0, this.xhrSetup = t && t.xhrSetup || null, this.stats = new M, this.retryDelay = 0
32780                }
32781                var e = t.prototype;
32782                return e.destroy = function () {
32783                    this.callbacks = null, this.abortInternal(), this.loader = null, this.config = null, this.context = null, this.xhrSetup = null, this.stats = null
32784                }, e.abortInternal = function () {
32785                    var t = this.loader;
32786                    self.clearTimeout(this.requestTimeout), self.clearTimeout(this.retryTimeout), t && (t.onreadystatechange = null, t.onprogress = null, 4 !== t.readyState && (this.stats.aborted = !0, t.abort()))
32787                }, e.abort = function () {
32788                    var t;
32789                    this.abortInternal(), null != (t = this.callbacks) && t.onAbort && this.callbacks.onAbort(this.stats, this.context, this.loader)
32790                }, e.load = function (t, e, r) {
32791                    if (this.stats.loading.start) throw new Error("Loader can only be used once.");
32792                    this.stats.loading.start = self.performance.now(), this.context = t, this.config = e, this.callbacks = r, this.loadInternal()
32793                }, e.loadInternal = function () {
32794                    var t = this,
32795                        e = this.config,
32796                        r = this.context;
32797                    if (e && r) {
32798                        var i = this.loader = new self.XMLHttpRequest,
32799                            n = this.stats;
32800                        n.loading.first = 0, n.loaded = 0, n.aborted = !1;
32801                        var a = this.xhrSetup;
32802                        a ? Promise.resolve().then((function () {
32803                            if (!t.stats.aborted) return a(i, r.url)
32804                        })).catch((function (t) {
32805                            return i.open("GET", r.url, !0), a(i, r.url)
32806                        })).then((function () {
32807                            t.stats.aborted || t.openAndSendXhr(i, r, e)
32808                        })).catch((function (e) {
32809                            t.callbacks.onError({
32810                                code: i.status,
32811                                text: e.message
32812                            }, r, i, n)
32813                        })) : this.openAndSendXhr(i, r, e)
32814                    }
32815                }, e.openAndSendXhr = function (t, e, r) {
32816                    t.readyState || t.open("GET", e.url, !0);
32817                    var i = e.headers,
32818                        n = r.loadPolicy,
32819                        a = n.maxTimeToFirstByteMs,
32820                        s = n.maxLoadTimeMs;
32821                    if (i)
32822                        for (var o in i) t.setRequestHeader(o, i[o]);
32823                    e.rangeEnd && t.setRequestHeader("Range", "bytes=" + e.rangeStart + "-" + (e.rangeEnd - 1)), t.onreadystatechange = this.readystatechange.bind(this), t.onprogress = this.loadprogress.bind(this), t.responseType = e.responseType, self.clearTimeout(this.requestTimeout), r.timeout = a && y(a) ? a : s, this.requestTimeout = self.setTimeout(this.loadtimeout.bind(this), r.timeout), t.send()
32824                }, e.readystatechange = function () {
32825                    var t = this.context,
32826                        e = this.loader,
32827                        r = this.stats;
32828                    if (t && e) {
32829                        var i = e.readyState,
32830                            n = this.config;
32831                        if (!r.aborted && i >= 2 && (0 === r.loading.first && (r.loading.first = Math.max(self.performance.now(), r.loading.start), n.timeout !== n.loadPolicy.maxLoadTimeMs && (self.clearTimeout(this.requestTimeout), n.timeout = n.loadPolicy.maxLoadTimeMs, this.requestTimeout = self.setTimeout(this.loadtimeout.bind(this), n.loadPolicy.maxLoadTimeMs - (r.loading.first - r.loading.start)))), 4 === i)) {
32832                            self.clearTimeout(this.requestTimeout), e.onreadystatechange = null, e.onprogress = null;
32833                            var a = e.status,
32834                                s = "text" !== e.responseType;
32835                            if (a >= 200 && a < 300 && (s && e.response || null !== e.responseText)) {
32836                                r.loading.end = Math.max(self.performance.now(), r.loading.first);
32837                                var o = s ? e.response : e.responseText,
32838                                    l = "arraybuffer" === e.responseType ? o.byteLength : o.length;
32839                                if (r.loaded = r.total = l, r.bwEstimate = 8e3 * r.total / (r.loading.end - r.loading.first), !this.callbacks) return;
32840                                var u = this.callbacks.onProgress;
32841                                if (u && u(r, t, o, e), !this.callbacks) return;
32842                                var h = {
32843                                    url: e.responseURL,
32844                                    data: o,
32845                                    code: a
32846                                };
32847                                this.callbacks.onSuccess(h, r, t, e)
32848                            } else {
32849                                var d = n.loadPolicy.errorRetry;
32850                                mr(d, r.retry, !1, {
32851                                    url: t.url,
32852                                    data: void 0,
32853                                    code: a
32854                                }) ? this.retry(d) : (w.error(a + " while loading " + t.url), this.callbacks.onError({
32855                                    code: a,
32856                                    text: e.statusText
32857                                }, t, e, r))
32858                            }
32859                        }
32860                    }
32861                }, e.loadtimeout = function () {
32862                    var t, e = null == (t = this.config) ? void 0 : t.loadPolicy.timeoutRetry;
32863                    if (mr(e, this.stats.retry, !0)) this.retry(e);
32864                    else {
32865                        var r;
32866                        w.warn("timeout while loading " + (null == (r = this.context) ? void 0 : r.url));
32867                        var i = this.callbacks;
32868                        i && (this.abortInternal(), i.onTimeout(this.stats, this.context, this.loader))
32869                    }
32870                }, e.retry = function (t) {
32871                    var e = this.context,
32872                        r = this.stats;
vendor: 7,862 bytes, lines 32873-32994
32873                    this.retryDelay = gr(t, r.retry), r.retry++, w.warn((status ? "HTTP Status " + status : "Timeout") + " while loading " + (null == e ? void 0 : e.url) + ", retrying " + r.retry + "/" + t.maxNumRetry + " in " + this.retryDelay + "ms"), this.abortInternal(), this.loader = null, self.clearTimeout(this.retryTimeout), this.retryTimeout = self.setTimeout(this.loadInternal.bind(this), this.retryDelay)
32874                }, e.loadprogress = function (t) {
32875                    var e = this.stats;
32876                    e.loaded = t.loaded, t.lengthComputable && (e.total = t.total)
32877                }, e.getCacheAge = function () {
32878                    var t = null;
32879                    if (this.loader && Hs.test(this.loader.getAllResponseHeaders())) {
32880                        var e = this.loader.getResponseHeader("age");
32881                        t = e ? parseFloat(e) : null
32882                    }
32883                    return t
32884                }, e.getResponseHeader = function (t) {
32885                    return this.loader && new RegExp("^" + t + ":\\s*[\\d.]+\\s*$", "im").test(this.loader.getAllResponseHeaders()) ? this.loader.getResponseHeader(t) : null
32886                }, t
32887            }(),
32888            Ys = /(\d+)-(\d+)\/(\d+)/,
32889            Ws = function () {
32890                function t(t) {
32891                    this.fetchSetup = void 0, this.requestTimeout = void 0, this.request = null, this.response = null, this.controller = void 0, this.context = null, this.config = null, this.callbacks = null, this.stats = void 0, this.loader = null, this.fetchSetup = t.fetchSetup || js, this.controller = new self.AbortController, this.stats = new M
32892                }
32893                var e = t.prototype;
32894                return e.destroy = function () {
32895                    this.loader = this.callbacks = this.context = this.config = this.request = null, this.abortInternal(), this.response = null, this.fetchSetup = this.controller = this.stats = null
32896                }, e.abortInternal = function () {
32897                    this.controller && !this.stats.loading.end && (this.stats.aborted = !0, this.controller.abort())
32898                }, e.abort = function () {
32899                    var t;
32900                    this.abortInternal(), null != (t = this.callbacks) && t.onAbort && this.callbacks.onAbort(this.stats, this.context, this.response)
32901                }, e.load = function (t, e, r) {
32902                    var i = this,
32903                        n = this.stats;
32904                    if (n.loading.start) throw new Error("Loader can only be used once.");
32905                    n.loading.start = self.performance.now();
32906                    var a = function (t, e) {
32907                            var r = {
32908                                method: "GET",
32909                                mode: "cors",
32910                                credentials: "same-origin",
32911                                signal: e,
32912                                headers: new self.Headers(o({}, t.headers))
32913                            };
32914                            return t.rangeEnd && r.headers.set("Range", "bytes=" + t.rangeStart + "-" + String(t.rangeEnd - 1)), r
32915                        }(t, this.controller.signal),
32916                        s = r.onProgress,
32917                        l = "arraybuffer" === t.responseType,
32918                        u = l ? "byteLength" : "length",
32919                        h = e.loadPolicy,
32920                        d = h.maxTimeToFirstByteMs,
32921                        c = h.maxLoadTimeMs;
32922                    this.context = t, this.config = e, this.callbacks = r, this.request = this.fetchSetup(t, a), self.clearTimeout(this.requestTimeout), e.timeout = d && y(d) ? d : c, this.requestTimeout = self.setTimeout((function () {
32923                        i.abortInternal(), r.onTimeout(n, t, i.response)
32924                    }), e.timeout), self.fetch(this.request).then((function (a) {
32925                        i.response = i.loader = a;
32926                        var o = Math.max(self.performance.now(), n.loading.start);
32927                        if (self.clearTimeout(i.requestTimeout), e.timeout = c, i.requestTimeout = self.setTimeout((function () {
32928                                i.abortInternal(), r.onTimeout(n, t, i.response)
32929                            }), c - (o - n.loading.start)), !a.ok) {
32930                            var u = a.status,
32931                                h = a.statusText;
32932                            throw new Xs(h || "fetch, bad network response", u, a)
32933                        }
32934                        return n.loading.first = o, n.total = function (t) {
32935                            var e = t.get("Content-Range");
32936                            if (e) {
32937                                var r = function (t) {
32938                                    var e = Ys.exec(t);
32939                                    if (e) return parseInt(e[2]) - parseInt(e[1]) + 1
32940                                }(e);
32941                                if (y(r)) return r
32942                            }
32943                            var i = t.get("Content-Length");
32944                            if (i) return parseInt(i)
32945                        }(a.headers) || n.total, s && y(e.highWaterMark) ? i.loadProgressively(a, n, t, e.highWaterMark, s) : l ? a.arrayBuffer() : "json" === t.responseType ? a.json() : a.text()
32946                    })).then((function (a) {
32947                        var o = i.response;
32948                        if (!o) throw new Error("loader destroyed");
32949                        self.clearTimeout(i.requestTimeout), n.loading.end = Math.max(self.performance.now(), n.loading.first);
32950                        var l = a[u];
32951                        l && (n.loaded = n.total = l);
32952                        var h = {
32953                            url: o.url,
32954                            data: a,
32955                            code: o.status
32956                        };
32957                        s && !y(e.highWaterMark) && s(n, t, a, o), r.onSuccess(h, n, t, o)
32958                    })).catch((function (e) {
32959                        if (self.clearTimeout(i.requestTimeout), !n.aborted) {
32960                            var a = e && e.code || 0,
32961                                s = e ? e.message : null;
32962                            r.onError({
32963                                code: a,
32964                                text: s
32965                            }, t, e ? e.details : null, n)
32966                        }
32967                    }))
32968                }, e.getCacheAge = function () {
32969                    var t = null;
32970                    if (this.response) {
32971                        var e = this.response.headers.get("age");
32972                        t = e ? parseFloat(e) : null
32973                    }
32974                    return t
32975                }, e.getResponseHeader = function (t) {
32976                    return this.response ? this.response.headers.get(t) : null
32977                }, e.loadProgressively = function (t, e, r, i, n) {
32978                    void 0 === i && (i = 0);
32979                    var a = new Di,
32980                        s = t.body.getReader();
32981                    return function o() {
32982                        return s.read().then((function (s) {
32983                            if (s.done) return a.dataLength && n(e, r, a.flush(), t), Promise.resolve(new ArrayBuffer(0));
32984                            var l = s.value,
32985                                u = l.length;
32986                            return e.loaded += u, u < i || a.dataLength ? (a.push(l), a.dataLength >= i && n(e, r, a.flush(), t)) : n(e, r, l, t), o()
32987                        })).catch((function () {
32988                            return Promise.reject()
32989                        }))
32990                    }()
32991                }, t
32992            }();
32993
32994        function js(t, e) {
vendor: 10,426 bytes, lines 32995-33234
32995            return new self.Request(t.url, e)
32996        }
32997        var qs, Xs = function (t) {
32998                function e(e, r, i) {
32999                    var n;
33000                    return (n = t.call(this, e) || this).code = void 0, n.details = void 0, n.code = r, n.details = i, n
33001                }
33002                return l(e, t), e
33003            }(c(Error)),
33004            zs = /\s/,
33005            Qs = i(i({
33006                autoStartLoad: !0,
33007                startPosition: -1,
33008                defaultAudioCodec: void 0,
33009                debug: !1,
33010                capLevelOnFPSDrop: !1,
33011                capLevelToPlayerSize: !1,
33012                ignoreDevicePixelRatio: !1,
33013                preferManagedMediaSource: !0,
33014                initialLiveManifestSize: 1,
33015                maxBufferLength: 30,
33016                backBufferLength: 1 / 0,
33017                frontBufferFlushThreshold: 1 / 0,
33018                maxBufferSize: 6e7,
33019                maxBufferHole: .1,
33020                highBufferWatchdogPeriod: 2,
33021                nudgeOffset: .1,
33022                nudgeMaxRetry: 3,
33023                maxFragLookUpTolerance: .25,
33024                liveSyncDurationCount: 3,
33025                liveMaxLatencyDurationCount: 1 / 0,
33026                liveSyncDuration: void 0,
33027                liveMaxLatencyDuration: void 0,
33028                maxLiveSyncPlaybackRate: 1,
33029                liveDurationInfinity: !1,
33030                liveBackBufferLength: null,
33031                maxMaxBufferLength: 600,
33032                enableWorker: !0,
33033                workerPath: null,
33034                enableSoftwareAES: !0,
33035                startLevel: void 0,
33036                startFragPrefetch: !1,
33037                fpsDroppedMonitoringPeriod: 5e3,
33038                fpsDroppedMonitoringThreshold: .2,
33039                appendErrorMaxRetry: 3,
33040                loader: Vs,
33041                fLoader: void 0,
33042                pLoader: void 0,
33043                xhrSetup: void 0,
33044                licenseXhrSetup: void 0,
33045                licenseResponseCallback: void 0,
33046                abrController: Kr,
33047                bufferController: $n,
33048                capLevelController: Xa,
33049                errorController: Ir,
33050                fpsController: za,
33051                stretchShortVideoTrack: !1,
33052                maxAudioFramesDrift: 1,
33053                forceKeyFrameOnDiscontinuity: !0,
33054                abrEwmaFastLive: 3,
33055                abrEwmaSlowLive: 9,
33056                abrEwmaFastVoD: 3,
33057                abrEwmaSlowVoD: 9,
33058                abrEwmaDefaultEstimate: 5e5,
33059                abrEwmaDefaultEstimateMax: 5e6,
33060                abrBandWidthFactor: .95,
33061                abrBandWidthUpFactor: .7,
33062                abrMaxWithRealBitrate: !1,
33063                maxStarvationDelay: 4,
33064                maxLoadingDelay: 4,
33065                minAutoBitrate: 0,
33066                emeEnabled: !1,
33067                widevineLicenseUrl: void 0,
33068                drmSystems: {},
33069                drmSystemOptions: {},
33070                requestMediaKeySystemAccessFunc: it,
33071                testBandwidth: !0,
33072                progressive: !1,
33073                lowLatencyMode: !0,
33074                cmcd: void 0,
33075                enableDateRangeMetadataCues: !0,
33076                enableEmsgMetadataCues: !0,
33077                enableID3MetadataCues: !0,
33078                useMediaCapabilities: !0,
33079                certLoadPolicy: {
33080                    default: {
33081                        maxTimeToFirstByteMs: 8e3,
33082                        maxLoadTimeMs: 2e4,
33083                        timeoutRetry: null,
33084                        errorRetry: null
33085                    }
33086                },
33087                keyLoadPolicy: {
33088                    default: {
33089                        maxTimeToFirstByteMs: 8e3,
33090                        maxLoadTimeMs: 2e4,
33091                        timeoutRetry: {
33092                            maxNumRetry: 1,
33093                            retryDelayMs: 1e3,
33094                            maxRetryDelayMs: 2e4,
33095                            backoff: "linear"
33096                        },
33097                        errorRetry: {
33098                            maxNumRetry: 8,
33099                            retryDelayMs: 1e3,
33100                            maxRetryDelayMs: 2e4,
33101                            backoff: "linear"
33102                        }
33103                    }
33104                },
33105                manifestLoadPolicy: {
33106                    default: {
33107                        maxTimeToFirstByteMs: 1 / 0,
33108                        maxLoadTimeMs: 2e4,
33109                        timeoutRetry: {
33110                            maxNumRetry: 2,
33111                            retryDelayMs: 0,
33112                            maxRetryDelayMs: 0
33113                        },
33114                        errorRetry: {
33115                            maxNumRetry: 1,
33116                            retryDelayMs: 1e3,
33117                            maxRetryDelayMs: 8e3
33118                        }
33119                    }
33120                },
33121                playlistLoadPolicy: {
33122                    default: {
33123                        maxTimeToFirstByteMs: 1e4,
33124                        maxLoadTimeMs: 2e4,
33125                        timeoutRetry: {
33126                            maxNumRetry: 2,
33127                            retryDelayMs: 0,
33128                            maxRetryDelayMs: 0
33129                        },
33130                        errorRetry: {
33131                            maxNumRetry: 2,
33132                            retryDelayMs: 1e3,
33133                            maxRetryDelayMs: 8e3
33134                        }
33135                    }
33136                },
33137                fragLoadPolicy: {
33138                    default: {
33139                        maxTimeToFirstByteMs: 1e4,
33140                        maxLoadTimeMs: 12e4,
33141                        timeoutRetry: {
33142                            maxNumRetry: 4,
33143                            retryDelayMs: 0,
33144                            maxRetryDelayMs: 0
33145                        },
33146                        errorRetry: {
33147                            maxNumRetry: 6,
33148                            retryDelayMs: 1e3,
33149                            maxRetryDelayMs: 8e3
33150                        }
33151                    }
33152                },
33153                steeringManifestLoadPolicy: {
33154                    default: {
33155                        maxTimeToFirstByteMs: 1e4,
33156                        maxLoadTimeMs: 2e4,
33157                        timeoutRetry: {
33158                            maxNumRetry: 2,
33159                            retryDelayMs: 0,
33160                            maxRetryDelayMs: 0
33161                        },
33162                        errorRetry: {
33163                            maxNumRetry: 1,
33164                            retryDelayMs: 1e3,
33165                            maxRetryDelayMs: 8e3
33166                        }
33167                    }
33168                },
33169                manifestLoadingTimeOut: 1e4,
33170                manifestLoadingMaxRetry: 1,
33171                manifestLoadingRetryDelay: 1e3,
33172                manifestLoadingMaxRetryTimeout: 64e3,
33173                levelLoadingTimeOut: 1e4,
33174                levelLoadingMaxRetry: 4,
33175                levelLoadingRetryDelay: 1e3,
33176                levelLoadingMaxRetryTimeout: 64e3,
33177                fragLoadingTimeOut: 2e4,
33178                fragLoadingMaxRetry: 6,
33179                fragLoadingRetryDelay: 1e3,
33180                fragLoadingMaxRetryTimeout: 64e3
33181            }, {
33182                cueHandler: {
33183                    newCue: function (t, e, r, i) {
33184                        for (var n, a, s, o, l, u = [], h = self.VTTCue || self.TextTrackCue, d = 0; d < i.rows.length; d++)
33185                            if (s = !0, o = 0, l = "", !(n = i.rows[d]).isEmpty()) {
33186                                for (var c, f = 0; f < n.chars.length; f++) zs.test(n.chars[f].uchar) && s ? o++ : (l += n.chars[f].uchar, s = !1);
33187                                n.cueStartTime = e, e === r && (r += 1e-4), o >= 16 ? o-- : o++;
33188                                var g = Da(l.trim()),
33189                                    v = xa(e, r, g);
33190                                null != t && null != (c = t.cues) && c.getCueById(v) || ((a = new h(e, r, g)).id = v, a.line = d + 1, a.align = "left", a.position = 10 + Math.min(80, 10 * Math.floor(8 * o / 32)), u.push(a))
33191                            } return t && u.length && (u.sort((function (t, e) {
33192                            return "auto" === t.line || "auto" === e.line ? 0 : t.line > 8 && e.line > 8 ? e.line - t.line : t.line - e.line
33193                        })), u.forEach((function (e) {
33194                            return Oe(t, e)
33195                        }))), u
33196                    }
33197                },
33198                enableWebVTT: !0,
33199                enableIMSC1: !0,
33200                enableCEA708Captions: !0,
33201                captionsTextTrack1Label: "English",
33202                captionsTextTrack1LanguageCode: "en",
33203                captionsTextTrack2Label: "Spanish",
33204                captionsTextTrack2LanguageCode: "es",
33205                captionsTextTrack3Label: "Unknown CC",
33206                captionsTextTrack3LanguageCode: "",
33207                captionsTextTrack4Label: "Unknown CC",
33208                captionsTextTrack4LanguageCode: "",
33209                renderTextTracksNatively: !0
33210            }), {}, {
33211                subtitleStreamController: qn,
33212                subtitleTrackController: zn,
33213                timelineController: Wa,
33214                audioStreamController: Wn,
33215                audioTrackController: jn,
33216                emeController: Ja,
33217                cmcdController: Us,
33218                contentSteeringController: Bs
33219            });
33220
33221        function Js(t) {
33222            return t && "object" == typeof t ? Array.isArray(t) ? t.map(Js) : Object.keys(t).reduce((function (e, r) {
33223                return e[r] = Js(t[r]), e
33224            }), {}) : t
33225        }
33226
33227        function $s(t) {
33228            var e = t.loader;
33229            e !== Ws && e !== Vs ? (w.log("[config]: Custom loader detected, cannot enable progressive streaming"), t.progressive = !1) : function () {
33230                if (self.fetch && self.AbortController && self.ReadableStream && self.Request) try {
33231                    return new self.ReadableStream({}), !0
33232                } catch (t) {}
33233                return !1
33234            }
vendor: 18,136 bytes, lines 33234-33547
33234() && (t.loader = Ws, t.progressive = !0, t.enableSoftwareAES = !0, w.log("[config]: Progressive streaming enabled, using FetchLoader"))
33235        }
33236        var Zs = function (t) {
33237            function e(e, r) {
33238                var i;
33239                return (i = t.call(this, e, "[level-controller]") || this)._levels = [], i._firstLevel = -1, i._maxAutoLevel = -1, i._startLevel = void 0, i.currentLevel = null, i.currentLevelIndex = -1, i.manualLevelIndex = -1, i.steering = void 0, i.onParsedComplete = void 0, i.steering = r, i._registerListeners(), i
33240            }
33241            l(e, t);
33242            var r = e.prototype;
33243            return r._registerListeners = function () {
33244                var t = this.hls;
33245                t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(S.LEVEL_LOADED, this.onLevelLoaded, this), t.on(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this), t.on(S.ERROR, this.onError, this)
33246            }, r._unregisterListeners = function () {
33247                var t = this.hls;
33248                t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(S.LEVEL_LOADED, this.onLevelLoaded, this), t.off(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this), t.off(S.ERROR, this.onError, this)
33249            }, r.destroy = function () {
33250                this._unregisterListeners(), this.steering = null, this.resetLevels(), t.prototype.destroy.call(this)
33251            }, r.stopLoad = function () {
33252                this._levels.forEach((function (t) {
33253                    t.loadError = 0, t.fragmentError = 0
33254                })), t.prototype.stopLoad.call(this)
33255            }, r.resetLevels = function () {
33256                this._startLevel = void 0, this.manualLevelIndex = -1, this.currentLevelIndex = -1, this.currentLevel = null, this._levels = [], this._maxAutoLevel = -1
33257            }, r.onManifestLoading = function (t, e) {
33258                this.resetLevels()
33259            }, r.onManifestLoaded = function (t, e) {
33260                var r = this.hls.config.preferManagedMediaSource,
33261                    i = [],
33262                    n = {},
33263                    a = {},
33264                    s = !1,
33265                    o = !1,
33266                    l = !1;
33267                e.levels.forEach((function (t) {
33268                    var e, u, h = t.attrs,
33269                        d = t.audioCodec,
33270                        c = t.videoCodec; - 1 !== (null == (e = d) ? void 0 : e.indexOf("mp4a.40.34")) && (qs || (qs = /chrome|firefox/i.test(navigator.userAgent)), qs && (t.audioCodec = d = void 0)), d && (t.audioCodec = d = he(d, r)), 0 === (null == (u = c) ? void 0 : u.indexOf("avc1")) && (c = t.videoCodec = function (t) {
33271                        var e = t.split(".");
33272                        if (e.length > 2) {
33273                            var r = e.shift() + ".";
33274                            return (r += parseInt(e.shift()).toString(16)) + ("000" + parseInt(e.shift()).toString(16)).slice(-4)
33275                        }
33276                        return t
33277                    }(c));
33278                    var f = t.width,
33279                        g = t.height,
33280                        v = t.unknownCodecs;
33281                    if (s || (s = !(!f || !g)), o || (o = !!c), l || (l = !!d), !(null != v && v.length || d && !ie(d, "audio", r) || c && !ie(c, "video", r))) {
33282                        var m = h.CODECS,
33283                            p = h["FRAME-RATE"],
33284                            y = h["HDCP-LEVEL"],
33285                            E = h["PATHWAY-ID"],
33286                            T = h.RESOLUTION,
33287                            S = h["VIDEO-RANGE"],
33288                            L = (E || ".") + "-" + t.bitrate + "-" + T + "-" + p + "-" + m + "-" + S + "-" + y;
33289                        if (n[L])
33290                            if (n[L].uri === t.url || t.attrs["PATHWAY-ID"]) n[L].addGroupId("audio", h.AUDIO), n[L].addGroupId("text", h.SUBTITLES);
33291                            else {
33292                                var A = a[L] += 1;
33293                                t.attrs["PATHWAY-ID"] = new Array(A + 1).join(".");
33294                                var R = new rr(t);
33295                                n[L] = R, i.push(R)
33296                            }
33297                        else {
33298                            var k = new rr(t);
33299                            n[L] = k, a[L] = 1, i.push(k)
33300                        }
33301                    }
33302                })), this.filterAndSortMediaOptions(i, e, s, o, l)
33303            }, r.filterAndSortMediaOptions = function (t, e, r, i, n) {
33304                var a = this,
33305                    s = [],
33306                    o = [],
33307                    l = t;
33308                if ((r || i) && n && (l = l.filter((function (t) {
33309                        var e, r = t.videoCodec,
33310                            i = t.videoRange,
33311                            n = t.width,
33312                            a = t.height;
33313                        return (!!r || !(!n || !a)) && !!(e = i) && Qe.indexOf(e) > -1
33314                    }))), 0 !== l.length) {
33315                    if (e.audioTracks) {
33316                        var u = this.hls.config.preferManagedMediaSource;
33317                        to(s = e.audioTracks.filter((function (t) {
33318                            return !t.audioCodec || ie(t.audioCodec, "audio", u)
33319                        })))
33320                    }
33321                    e.subtitles && to(o = e.subtitles);
33322                    var h = l.slice(0);
33323                    l.sort((function (t, e) {
33324                        if (t.attrs["HDCP-LEVEL"] !== e.attrs["HDCP-LEVEL"]) return (t.attrs["HDCP-LEVEL"] || "") > (e.attrs["HDCP-LEVEL"] || "") ? 1 : -1;
33325                        if (r && t.height !== e.height) return t.height - e.height;
33326                        if (t.frameRate !== e.frameRate) return t.frameRate - e.frameRate;
33327                        if (t.videoRange !== e.videoRange) return Qe.indexOf(t.videoRange) - Qe.indexOf(e.videoRange);
33328                        if (t.videoCodec !== e.videoCodec) {
33329                            var i = se(t.videoCodec),
33330                                n = se(e.videoCodec);
33331                            if (i !== n) return n - i
33332                        }
33333                        if (t.uri === e.uri && t.codecSet !== e.codecSet) {
33334                            var a = oe(t.codecSet),
33335                                s = oe(e.codecSet);
33336                            if (a !== s) return s - a
33337                        }
33338                        return t.averageBitrate !== e.averageBitrate ? t.averageBitrate - e.averageBitrate : 0
33339                    }));
33340                    var d = h[0];
33341                    if (this.steering && (l = this.steering.filterParsedLevels(l)).length !== h.length)
33342                        for (var c = 0; c < h.length; c++)
33343                            if (h[c].pathwayId === l[0].pathwayId) {
33344                                d = h[c];
33345                                break
33346                            } this._levels = l;
33347                    for (var f = 0; f < l.length; f++)
33348                        if (l[f] === d) {
33349                            var g;
33350                            this._firstLevel = f;
33351                            var v = d.bitrate,
33352                                m = this.hls.bandwidthEstimate;
33353                            if (this.log("manifest loaded, " + l.length + " level(s) found, first bitrate: " + v), void 0 === (null == (g = this.hls.userConfig) ? void 0 : g.abrEwmaDefaultEstimate)) {
33354                                var p = Math.min(v, this.hls.config.abrEwmaDefaultEstimateMax);
33355                                p > m && m === Qs.abrEwmaDefaultEstimate && (this.hls.bandwidthEstimate = p)
33356                            }
33357                            break
33358                        } var y = n && !i,
33359                        E = {
33360                            levels: l,
33361                            audioTracks: s,
33362                            subtitleTracks: o,
33363                            sessionData: e.sessionData,
33364                            sessionKeys: e.sessionKeys,
33365                            firstLevel: this._firstLevel,
33366                            stats: e.stats,
33367                            audio: n,
33368                            video: i,
33369                            altAudio: !y && s.some((function (t) {
33370                                return !!t.url
33371                            }))
33372                        };
33373                    this.hls.trigger(S.MANIFEST_PARSED, E), (this.hls.config.autoStartLoad || this.hls.forceStartLoad) && this.hls.startLoad(this.hls.config.startPosition)
33374                } else Promise.resolve().then((function () {
33375                    if (a.hls) {
33376                        e.levels.length && a.warn("One or more CODECS in variant not supported: " + JSON.stringify(e.levels[0].attrs));
33377                        var t = new Error("no level with compatible codecs found in manifest");
33378                        a.hls.trigger(S.ERROR, {
33379                            type: L.MEDIA_ERROR,
33380                            details: A.MANIFEST_INCOMPATIBLE_CODECS_ERROR,
33381                            fatal: !0,
33382                            url: e.url,
33383                            error: t,
33384                            reason: t.message
33385                        })
33386                    }
33387                }))
33388            }, r.onError = function (t, e) {
33389                !e.fatal && e.context && e.context.type === be && e.context.level === this.level && this.checkRetry(e)
33390            }, r.onFragBuffered = function (t, e) {
33391                var r = e.frag;
33392                if (void 0 !== r && r.type === we) {
33393                    var i = r.elementaryStreams;
33394                    if (!Object.keys(i).some((function (t) {
33395                            return !!i[t]
33396                        }))) return;
33397                    var n = this._levels[r.level];
33398                    null != n && n.loadError && (this.log("Resetting level error count of " + n.loadError + " on frag buffered"), n.loadError = 0)
33399                }
33400            }, r.onLevelLoaded = function (t, e) {
33401                var r, i, n = e.level,
33402                    a = e.details,
33403                    s = this._levels[n];
33404                if (!s) return this.warn("Invalid level index " + n), void(null != (i = e.deliveryDirectives) && i.skip && (a.deltaUpdateFailed = !0));
33405                n === this.currentLevelIndex ? (0 === s.fragmentError && (s.loadError = 0), this.playlistLoaded(n, e, s.details)) : null != (r = e.deliveryDirectives) && r.skip && (a.deltaUpdateFailed = !0)
33406            }, r.loadPlaylist = function (e) {
33407                t.prototype.loadPlaylist.call(this);
33408                var r = this.currentLevelIndex,
33409                    i = this.currentLevel;
33410                if (i && this.shouldLoadPlaylist(i)) {
33411                    var n = i.uri;
33412                    if (e) try {
33413                        n = e.addDirectives(n)
33414                    } catch (t) {
33415                        this.warn("Could not construct new URL with HLS Delivery Directives: " + t)
33416                    }
33417                    var a = i.attrs["PATHWAY-ID"];
33418                    this.log("Loading level index " + r + (void 0 !== (null == e ? void 0 : e.msn) ? " at sn " + e.msn + " part " + e.part : "") + " with" + (a ? " Pathway " + a : "") + " " + n), this.clearTimer(), this.hls.trigger(S.LEVEL_LOADING, {
33419                        url: n,
33420                        level: r,
33421                        pathwayId: i.attrs["PATHWAY-ID"],
33422                        id: 0,
33423                        deliveryDirectives: e || null
33424                    })
33425                }
33426            }, r.removeLevel = function (t) {
33427                var e, r = this,
33428                    i = this._levels.filter((function (e, i) {
33429                        return i !== t || (r.steering && r.steering.removeLevel(e), e === r.currentLevel && (r.currentLevel = null, r.currentLevelIndex = -1, e.details && e.details.fragments.forEach((function (t) {
33430                            return t.level = -1
33431                        }))), !1)
33432                    }));
33433                dr(i), this._levels = i, this.currentLevelIndex > -1 && null != (e = this.currentLevel) && e.details && (this.currentLevelIndex = this.currentLevel.details.fragments[0].level), this.hls.trigger(S.LEVELS_UPDATED, {
33434                    levels: i
33435                })
33436            }, r.onLevelsUpdated = function (t, e) {
33437                var r = e.levels;
33438                this._levels = r
33439            }, r.checkMaxAutoUpdated = function () {
33440                var t = this.hls,
33441                    e = t.autoLevelCapping,
33442                    r = t.maxAutoLevel,
33443                    i = t.maxHdcpLevel;
33444                this._maxAutoLevel !== r && (this._maxAutoLevel = r, this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED, {
33445                    autoLevelCapping: e,
33446                    levels: this.levels,
33447                    maxAutoLevel: r,
33448                    minAutoLevel: this.hls.minAutoLevel,
33449                    maxHdcpLevel: i
33450                }))
33451            }, s(e, [{
33452                key: "levels",
33453                get: function () {
33454                    return 0 === this._levels.length ? null : this._levels
33455                }
33456            }, {
33457                key: "level",
33458                get: function () {
33459                    return this.currentLevelIndex
33460                },
33461                set: function (t) {
33462                    var e = this._levels;
33463                    if (0 !== e.length) {
33464                        if (t < 0 || t >= e.length) {
33465                            var r = new Error("invalid level idx"),
33466                                i = t < 0;
33467                            if (this.hls.trigger(S.ERROR, {
33468                                    type: L.OTHER_ERROR,
33469                                    details: A.LEVEL_SWITCH_ERROR,
33470                                    level: t,
33471                                    fatal: i,
33472                                    error: r,
33473                                    reason: r.message
33474                                }), i) return;
33475                            t = Math.min(t, e.length - 1)
33476                        }
33477                        var n = this.currentLevelIndex,
33478                            a = this.currentLevel,
33479                            s = a ? a.attrs["PATHWAY-ID"] : void 0,
33480                            o = e[t],
33481                            l = o.attrs["PATHWAY-ID"];
33482                        if (this.currentLevelIndex = t, this.currentLevel = o, n !== t || !o.details || !a || s !== l) {
33483                            this.log("Switching to level " + t + " (" + (o.height ? o.height + "p " : "") + (o.videoRange ? o.videoRange + " " : "") + (o.codecSet ? o.codecSet + " " : "") + "@" + o.bitrate + ")" + (l ? " with Pathway " + l : "") + " from level " + n + (s ? " with Pathway " + s : ""));
33484                            var u = {
33485                                level: t,
33486                                attrs: o.attrs,
33487                                details: o.details,
33488                                bitrate: o.bitrate,
33489                                averageBitrate: o.averageBitrate,
33490                                maxBitrate: o.maxBitrate,
33491                                realBitrate: o.realBitrate,
33492                                width: o.width,
33493                                height: o.height,
33494                                codecSet: o.codecSet,
33495                                audioCodec: o.audioCodec,
33496                                videoCodec: o.videoCodec,
33497                                audioGroups: o.audioGroups,
33498                                subtitleGroups: o.subtitleGroups,
33499                                loaded: o.loaded,
33500                                loadError: o.loadError,
33501                                fragmentError: o.fragmentError,
33502                                name: o.name,
33503                                id: o.id,
33504                                uri: o.uri,
33505                                url: o.url,
33506                                urlId: 0,
33507                                audioGroupIds: o.audioGroupIds,
33508                                textGroupIds: o.textGroupIds
33509                            };
33510                            this.hls.trigger(S.LEVEL_SWITCHING, u);
33511                            var h = o.details;
33512                            if (!h || h.live) {
33513                                var d = this.switchParams(o.uri, null == a ? void 0 : a.details, h);
33514                                this.loadPlaylist(d)
33515                            }
33516                        }
33517                    }
33518                }
33519            }, {
33520                key: "manualLevel",
33521                get: function () {
33522                    return this.manualLevelIndex
33523                },
33524                set: function (t) {
33525                    this.manualLevelIndex = t, void 0 === this._startLevel && (this._startLevel = t), -1 !== t && (this.level = t)
33526                }
33527            }, {
33528                key: "firstLevel",
33529                get: function () {
33530                    return this._firstLevel
33531                },
33532                set: function (t) {
33533                    this._firstLevel = t
33534                }
33535            }, {
33536                key: "startLevel",
33537                get: function () {
33538                    if (void 0 === this._startLevel) {
33539                        var t = this.hls.config.startLevel;
33540                        return void 0 !== t ? t : this.hls.firstAutoLevel
33541                    }
33542                    return this._startLevel
33543                },
33544                set: function (t) {
33545                    this._startLevel = t
33546                }
33547            }, {
vendor: 13,014 bytes, lines 33548-33795
33548                key: "nextLoadLevel",
33549                get: function () {
33550                    return -1 !== this.manualLevelIndex ? this.manualLevelIndex : this.hls.nextAutoLevel
33551                },
33552                set: function (t) {
33553                    this.level = t, -1 === this.manualLevelIndex && (this.hls.nextAutoLevel = t)
33554                }
33555            }]), e
33556        }(wr);
33557
33558        function to(t) {
33559            var e = {};
33560            t.forEach((function (t) {
33561                var r = t.groupId || "";
33562                t.id = e[r] = e[r] || 0, e[r]++
33563            }))
33564        }
33565        var eo = function () {
33566            function t(t) {
33567                this.config = void 0, this.keyUriToKeyInfo = {}, this.emeController = null, this.config = t
33568            }
33569            var e = t.prototype;
33570            return e.abort = function (t) {
33571                for (var e in this.keyUriToKeyInfo) {
33572                    var r = this.keyUriToKeyInfo[e].loader;
33573                    if (r) {
33574                        var i;
33575                        if (t && t !== (null == (i = r.context) ? void 0 : i.frag.type)) return;
33576                        r.abort()
33577                    }
33578                }
33579            }, e.detach = function () {
33580                for (var t in this.keyUriToKeyInfo) {
33581                    var e = this.keyUriToKeyInfo[t];
33582                    (e.mediaKeySessionContext || e.decryptdata.isCommonEncryption) && delete this.keyUriToKeyInfo[t]
33583                }
33584            }, e.destroy = function () {
33585                for (var t in this.detach(), this.keyUriToKeyInfo) {
33586                    var e = this.keyUriToKeyInfo[t].loader;
33587                    e && e.destroy()
33588                }
33589                this.keyUriToKeyInfo = {}
33590            }, e.createKeyLoadError = function (t, e, r, i, n) {
33591                return void 0 === e && (e = A.KEY_LOAD_ERROR), new li({
33592                    type: L.NETWORK_ERROR,
33593                    details: e,
33594                    fatal: !1,
33595                    frag: t,
33596                    response: n,
33597                    error: r,
33598                    networkDetails: i
33599                })
33600            }, e.loadClear = function (t, e) {
33601                var r = this;
33602                if (this.emeController && this.config.emeEnabled)
33603                    for (var i = t.sn, n = t.cc, a = function () {
33604                            var t = e[s];
33605                            if (n <= t.cc && ("initSegment" === i || "initSegment" === t.sn || i < t.sn)) return r.emeController.selectKeySystemFormat(t).then((function (e) {
33606                                t.setKeyFormat(e)
33607                            })), 1
33608                        }, s = 0; s < e.length && !a(); s++);
33609            }, e.load = function (t) {
33610                var e = this;
33611                return !t.decryptdata && t.encrypted && this.emeController ? this.emeController.selectKeySystemFormat(t).then((function (r) {
33612                    return e.loadInternal(t, r)
33613                })) : this.loadInternal(t)
33614            }, e.loadInternal = function (t, e) {
33615                var r, i;
33616                e && t.setKeyFormat(e);
33617                var n = t.decryptdata;
33618                if (!n) {
33619                    var a = new Error(e ? "Expected frag.decryptdata to be defined after setting format " + e : "Missing decryption data on fragment in onKeyLoading");
33620                    return Promise.reject(this.createKeyLoadError(t, A.KEY_LOAD_ERROR, a))
33621                }
33622                var s = n.uri;
33623                if (!s) return Promise.reject(this.createKeyLoadError(t, A.KEY_LOAD_ERROR, new Error('Invalid key URI: "' + s + '"')));
33624                var o, l = this.keyUriToKeyInfo[s];
33625                if (null != (r = l) && r.decryptdata.key) return n.key = l.decryptdata.key, Promise.resolve({
33626                    frag: t,
33627                    keyInfo: l
33628                });
33629                if (null != (i = l) && i.keyLoadPromise) switch (null == (o = l.mediaKeySessionContext) ? void 0 : o.keyStatus) {
33630                case void 0:
33631                case "status-pending":
33632                case "usable":
33633                case "usable-in-future":
33634                    return l.keyLoadPromise.then((function (e) {
33635                        return n.key = e.keyInfo.decryptdata.key, {
33636                            frag: t,
33637                            keyInfo: l
33638                        }
33639                    }))
33640                }
33641                switch (l = this.keyUriToKeyInfo[s] = {
33642                    decryptdata: n,
33643                    keyLoadPromise: null,
33644                    loader: null,
33645                    mediaKeySessionContext: null
33646                }, n.method) {
33647                case "ISO-23001-7":
33648                case "SAMPLE-AES":
33649                case "SAMPLE-AES-CENC":
33650                case "SAMPLE-AES-CTR":
33651                    return "identity" === n.keyFormat ? this.loadKeyHTTP(l, t) : this.loadKeyEME(l, t);
33652                case "AES-128":
33653                    return this.loadKeyHTTP(l, t);
33654                default:
33655                    return Promise.reject(this.createKeyLoadError(t, A.KEY_LOAD_ERROR, new Error('Key supplied with unsupported METHOD: "' + n.method + '"')))
33656                }
33657            }, e.loadKeyEME = function (t, e) {
33658                var r = {
33659                    frag: e,
33660                    keyInfo: t
33661                };
33662                if (this.emeController && this.config.emeEnabled) {
33663                    var i = this.emeController.loadKey(r);
33664                    if (i) return (t.keyLoadPromise = i.then((function (e) {
33665                        return t.mediaKeySessionContext = e, r
33666                    }))).catch((function (e) {
33667                        throw t.keyLoadPromise = null, e
33668                    }))
33669                }
33670                return Promise.resolve(r)
33671            }, e.loadKeyHTTP = function (t, e) {
33672                var r = this,
33673                    n = this.config,
33674                    a = new(0, n.loader)(n);
33675                return e.keyLoader = t.loader = a, t.keyLoadPromise = new Promise((function (s, o) {
33676                    var l = {
33677                            keyInfo: t,
33678                            frag: e,
33679                            responseType: "arraybuffer",
33680                            url: t.decryptdata.uri
33681                        },
33682                        u = n.keyLoadPolicy.default,
33683                        h = {
33684                            loadPolicy: u,
33685                            timeout: u.maxLoadTimeMs,
33686                            maxRetry: 0,
33687                            retryDelay: 0,
33688                            maxRetryDelay: 0
33689                        },
33690                        d = {
33691                            onSuccess: function (t, e, i, n) {
33692                                var a = i.frag,
33693                                    l = i.keyInfo,
33694                                    u = i.url;
33695                                if (!a.decryptdata || l !== r.keyUriToKeyInfo[u]) return o(r.createKeyLoadError(a, A.KEY_LOAD_ERROR, new Error("after key load, decryptdata unset or changed"), n));
33696                                l.decryptdata.key = a.decryptdata.key = new Uint8Array(t.data), a.keyLoader = null, l.loader = null, s({
33697                                    frag: a,
33698                                    keyInfo: l
33699                                })
33700                            },
33701                            onError: function (t, n, a, s) {
33702                                r.resetLoader(n), o(r.createKeyLoadError(e, A.KEY_LOAD_ERROR, new Error("HTTP Error " + t.code + " loading key " + t.text), a, i({
33703                                    url: l.url,
33704                                    data: void 0
33705                                }, t)))
33706                            },
33707                            onTimeout: function (t, i, n) {
33708                                r.resetLoader(i), o(r.createKeyLoadError(e, A.KEY_LOAD_TIMEOUT, new Error("key loading timed out"), n))
33709                            },
33710                            onAbort: function (t, i, n) {
33711                                r.resetLoader(i), o(r.createKeyLoadError(e, A.INTERNAL_ABORTED, new Error("key loading aborted"), n))
33712                            }
33713                        };
33714                    a.load(l, h, d)
33715                }))
33716            }, e.resetLoader = function (t) {
33717                var e = t.frag,
33718                    r = t.keyInfo,
33719                    i = t.url,
33720                    n = r.loader;
33721                e.keyLoader === n && (e.keyLoader = null, r.loader = null), delete this.keyUriToKeyInfo[i], n && n.destroy()
33722            }, t
33723        }();
33724
33725        function ro() {
33726            return self.SourceBuffer || self.WebKitSourceBuffer
33727        }
33728
33729        function io() {
33730            if (!ee()) return !1;
33731            var t = ro();
33732            return !t || t.prototype && "function" == typeof t.prototype.appendBuffer && "function" == typeof t.prototype.remove
33733        }
33734        var no = function () {
33735                function t(t, e, r, i) {
33736                    this.config = void 0, this.media = null, this.fragmentTracker = void 0, this.hls = void 0, this.nudgeRetry = 0, this.stallReported = !1, this.stalled = null, this.moved = !1, this.seeking = !1, this.config = t, this.media = e, this.fragmentTracker = r, this.hls = i
33737                }
33738                var e = t.prototype;
33739                return e.destroy = function () {
33740                    this.media = null, this.hls = this.fragmentTracker = null
33741                }, e.poll = function (t, e) {
33742                    var r = this.config,
33743                        i = this.media,
33744                        n = this.stalled;
33745                    if (null !== i) {
33746                        var a = i.currentTime,
33747                            s = i.seeking,
33748                            o = this.seeking && !s,
33749                            l = !this.seeking && s;
33750                        if (this.seeking = s, a === t)
33751                            if (l || o) this.stalled = null;
33752                            else if (i.paused && !s || i.ended || 0 === i.playbackRate || !Jr.getBuffered(i).length) this.nudgeRetry = 0;
33753                        else {
33754                            var u = Jr.bufferInfo(i, a, 0),
33755                                h = u.nextStart || 0;
33756                            if (s) {
33757                                var d = u.len > 2,
33758                                    c = !h || e && e.start <= a || h - a > 2 && !this.fragmentTracker.getPartialFragment(a);
33759                                if (d || c) return;
33760                                this.moved = !1
33761                            }
33762                            if (!this.moved && null !== this.stalled) {
33763                                var f;
33764                                if (!(u.len > 0 || h)) return;
33765                                var g = Math.max(h, u.start || 0) - a,
33766                                    v = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null,
33767                                    m = (null == v || null == (f = v.details) ? void 0 : f.live) ? 2 * v.details.targetduration : 2,
33768                                    p = this.fragmentTracker.getPartialFragment(a);
33769                                if (g > 0 && (g <= m || p)) return void(i.paused || this._trySkipBufferHole(p))
33770                            }
33771                            var y = self.performance.now();
33772                            if (null !== n) {
33773                                var E = y - n;
33774                                if (s || !(E >= 250) || (this._reportStall(u), this.media)) {
33775                                    var T = Jr.bufferInfo(i, a, r.maxBufferHole);
33776                                    this._tryFixBufferStall(T, E)
33777                                }
33778                            } else this.stalled = y
33779                        } else if (this.moved = !0, s || (this.nudgeRetry = 0), null !== n) {
33780                            if (this.stallReported) {
33781                                var S = self.performance.now() - n;
33782                                w.warn("playback not stuck anymore @" + a + ", after " + Math.round(S) + "ms"), this.stallReported = !1
33783                            }
33784                            this.stalled = null
33785                        }
33786                    }
33787                }, e._tryFixBufferStall = function (t, e) {
33788                    var r = this.config,
33789                        i = this.fragmentTracker,
33790                        n = this.media;
33791                    if (null !== n) {
33792                        var a = n.currentTime,
33793                            s = i.getPartialFragment(a);
33794                        if (s && (this._trySkipBufferHole(s) || !this.media)) return;
33795                        (t.len >
vendor: 65,834 bytes, lines 33795-34879
33795 r.maxBufferHole || t.nextStart && t.nextStart - a < r.maxBufferHole) && e > 1e3 * r.highBufferWatchdogPeriod && (w.warn("Trying to nudge playhead over buffer-hole"), this.stalled = null, this._tryNudgeBuffer())
33796                    }
33797                }, e._reportStall = function (t) {
33798                    var e = this.hls,
33799                        r = this.media;
33800                    if (!this.stallReported && r) {
33801                        this.stallReported = !0;
33802                        var i = new Error("Playback stalling at @" + r.currentTime + " due to low buffer (" + JSON.stringify(t) + ")");
33803                        w.warn(i.message), e.trigger(S.ERROR, {
33804                            type: L.MEDIA_ERROR,
33805                            details: A.BUFFER_STALLED_ERROR,
33806                            fatal: !1,
33807                            error: i,
33808                            buffer: t.len
33809                        })
33810                    }
33811                }, e._trySkipBufferHole = function (t) {
33812                    var e = this.config,
33813                        r = this.hls,
33814                        i = this.media;
33815                    if (null === i) return 0;
33816                    var n = i.currentTime,
33817                        a = Jr.bufferInfo(i, n, 0),
33818                        s = n < a.start ? a.start : a.nextStart;
33819                    if (s) {
33820                        var o = a.len <= e.maxBufferHole,
33821                            l = a.len > 0 && a.len < 1 && i.readyState < 3,
33822                            u = s - n;
33823                        if (u > 0 && (o || l)) {
33824                            if (u > e.maxBufferHole) {
33825                                var h = this.fragmentTracker,
33826                                    d = !1;
33827                                if (0 === n) {
33828                                    var c = h.getAppendedFrag(0, we);
33829                                    c && s < c.end && (d = !0)
33830                                }
33831                                if (!d) {
33832                                    var f = t || h.getAppendedFrag(n, we);
33833                                    if (f) {
33834                                        for (var g = !1, v = f.end; v < s;) {
33835                                            var m = h.getPartialFragment(v);
33836                                            if (!m) {
33837                                                g = !0;
33838                                                break
33839                                            }
33840                                            v += m.duration
33841                                        }
33842                                        if (g) return 0
33843                                    }
33844                                }
33845                            }
33846                            var p = Math.max(s + .05, n + .1);
33847                            if (w.warn("skipping hole, adjusting currentTime from " + n + " to " + p), this.moved = !0, this.stalled = null, i.currentTime = p, t && !t.gap) {
33848                                var y = new Error("fragment loaded with buffer holes, seeking from " + n + " to " + p);
33849                                r.trigger(S.ERROR, {
33850                                    type: L.MEDIA_ERROR,
33851                                    details: A.BUFFER_SEEK_OVER_HOLE,
33852                                    fatal: !1,
33853                                    error: y,
33854                                    reason: y.message,
33855                                    frag: t
33856                                })
33857                            }
33858                            return p
33859                        }
33860                    }
33861                    return 0
33862                }, e._tryNudgeBuffer = function () {
33863                    var t = this.config,
33864                        e = this.hls,
33865                        r = this.media,
33866                        i = this.nudgeRetry;
33867                    if (null !== r) {
33868                        var n = r.currentTime;
33869                        if (this.nudgeRetry++, i < t.nudgeMaxRetry) {
33870                            var a = n + (i + 1) * t.nudgeOffset,
33871                                s = new Error("Nudging 'currentTime' from " + n + " to " + a);
33872                            w.warn(s.message), r.currentTime = a, e.trigger(S.ERROR, {
33873                                type: L.MEDIA_ERROR,
33874                                details: A.BUFFER_NUDGE_ON_STALL,
33875                                error: s,
33876                                fatal: !1
33877                            })
33878                        } else {
33879                            var o = new Error("Playhead still not moving while enough data buffered @" + n + " after " + t.nudgeMaxRetry + " nudges");
33880                            w.error(o.message), e.trigger(S.ERROR, {
33881                                type: L.MEDIA_ERROR,
33882                                details: A.BUFFER_STALLED_ERROR,
33883                                error: o,
33884                                fatal: !0
33885                            })
33886                        }
33887                    }
33888                }, t
33889            }(),
33890            ao = function (t) {
33891                function e(e, r, i) {
33892                    var n;
33893                    return (n = t.call(this, e, r, i, "[stream-controller]", we) || this).audioCodecSwap = !1, n.gapController = null, n.level = -1, n._forceStartLoad = !1, n.altAudio = !1, n.audioOnly = !1, n.fragPlaying = null, n.onvplaying = null, n.onvseeked = null, n.fragLastKbps = 0, n.couldBacktrack = !1, n.backtrackFragment = null, n.audioCodecSwitch = !1, n.videoBuffer = null, n._registerListeners(), n
33894                }
33895                l(e, t);
33896                var r = e.prototype;
33897                return r._registerListeners = function () {
33898                    var t = this.hls;
33899                    t.on(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(S.MANIFEST_LOADING, this.onManifestLoading, this), t.on(S.MANIFEST_PARSED, this.onManifestParsed, this), t.on(S.LEVEL_LOADING, this.onLevelLoading, this), t.on(S.LEVEL_LOADED, this.onLevelLoaded, this), t.on(S.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), t.on(S.ERROR, this.onError, this), t.on(S.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.on(S.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), t.on(S.BUFFER_CREATED, this.onBufferCreated, this), t.on(S.BUFFER_FLUSHED, this.onBufferFlushed, this), t.on(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(S.FRAG_BUFFERED, this.onFragBuffered, this)
33900                }, r._unregisterListeners = function () {
33901                    var t = this.hls;
33902                    t.off(S.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(S.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(S.MANIFEST_LOADING, this.onManifestLoading, this), t.off(S.MANIFEST_PARSED, this.onManifestParsed, this), t.off(S.LEVEL_LOADED, this.onLevelLoaded, this), t.off(S.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), t.off(S.ERROR, this.onError, this), t.off(S.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.off(S.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), t.off(S.BUFFER_CREATED, this.onBufferCreated, this), t.off(S.BUFFER_FLUSHED, this.onBufferFlushed, this), t.off(S.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(S.FRAG_BUFFERED, this.onFragBuffered, this)
33903                }, r.onHandlerDestroying = function () {
33904                    this._unregisterListeners(), t.prototype.onHandlerDestroying.call(this)
33905                }, r.startLoad = function (t) {
33906                    if (this.levels) {
33907                        var e = this.lastCurrentTime,
33908                            r = this.hls;
33909                        if (this.stopLoad(), this.setInterval(100), this.level = -1, !this.startFragRequested) {
33910                            var i = r.startLevel; - 1 === i && (r.config.testBandwidth && this.levels.length > 1 ? (i = 0, this.bitrateTest = !0) : i = r.firstAutoLevel), r.nextLoadLevel = i, this.level = r.loadLevel, this.loadedmetadata = !1
33911                        }
33912                        e > 0 && -1 === t && (this.log("Override startPosition with lastCurrentTime @" + e.toFixed(3)), t = e), this.state = vi, this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t, this.tick()
33913                    } else this._forceStartLoad = !0, this.state = gi
33914                }, r.stopLoad = function () {
33915                    this._forceStartLoad = !1, t.prototype.stopLoad.call(this)
33916                }, r.doTick = function () {
33917                    switch (this.state) {
33918                    case ki:
33919                        var t = this.levels,
33920                            e = this.level,
33921                            r = null == t ? void 0 : t[e],
33922                            i = null == r ? void 0 : r.details;
33923                        if (i && (!i.live || this.levelLastLoaded === r)) {
33924                            if (this.waitForCdnTuneIn(i)) break;
33925                            this.state = vi;
33926                            break
33927                        }
33928                        if (this.hls.nextLoadLevel !== this.level) {
33929                            this.state = vi;
33930                            break
33931                        }
33932                        break;
33933                    case yi:
33934                        var n, a = self.performance.now(),
33935                            s = this.retryDate;
33936                        if (!s || a >= s || null != (n = this.media) && n.seeking) {
33937                            var o = this.levels,
33938                                l = this.level,
33939                                u = null == o ? void 0 : o[l];
33940                            this.resetStartWhenNotLoaded(u || null), this.state = vi
33941                        }
33942                    }
33943                    this.state === vi && this.doTickIdle(), this.onTickEnd()
33944                }, r.onTickEnd = function () {
33945                    t.prototype.onTickEnd.call(this), this.checkBuffer(), this.checkFragmentChanged()
33946                }, r.doTickIdle = function () {
33947                    var t = this.hls,
33948                        e = this.levelLastLoaded,
33949                        r = this.levels,
33950                        i = this.media;
33951                    if (null !== e && (i || !this.startFragRequested && t.config.startFragPrefetch) && (!this.altAudio || !this.audioOnly)) {
33952                        var n = t.nextLoadLevel;
33953                        if (null != r && r[n]) {
33954                            var a = r[n],
33955                                s = this.getMainFwdBufferInfo();
33956                            if (null !== s) {
33957                                var o = this.getLevelDetails();
33958                                if (o && this._streamEnded(s, o)) {
33959                                    var l = {};
33960                                    return this.altAudio && (l.type = "video"), this.hls.trigger(S.BUFFER_EOS, l), void(this.state = Li)
33961                                }
33962                                t.loadLevel !== n && -1 === t.manualLevel && this.log("Adapting to level " + n + " from level " + this.level), this.level = t.nextLoadLevel = n;
33963                                var u = a.details;
33964                                if (!u || this.state === ki || u.live && this.levelLastLoaded !== a) return this.level = n, void(this.state = ki);
33965                                var h = s.len,
33966                                    d = this.getMaxBufferLength(a.maxBitrate);
33967                                if (!(h >= d)) {
33968                                    this.backtrackFragment && this.backtrackFragment.start > s.end && (this.backtrackFragment = null);
33969                                    var c = this.backtrackFragment ? this.backtrackFragment.start : s.end,
33970                                        f = this.getNextFragment(c, u);
33971                                    if (this.couldBacktrack && !this.fragPrevious && f && "initSegment" !== f.sn && this.fragmentTracker.getState(f) !== jr) {
33972                                        var g, v = (null != (g = this.backtrackFragment) ? g : f).sn - u.startSN,
33973                                            m = u.fragments[v - 1];
33974                                        m && f.cc === m.cc && (f = m, this.fragmentTracker.removeFragment(m))
33975                                    } else this.backtrackFragment && s.len && (this.backtrackFragment = null);
33976                                    if (f && this.isLoopLoading(f, c)) {
33977                                        if (!f.gap) {
33978                                            var p = this.audioOnly && !this.altAudio ? O : N,
33979                                                y = (p === N ? this.videoBuffer : this.mediaBuffer) || this.media;
33980                                            y && this.afterBufferFlushed(y, p, we)
33981                                        }
33982                                        f = this.getNextFragmentLoopLoading(f, u, s, we, d)
33983                                    }
33984                                    f && (!f.initSegment || f.initSegment.data || this.bitrateTest || (f = f.initSegment), this.loadFragment(f, a, c))
33985                                }
33986                            }
33987                        }
33988                    }
33989                }, r.loadFragment = function (e, r, i) {
33990                    var n = this.fragmentTracker.getState(e);
33991                    this.fragCurrent = e, n === Vr || n === Wr ? "initSegment" === e.sn ? this._loadInitSegment(e, r) : this.bitrateTest ? (this.log("Fragment " + e.sn + " of level " + e.level + " is being downloaded to test bitrate and will not be buffered"), this._loadBitrateTestFrag(e, r)) : (this.startFragRequested = !0, t.prototype.loadFragment.call(this, e, r, i)) : this.clearTrackerIfNeeded(e)
33992                }, r.getBufferedFrag = function (t) {
33993                    return this.fragmentTracker.getBufferedFrag(t, we)
33994                }, r.followingBufferedFrag = function (t) {
33995                    return t ? this.getBufferedFrag(t.end + .5) : null
33996                }, r.immediateLevelSwitch = function () {
33997                    this.abortCurrentFrag(), this.flushMainBuffer(0, Number.POSITIVE_INFINITY)
33998                }, r.nextLevelSwitch = function () {
33999                    var t = this.levels,
34000                        e = this.media;
34001                    if (null != e && e.readyState) {
34002                        var r, i = this.getAppendedFrag(e.currentTime);
34003                        i && i.start > 1 && this.flushMainBuffer(0, i.start - 1);
34004                        var n = this.getLevelDetails();
34005                        if (null != n && n.live) {
34006                            var a = this.getMainFwdBufferInfo();
34007                            if (!a || a.len < 2 * n.targetduration) return
34008                        }
34009                        if (!e.paused && t) {
34010                            var s = t[this.hls.nextLoadLevel],
34011                                o = this.fragLastKbps;
34012                            r = o && this.fragCurrent ? this.fragCurrent.duration * s.maxBitrate / (1e3 * o) + 1 : 0
34013                        } else r = 0;
34014                        var l = this.getBufferedFrag(e.currentTime + r);
34015                        if (l) {
34016                            var u = this.followingBufferedFrag(l);
34017                            if (u) {
34018                                this.abortCurrentFrag();
34019                                var h = u.maxStartPTS ? u.maxStartPTS : u.start,
34020                                    d = u.duration,
34021                                    c = Math.max(l.end, h + Math.min(Math.max(d - this.config.maxFragLookUpTolerance, d * (this.couldBacktrack ? .5 : .125)), d * (this.couldBacktrack ? .75 : .25)));
34022                                this.flushMainBuffer(c, Number.POSITIVE_INFINITY)
34023                            }
34024                        }
34025                    }
34026                }, r.abortCurrentFrag = function () {
34027                    var t = this.fragCurrent;
34028                    switch (this.fragCurrent = null, this.backtrackFragment = null, t && (t.abortRequests(), this.fragmentTracker.removeFragment(t)), this.state) {
34029                    case mi:
34030                    case pi:
34031                    case yi:
34032                    case Ti:
34033                    case Si:
34034                        this.state = vi
34035                    }
34036                    this.nextLoadPosition = this.getLoadPosition()
34037                }, r.flushMainBuffer = function (e, r) {
34038                    t.prototype.flushMainBuffer.call(this, e, r, this.altAudio ? "video" : null)
34039                }, r.onMediaAttached = function (e, r) {
34040                    t.prototype.onMediaAttached.call(this, e, r);
34041                    var i = r.media;
34042                    this.onvplaying = this.onMediaPlaying.bind(this), this.onvseeked = this.onMediaSeeked.bind(this), i.addEventListener("playing", this.onvplaying), i.addEventListener("seeked", this.onvseeked), this.gapController = new no(this.config, i, this.fragmentTracker, this.hls)
34043                }, r.onMediaDetaching = function () {
34044                    var e = this.media;
34045                    e && this.onvplaying && this.onvseeked && (e.removeEventListener("playing", this.onvplaying), e.removeEventListener("seeked", this.onvseeked), this.onvplaying = this.onvseeked = null, this.videoBuffer = null), this.fragPlaying = null, this.gapController && (this.gapController.destroy(), this.gapController = null), t.prototype.onMediaDetaching.call(this)
34046                }, r.onMediaPlaying = function () {
34047                    this.tick()
34048                }, r.onMediaSeeked = function () {
34049                    var t = this.media,
34050                        e = t ? t.currentTime : null;
34051                    y(e) && this.log("Media seeked to " + e.toFixed(3));
34052                    var r = this.getMainFwdBufferInfo();
34053                    null !== r && 0 !== r.len ? this.tick() : this.warn('Main forward buffer length on "seeked" event ' + (r ? r.len : "empty") + ")")
34054                }, r.onManifestLoading = function () {
34055                    this.log("Trigger BUFFER_RESET"), this.hls.trigger(S.BUFFER_RESET, void 0), this.fragmentTracker.removeAllFragments(), this.couldBacktrack = !1, this.startPosition = this.lastCurrentTime = this.fragLastKbps = 0, this.levels = this.fragPlaying = this.backtrackFragment = this.levelLastLoaded = null, this.altAudio = this.audioOnly = this.startFragRequested = !1
34056                }, r.onManifestParsed = function (t, e) {
34057                    var r, i, n = !1,
34058                        a = !1;
34059                    e.levels.forEach((function (t) {
34060                        var e = t.audioCodec;
34061                        e && (n = n || -1 !== e.indexOf("mp4a.40.2"), a = a || -1 !== e.indexOf("mp4a.40.5"))
34062                    })), this.audioCodecSwitch = n && a && !("function" == typeof (null == (i = ro()) || null == (r = i.prototype) ? void 0 : r.changeType)), this.audioCodecSwitch && this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"), this.levels = e.levels, this.startFragRequested = !1
34063                }, r.onLevelLoading = function (t, e) {
34064                    var r = this.levels;
34065                    if (r && this.state === vi) {
34066                        var i = r[e.level];
34067                        (!i.details || i.details.live && this.levelLastLoaded !== i || this.waitForCdnTuneIn(i.details)) && (this.state = ki)
34068                    }
34069                }, r.onLevelLoaded = function (t, e) {
34070                    var r, i = this.levels,
34071                        n = e.level,
34072                        a = e.details,
34073                        s = a.totalduration;
34074                    if (i) {
34075                        this.log("Level " + n + " loaded [" + a.startSN + "," + a.endSN + "]" + (a.lastPartSn ? "[part-" + a.lastPartSn + "-" + a.lastPartIndex + "]" : "") + ", cc [" + a.startCC + ", " + a.endCC + "] duration:" + s);
34076                        var o = i[n],
34077                            l = this.fragCurrent;
34078                        !l || this.state !== pi && this.state !== yi || l.level !== e.level && l.loader && this.abortCurrentFrag();
34079                        var u = 0;
34080                        if (a.live || null != (r = o.details) && r.live) {
34081                            var h;
34082                            if (this.checkLiveUpdate(a), a.deltaUpdateFailed) return;
34083                            u = this.alignPlaylists(a, o.details, null == (h = this.levelLastLoaded) ? void 0 : h.details)
34084                        }
34085                        if (o.details = a, this.levelLastLoaded = o, this.hls.trigger(S.LEVEL_UPDATED, {
34086                                details: a,
34087                                level: n
34088                            }), this.state === ki) {
34089                            if (this.waitForCdnTuneIn(a)) return;
34090                            this.state = vi
34091                        }
34092                        this.startFragRequested ? a.live && this.synchronizeToLiveEdge(a) : this.setStartPosition(a, u), this.tick()
34093                    } else this.warn("Levels were reset while loading level " + n)
34094                }, r._handleFragmentLoadProgress = function (t) {
34095                    var e, r = t.frag,
34096                        i = t.part,
34097                        n = t.payload,
34098                        a = this.levels;
34099                    if (a) {
34100                        var s = a[r.level],
34101                            o = s.details;
34102                        if (!o) return this.warn("Dropping fragment " + r.sn + " of level " + r.level + " after level details were reset"), void this.fragmentTracker.removeFragment(r);
34103                        var l = s.videoCodec,
34104                            u = o.PTSKnown || !o.live,
34105                            h = null == (e = r.initSegment) ? void 0 : e.data,
34106                            d = this._getAudioCodec(s),
34107                            c = this.transmuxer = this.transmuxer || new Kn(this.hls, we, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)),
34108                            f = i ? i.index : -1,
34109                            g = -1 !== f,
34110                            v = new $r(r.level, r.sn, r.stats.chunkCount, n.byteLength, f, g),
34111                            m = this.initPTS[r.cc];
34112                        c.push(n, h, d, l, r, i, o.totalduration, u, v, m)
34113                    } else this.warn("Levels were reset while fragment load was in progress. Fragment " + r.sn + " of level " + r.level + " will not be buffered")
34114                }, r.onAudioTrackSwitching = function (t, e) {
34115                    var r = this.altAudio;
34116                    if (!e.url) {
34117                        if (this.mediaBuffer !== this.media) {
34118                            this.log("Switching on main audio, use media.buffered to schedule main fragment loading"), this.mediaBuffer = this.media;
34119                            var i = this.fragCurrent;
34120                            i && (this.log("Switching to main audio track, cancel main fragment load"), i.abortRequests(), this.fragmentTracker.removeFragment(i)), this.resetTransmuxer(), this.resetLoadingState()
34121                        } else this.audioOnly && this.resetTransmuxer();
34122                        var n = this.hls;
34123                        r && (n.trigger(S.BUFFER_FLUSHING, {
34124                            startOffset: 0,
34125                            endOffset: Number.POSITIVE_INFINITY,
34126                            type: null
34127                        }), this.fragmentTracker.removeAllFragments()), n.trigger(S.AUDIO_TRACK_SWITCHED, e)
34128                    }
34129                }, r.onAudioTrackSwitched = function (t, e) {
34130                    var r = e.id,
34131                        i = !!this.hls.audioTracks[r].url;
34132                    if (i) {
34133                        var n = this.videoBuffer;
34134                        n && this.mediaBuffer !== n && (this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"), this.mediaBuffer = n)
34135                    }
34136                    this.altAudio = i, this.tick()
34137                }, r.onBufferCreated = function (t, e) {
34138                    var r, i, n = e.tracks,
34139                        a = !1;
34140                    for (var s in n) {
34141                        var o = n[s];
34142                        if ("main" === o.id) {
34143                            if (i = s, r = o, "video" === s) {
34144                                var l = n[s];
34145                                l && (this.videoBuffer = l.buffer)
34146                            }
34147                        } else a = !0
34148                    }
34149                    a && r ? (this.log("Alternate track found, use " + i + ".buffered to schedule main fragment loading"), this.mediaBuffer = r.buffer) : this.mediaBuffer = this.media
34150                }, r.onFragBuffered = function (t, e) {
34151                    var r = e.frag,
34152                        i = e.part;
34153                    if (!r || r.type === we) {
34154                        if (this.fragContextChanged(r)) return this.warn("Fragment " + r.sn + (i ? " p: " + i.index : "") + " of level " + r.level + " finished buffering, but was aborted. state: " + this.state), void(this.state === Si && (this.state = vi));
34155                        var n = i ? i.stats : r.stats;
34156                        this.fragLastKbps = Math.round(8 * n.total / (n.buffering.end - n.loading.first)), "initSegment" !== r.sn && (this.fragPrevious = r), this.fragBufferedComplete(r, i)
34157                    }
34158                }, r.onError = function (t, e) {
34159                    var r;
34160                    if (e.fatal) this.state = Ai;
34161                    else switch (e.details) {
34162                    case A.FRAG_GAP:
34163                    case A.FRAG_PARSING_ERROR:
34164                    case A.FRAG_DECRYPT_ERROR:
34165                    case A.FRAG_LOAD_ERROR:
34166                    case A.FRAG_LOAD_TIMEOUT:
34167                    case A.KEY_LOAD_ERROR:
34168                    case A.KEY_LOAD_TIMEOUT:
34169                        this.onFragmentOrKeyLoadError(we, e);
34170                        break;
34171                    case A.LEVEL_LOAD_ERROR:
34172                    case A.LEVEL_LOAD_TIMEOUT:
34173                    case A.LEVEL_PARSING_ERROR:
34174                        e.levelRetry || this.state !== ki || (null == (r = e.context) ? void 0 : r.type) !== be || (this.state = vi);
34175                        break;
34176                    case A.BUFFER_APPEND_ERROR:
34177                    case A.BUFFER_FULL_ERROR:
34178                        if (!e.parent || "main" !== e.parent) return;
34179                        if (e.details === A.BUFFER_APPEND_ERROR) return void this.resetLoadingState();
34180                        this.reduceLengthAndFlushBuffer(e) && this.flushMainBuffer(0, Number.POSITIVE_INFINITY);
34181                        break;
34182                    case A.INTERNAL_EXCEPTION:
34183                        this.recoverWorkerError(e)
34184                    }
34185                }, r.checkBuffer = function () {
34186                    var t = this.media,
34187                        e = this.gapController;
34188                    if (t && e && t.readyState) {
34189                        if (this.loadedmetadata || !Jr.getBuffered(t).length) {
34190                            var r = this.state !== vi ? this.fragCurrent : null;
34191                            e.poll(this.lastCurrentTime, r)
34192                        }
34193                        this.lastCurrentTime = t.currentTime
34194                    }
34195                }, r.onFragLoadEmergencyAborted = function () {
34196                    this.state = vi, this.loadedmetadata || (this.startFragRequested = !1, this.nextLoadPosition = this.startPosition), this.tickImmediate()
34197                }, r.onBufferFlushed = function (t, e) {
34198                    var r = e.type;
34199                    if (r !== O || this.audioOnly && !this.altAudio) {
34200                        var i = (r === N ? this.videoBuffer : this.mediaBuffer) || this.media;
34201                        this.afterBufferFlushed(i, r, we), this.tick()
34202                    }
34203                }, r.onLevelsUpdated = function (t, e) {
34204                    this.level > -1 && this.fragCurrent && (this.level = this.fragCurrent.level), this.levels = e.levels
34205                }, r.swapAudioCodec = function () {
34206                    this.audioCodecSwap = !this.audioCodecSwap
34207                }, r.seekToStartPos = function () {
34208                    var t = this.media;
34209                    if (t) {
34210                        var e = t.currentTime,
34211                            r = this.startPosition;
34212                        if (r >= 0 && e < r) {
34213                            if (t.seeking) return void this.log("could not seek to " + r + ", already seeking at " + e);
34214                            var i = Jr.getBuffered(t),
34215                                n = (i.length ? i.start(0) : 0) - r;
34216                            n > 0 && (n < this.config.maxBufferHole || n < this.config.maxFragLookUpTolerance) && (this.log("adjusting start position by " + n + " to match buffer start"), r += n, this.startPosition = r), this.log("seek to target start position " + r + " from current time " + e), t.currentTime = r
34217                        }
34218                    }
34219                }, r._getAudioCodec = function (t) {
34220                    var e = this.config.defaultAudioCodec || t.audioCodec;
34221                    return this.audioCodecSwap && e && (this.log("Swapping audio codec"), e = -1 !== e.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), e
34222                }, r._loadBitrateTestFrag = function (t, e) {
34223                    var r = this;
34224                    t.bitrateTest = !0, this._doFragLoad(t, e).then((function (i) {
34225                        var n = r.hls;
34226                        if (i && !r.fragContextChanged(t)) {
34227                            e.fragmentError = 0, r.state = vi, r.startFragRequested = !1, r.bitrateTest = !1;
34228                            var a = t.stats;
34229                            a.parsing.start = a.parsing.end = a.buffering.start = a.buffering.end = self.performance.now(), n.trigger(S.FRAG_LOADED, i), t.bitrateTest = !1
34230                        }
34231                    }))
34232                }, r._handleTransmuxComplete = function (t) {
34233                    var e, r = "main",
34234                        i = this.hls,
34235                        n = t.remuxResult,
34236                        a = t.chunkMeta,
34237                        s = this.getCurrentContext(a);
34238                    if (s) {
34239                        var o = s.frag,
34240                            l = s.part,
34241                            u = s.level,
34242                            h = n.video,
34243                            d = n.text,
34244                            c = n.id3,
34245                            f = n.initSegment,
34246                            g = u.details,
34247                            v = this.altAudio ? void 0 : n.audio;
34248                        if (this.fragContextChanged(o)) this.fragmentTracker.removeFragment(o);
34249                        else {
34250                            if (this.state = Ti, f) {
34251                                if (null != f && f.tracks) {
34252                                    var m = o.initSegment || o;
34253                                    this._bufferInitSegment(u, f.tracks, m, a), i.trigger(S.FRAG_PARSING_INIT_SEGMENT, {
34254                                        frag: m,
34255                                        id: r,
34256                                        tracks: f.tracks
34257                                    })
34258                                }
34259                                var p = f.initPTS,
34260                                    E = f.timescale;
34261                                y(p) && (this.initPTS[o.cc] = {
34262                                    baseTime: p,
34263                                    timescale: E
34264                                }, i.trigger(S.INIT_PTS_FOUND, {
34265                                    frag: o,
34266                                    id: r,
34267                                    initPTS: p,
34268                                    timescale: E
34269                                }))
34270                            }
34271                            if (h && g && "initSegment" !== o.sn) {
34272                                var T = g.fragments[o.sn - 1 - g.startSN],
34273                                    L = o.sn === g.startSN,
34274                                    A = !T || o.cc > T.cc;
34275                                if (!1 !== n.independent) {
34276                                    var R = h.startPTS,
34277                                        k = h.endPTS,
34278                                        b = h.startDTS,
34279                                        D = h.endDTS;
34280                                    if (l) l.elementaryStreams[h.type] = {
34281                                        startPTS: R,
34282                                        endPTS: k,
34283                                        startDTS: b,
34284                                        endDTS: D
34285                                    };
34286                                    else if (h.firstKeyFrame && h.independent && 1 === a.id && !A && (this.couldBacktrack = !0), h.dropped && h.independent) {
34287                                        var I = this.getMainFwdBufferInfo(),
34288                                            w = (I ? I.end : this.getLoadPosition()) + this.config.maxBufferHole,
34289                                            C = h.firstKeyFramePTS ? h.firstKeyFramePTS : R;
34290                                        if (!L && w < C - this.config.maxBufferHole && !A) return void this.backtrack(o);
34291                                        A && (o.gap = !0), o.setElementaryStreamInfo(h.type, o.start, k, o.start, D, !0)
34292                                    } else L && R > 2 && (o.gap = !0);
34293                                    o.setElementaryStreamInfo(h.type, R, k, b, D), this.backtrackFragment && (this.backtrackFragment = o), this.bufferFragmentData(h, o, l, a, L || A)
34294                                } else {
34295                                    if (!L && !A) return void this.backtrack(o);
34296                                    o.gap = !0
34297                                }
34298                            }
34299                            if (v) {
34300                                var _ = v.startPTS,
34301                                    x = v.endPTS,
34302                                    P = v.startDTS,
34303                                    F = v.endDTS;
34304                                l && (l.elementaryStreams[O] = {
34305                                    startPTS: _,
34306                                    endPTS: x,
34307                                    startDTS: P,
34308                                    endDTS: F
34309                                }), o.setElementaryStreamInfo(O, _, x, P, F), this.bufferFragmentData(v, o, l, a)
34310                            }
34311                            if (g && null != c && null != (e = c.samples) && e.length) {
34312                                var M = {
34313                                    id: r,
34314                                    frag: o,
34315                                    details: g,
34316                                    samples: c.samples
34317                                };
34318                                i.trigger(S.FRAG_PARSING_METADATA, M)
34319                            }
34320                            if (g && d) {
34321                                var N = {
34322                                    id: r,
34323                                    frag: o,
34324                                    details: g,
34325                                    samples: d.samples
34326                                };
34327                                i.trigger(S.FRAG_PARSING_USERDATA, N)
34328                            }
34329                        }
34330                    } else this.resetWhenMissingContext(a)
34331                }, r._bufferInitSegment = function (t, e, r, i) {
34332                    var n = this;
34333                    if (this.state === Ti) {
34334                        this.audioOnly = !!e.audio && !e.video, this.altAudio && !this.audioOnly && delete e.audio;
34335                        var a = e.audio,
34336                            s = e.video,
34337                            o = e.audiovideo;
34338                        if (a) {
34339                            var l = t.audioCodec,
34340                                u = navigator.userAgent.toLowerCase();
34341                            this.audioCodecSwitch && (l && (l = -1 !== l.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), 1 !== a.metadata.channelCount && -1 === u.indexOf("firefox") && (l = "mp4a.40.5")), l && -1 !== l.indexOf("mp4a.40.5") && -1 !== u.indexOf("android") && "audio/mpeg" !== a.container && (l = "mp4a.40.2", this.log("Android: force audio codec to " + l)), t.audioCodec && t.audioCodec !== l && this.log('Swapping manifest audio codec "' + t.audioCodec + '" for "' + l + '"'), a.levelCodec = l, a.id = "main", this.log("Init audio buffer, container:" + a.container + ", codecs[selected/level/parsed]=[" + (l || "") + "/" + (t.audioCodec || "") + "/" + a.codec + "]")
34342                        }
34343                        s && (s.levelCodec = t.videoCodec, s.id = "main", this.log("Init video buffer, container:" + s.container + ", codecs[level/parsed]=[" + (t.videoCodec || "") + "/" + s.codec + "]")), o && this.log("Init audiovideo buffer, container:" + o.container + ", codecs[level/parsed]=[" + t.codecs + "/" + o.codec + "]"), this.hls.trigger(S.BUFFER_CODECS, e), Object.keys(e).forEach((function (t) {
34344                            var a = e[t].initSegment;
34345                            null != a && a.byteLength && n.hls.trigger(S.BUFFER_APPENDING, {
34346                                type: t,
34347                                data: a,
34348                                frag: r,
34349                                part: null,
34350                                chunkMeta: i,
34351                                parent: r.type
34352                            })
34353                        })), this.tickImmediate()
34354                    }
34355                }, r.getMainFwdBufferInfo = function () {
34356                    return this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, we)
34357                }, r.backtrack = function (t) {
34358                    this.couldBacktrack = !0, this.backtrackFragment = t, this.resetTransmuxer(), this.flushBufferGap(t), this.fragmentTracker.removeFragment(t), this.fragPrevious = null, this.nextLoadPosition = t.start, this.state = vi
34359                }, r.checkFragmentChanged = function () {
34360                    var t = this.media,
34361                        e = null;
34362                    if (t && t.readyState > 1 && !1 === t.seeking) {
34363                        var r = t.currentTime;
34364                        if (Jr.isBuffered(t, r) ? e = this.getAppendedFrag(r) : Jr.isBuffered(t, r + .1) && (e = this.getAppendedFrag(r + .1)), e) {
34365                            this.backtrackFragment = null;
34366                            var i = this.fragPlaying,
34367                                n = e.level;
34368                            i && e.sn === i.sn && i.level === n || (this.fragPlaying = e, this.hls.trigger(S.FRAG_CHANGED, {
34369                                frag: e
34370                            }), i && i.level === n || this.hls.trigger(S.LEVEL_SWITCHED, {
34371                                level: n
34372                            }))
34373                        }
34374                    }
34375                }, s(e, [{
34376                    key: "nextLevel",
34377                    get: function () {
34378                        var t = this.nextBufferedFrag;
34379                        return t ? t.level : -1
34380                    }
34381                }, {
34382                    key: "currentFrag",
34383                    get: function () {
34384                        var t = this.media;
34385                        return t ? this.fragPlaying || this.getAppendedFrag(t.currentTime) : null
34386                    }
34387                }, {
34388                    key: "currentProgramDateTime",
34389                    get: function () {
34390                        var t = this.media;
34391                        if (t) {
34392                            var e = t.currentTime,
34393                                r = this.currentFrag;
34394                            if (r && y(e) && y(r.programDateTime)) {
34395                                var i = r.programDateTime + 1e3 * (e - r.start);
34396                                return new Date(i)
34397                            }
34398                        }
34399                        return null
34400                    }
34401                }, {
34402                    key: "currentLevel",
34403                    get: function () {
34404                        var t = this.currentFrag;
34405                        return t ? t.level : -1
34406                    }
34407                }, {
34408                    key: "nextBufferedFrag",
34409                    get: function () {
34410                        var t = this.currentFrag;
34411                        return t ? this.followingBufferedFrag(t) : null
34412                    }
34413                }, {
34414                    key: "forceStartLoad",
34415                    get: function () {
34416                        return this._forceStartLoad
34417                    }
34418                }]), e
34419            }(bi),
34420            so = function () {
34421                function t(e) {
34422                    void 0 === e && (e = {}), this.config = void 0, this.userConfig = void 0, this.coreComponents = void 0, this.networkControllers = void 0, this.started = !1, this._emitter = new Nn, this._autoLevelCapping = -1, this._maxHdcpLevel = null, this.abrController = void 0, this.bufferController = void 0, this.capLevelController = void 0, this.latencyController = void 0, this.levelController = void 0, this.streamController = void 0, this.audioTrackController = void 0, this.subtitleTrackController = void 0, this.emeController = void 0, this.cmcdController = void 0, this._media = null, this.url = null, this.triggeringException = void 0, I(e.debug || !1, "Hls instance");
34423                    var r = this.config = function (t, e) {
34424                        if ((e.liveSyncDurationCount || e.liveMaxLatencyDurationCount) && (e.liveSyncDuration || e.liveMaxLatencyDuration)) throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");
34425                        if (void 0 !== e.liveMaxLatencyDurationCount && (void 0 === e.liveSyncDurationCount || e.liveMaxLatencyDurationCount <= e.liveSyncDurationCount)) throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');
34426                        if (void 0 !== e.liveMaxLatencyDuration && (void 0 === e.liveSyncDuration || e.liveMaxLatencyDuration <= e.liveSyncDuration)) throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');
34427                        var r = Js(t),
34428                            n = ["TimeOut", "MaxRetry", "RetryDelay", "MaxRetryTimeout"];
34429                        return ["manifest", "level", "frag"].forEach((function (t) {
34430                            var i = ("level" === t ? "playlist" : t) + "LoadPolicy",
34431                                a = void 0 === e[i],
34432                                s = [];
34433                            n.forEach((function (n) {
34434                                var o = t + "Loading" + n,
34435                                    l = e[o];
34436                                if (void 0 !== l && a) {
34437                                    s.push(o);
34438                                    var u = r[i].default;
34439                                    switch (e[i] = {
34440                                        default: u
34441                                    }, n) {
34442                                    case "TimeOut":
34443                                        u.maxLoadTimeMs = l, u.maxTimeToFirstByteMs = l;
34444                                        break;
34445                                    case "MaxRetry":
34446                                        u.errorRetry.maxNumRetry = l, u.timeoutRetry.maxNumRetry = l;
34447                                        break;
34448                                    case "RetryDelay":
34449                                        u.errorRetry.retryDelayMs = l, u.timeoutRetry.retryDelayMs = l;
34450                                        break;
34451                                    case "MaxRetryTimeout":
34452                                        u.errorRetry.maxRetryDelayMs = l, u.timeoutRetry.maxRetryDelayMs = l
34453                                    }
34454                                }
34455                            })), s.length && w.warn('hls.js config: "' + s.join('", "') + '" setting(s) are deprecated, use "' + i + '": ' + JSON.stringify(e[i]))
34456                        })), i(i({}, r), e)
34457                    }(t.DefaultConfig, e);
34458                    this.userConfig = e, r.progressive && $s(r);
34459                    var n = r.abrController,
34460                        a = r.bufferController,
34461                        s = r.capLevelController,
34462                        o = r.errorController,
34463                        l = r.fpsController,
34464                        u = new o(this),
34465                        h = this.abrController = new n(this),
34466                        d = this.bufferController = new a(this),
34467                        c = this.capLevelController = new s(this),
34468                        f = new l(this),
34469                        g = new Fe(this),
34470                        v = new qe(this),
34471                        m = r.contentSteeringController,
34472                        p = m ? new m(this) : null,
34473                        y = this.levelController = new Zs(this, p),
34474                        E = new qr(this),
34475                        T = new eo(this.config),
34476                        L = this.streamController = new ao(this, E, T);
34477                    c.setStreamController(L), f.setStreamController(L);
34478                    var A = [g, y, L];
34479                    p && A.splice(1, 0, p), this.networkControllers = A;
34480                    var R = [h, d, c, f, v, E];
34481                    this.audioTrackController = this.createController(r.audioTrackController, A);
34482                    var k = r.audioStreamController;
34483                    k && A.push(new k(this, E, T)), this.subtitleTrackController = this.createController(r.subtitleTrackController, A);
34484                    var b = r.subtitleStreamController;
34485                    b && A.push(new b(this, E, T)), this.createController(r.timelineController, R), T.emeController = this.emeController = this.createController(r.emeController, R), this.cmcdController = this.createController(r.cmcdController, R), this.latencyController = this.createController(Xe, R), this.coreComponents = R, A.push(u);
34486                    var D = u.onErrorOut;
34487                    "function" == typeof D && this.on(S.ERROR, D, u)
34488                }
34489                t.isMSESupported = function () {
34490                    return io()
34491                }, t.isSupported = function () {
34492                    return function () {
34493                        if (!io()) return !1;
34494                        var t = ee();
34495                        return "function" == typeof (null == t ? void 0 : t.isTypeSupported) && (["avc1.42E01E,mp4a.40.2", "av01.0.01M.08", "vp09.00.50.08"].some((function (e) {
34496                            return t.isTypeSupported(ae(e, "video"))
34497                        })) || ["mp4a.40.2", "fLaC"].some((function (e) {
34498                            return t.isTypeSupported(ae(e, "audio"))
34499                        })))
34500                    }()
34501                }, t.getMediaSource = function () {
34502                    return ee()
34503                };
34504                var e = t.prototype;
34505                return e.createController = function (t, e) {
34506                    if (t) {
34507                        var r = new t(this);
34508                        return e && e.push(r), r
34509                    }
34510                    return null
34511                }, e.on = function (t, e, r) {
34512                    void 0 === r && (r = this), this._emitter.on(t, e, r)
34513                }, e.once = function (t, e, r) {
34514                    void 0 === r && (r = this), this._emitter.once(t, e, r)
34515                }, e.removeAllListeners = function (t) {
34516                    this._emitter.removeAllListeners(t)
34517                }, e.off = function (t, e, r, i) {
34518                    void 0 === r && (r = this), this._emitter.off(t, e, r, i)
34519                }, e.listeners = function (t) {
34520                    return this._emitter.listeners(t)
34521                }, e.emit = function (t, e, r) {
34522                    return this._emitter.emit(t, e, r)
34523                }, e.trigger = function (t, e) {
34524                    if (this.config.debug) return this.emit(t, t, e);
34525                    try {
34526                        return this.emit(t, t, e)
34527                    } catch (e) {
34528                        if (w.error("An internal error happened while handling event " + t + '. Error message: "' + e.message + '". Here is a stacktrace:', e), !this.triggeringException) {
34529                            this.triggeringException = !0;
34530                            var r = t === S.ERROR;
34531                            this.trigger(S.ERROR, {
34532                                type: L.OTHER_ERROR,
34533                                details: A.INTERNAL_EXCEPTION,
34534                                fatal: r,
34535                                event: t,
34536                                error: e
34537                            }), this.triggeringException = !1
34538                        }
34539                    }
34540                    return !1
34541                }, e.listenerCount = function (t) {
34542                    return this._emitter.listenerCount(t)
34543                }, e.destroy = function () {
34544                    w.log("destroy"), this.trigger(S.DESTROYING, void 0), this.detachMedia(), this.removeAllListeners(), this._autoLevelCapping = -1, this.url = null, this.networkControllers.forEach((function (t) {
34545                        return t.destroy()
34546                    })), this.networkControllers.length = 0, this.coreComponents.forEach((function (t) {
34547                        return t.destroy()
34548                    })), this.coreComponents.length = 0;
34549                    var t = this.config;
34550                    t.xhrSetup = t.fetchSetup = void 0, this.userConfig = null
34551                }, e.attachMedia = function (t) {
34552                    w.log("attachMedia"), this._media = t, this.trigger(S.MEDIA_ATTACHING, {
34553                        media: t
34554                    })
34555                }, e.detachMedia = function () {
34556                    w.log("detachMedia"), this.trigger(S.MEDIA_DETACHING, void 0), this._media = null
34557                }, e.loadSource = function (t) {
34558                    this.stopLoad();
34559                    var e = this.media,
34560                        r = this.url,
34561                        i = this.url = p.buildAbsoluteURL(self.location.href, t, {
34562                            alwaysNormalize: !0
34563                        });
34564                    this._autoLevelCapping = -1, this._maxHdcpLevel = null, w.log("loadSource:" + i), e && r && (r !== i || this.bufferController.hasSourceTypes()) && (this.detachMedia(), this.attachMedia(e)), this.trigger(S.MANIFEST_LOADING, {
34565                        url: t
34566                    })
34567                }, e.startLoad = function (t) {
34568                    void 0 === t && (t = -1), w.log("startLoad(" + t + ")"), this.started = !0, this.networkControllers.forEach((function (e) {
34569                        e.startLoad(t)
34570                    }))
34571                }, e.stopLoad = function () {
34572                    w.log("stopLoad"), this.started = !1, this.networkControllers.forEach((function (t) {
34573                        t.stopLoad()
34574                    }))
34575                }, e.resumeBuffering = function () {
34576                    this.started && this.networkControllers.forEach((function (t) {
34577                        "fragmentLoader" in t && t.startLoad(-1)
34578                    }))
34579                }, e.pauseBuffering = function () {
34580                    this.networkControllers.forEach((function (t) {
34581                        "fragmentLoader" in t && t.stopLoad()
34582                    }))
34583                }, e.swapAudioCodec = function () {
34584                    w.log("swapAudioCodec"), this.streamController.swapAudioCodec()
34585                }, e.recoverMediaError = function () {
34586                    w.log("recoverMediaError");
34587                    var t = this._media;
34588                    this.detachMedia(), t && this.attachMedia(t)
34589                }, e.removeLevel = function (t) {
34590                    this.levelController.removeLevel(t)
34591                }, e.setAudioOption = function (t) {
34592                    var e;
34593                    return null == (e = this.audioTrackController) ? void 0 : e.setAudioOption(t)
34594                }, e.setSubtitleOption = function (t) {
34595                    var e;
34596                    return null == (e = this.subtitleTrackController) || e.setSubtitleOption(t), null
34597                }, s(t, [{
34598                    key: "levels",
34599                    get: function () {
34600                        var t = this.levelController.levels;
34601                        return t || []
34602                    }
34603                }, {
34604                    key: "currentLevel",
34605                    get: function () {
34606                        return this.streamController.currentLevel
34607                    },
34608                    set: function (t) {
34609                        w.log("set currentLevel:" + t), this.levelController.manualLevel = t, this.streamController.immediateLevelSwitch()
34610                    }
34611                }, {
34612                    key: "nextLevel",
34613                    get: function () {
34614                        return this.streamController.nextLevel
34615                    },
34616                    set: function (t) {
34617                        w.log("set nextLevel:" + t), this.levelController.manualLevel = t, this.streamController.nextLevelSwitch()
34618                    }
34619                }, {
34620                    key: "loadLevel",
34621                    get: function () {
34622                        return this.levelController.level
34623                    },
34624                    set: function (t) {
34625                        w.log("set loadLevel:" + t), this.levelController.manualLevel = t
34626                    }
34627                }, {
34628                    key: "nextLoadLevel",
34629                    get: function () {
34630                        return this.levelController.nextLoadLevel
34631                    },
34632                    set: function (t) {
34633                        this.levelController.nextLoadLevel = t
34634                    }
34635                }, {
34636                    key: "firstLevel",
34637                    get: function () {
34638                        return Math.max(this.levelController.firstLevel, this.minAutoLevel)
34639                    },
34640                    set: function (t) {
34641                        w.log("set firstLevel:" + t), this.levelController.firstLevel = t
34642                    }
34643                }, {
34644                    key: "startLevel",
34645                    get: function () {
34646                        var t = this.levelController.startLevel;
34647                        return -1 === t && this.abrController.forcedAutoLevel > -1 ? this.abrController.forcedAutoLevel : t
34648                    },
34649                    set: function (t) {
34650                        w.log("set startLevel:" + t), -1 !== t && (t = Math.max(t, this.minAutoLevel)), this.levelController.startLevel = t
34651                    }
34652                }, {
34653                    key: "capLevelToPlayerSize",
34654                    get: function () {
34655                        return this.config.capLevelToPlayerSize
34656                    },
34657                    set: function (t) {
34658                        var e = !!t;
34659                        e !== this.config.capLevelToPlayerSize && (e ? this.capLevelController.startCapping() : (this.capLevelController.stopCapping(), this.autoLevelCapping = -1, this.streamController.nextLevelSwitch()), this.config.capLevelToPlayerSize = e)
34660                    }
34661                }, {
34662                    key: "autoLevelCapping",
34663                    get: function () {
34664                        return this._autoLevelCapping
34665                    },
34666                    set: function (t) {
34667                        this._autoLevelCapping !== t && (w.log("set autoLevelCapping:" + t), this._autoLevelCapping = t, this.levelController.checkMaxAutoUpdated())
34668                    }
34669                }, {
34670                    key: "bandwidthEstimate",
34671                    get: function () {
34672                        var t = this.abrController.bwEstimator;
34673                        return t ? t.getEstimate() : NaN
34674                    },
34675                    set: function (t) {
34676                        this.abrController.resetEstimator(t)
34677                    }
34678                }, {
34679                    key: "ttfbEstimate",
34680                    get: function () {
34681                        var t = this.abrController.bwEstimator;
34682                        return t ? t.getEstimateTTFB() : NaN
34683                    }
34684                }, {
34685                    key: "maxHdcpLevel",
34686                    get: function () {
34687                        return this._maxHdcpLevel
34688                    },
34689                    set: function (t) {
34690                        (function (t) {
34691                            return ze.indexOf(t) > -1
34692                        })(t) && this._maxHdcpLevel !== t && (this._maxHdcpLevel = t, this.levelController.checkMaxAutoUpdated())
34693                    }
34694                }, {
34695                    key: "autoLevelEnabled",
34696                    get: function () {
34697                        return -1 === this.levelController.manualLevel
34698                    }
34699                }, {
34700                    key: "manualLevel",
34701                    get: function () {
34702                        return this.levelController.manualLevel
34703                    }
34704                }, {
34705                    key: "minAutoLevel",
34706                    get: function () {
34707                        var t = this.levels,
34708                            e = this.config.minAutoBitrate;
34709                        if (!t) return 0;
34710                        for (var r = t.length, i = 0; i < r; i++)
34711                            if (t[i].maxBitrate >= e) return i;
34712                        return 0
34713                    }
34714                }, {
34715                    key: "maxAutoLevel",
34716                    get: function () {
34717                        var t, e = this.levels,
34718                            r = this.autoLevelCapping,
34719                            i = this.maxHdcpLevel;
34720                        if (t = -1 === r && null != e && e.length ? e.length - 1 : r, i)
34721                            for (var n = t; n--;) {
34722                                var a = e[n].attrs["HDCP-LEVEL"];
34723                                if (a && a <= i) return n
34724                            }
34725                        return t
34726                    }
34727                }, {
34728                    key: "firstAutoLevel",
34729                    get: function () {
34730                        return this.abrController.firstAutoLevel
34731                    }
34732                }, {
34733                    key: "nextAutoLevel",
34734                    get: function () {
34735                        return this.abrController.nextAutoLevel
34736                    },
34737                    set: function (t) {
34738                        this.abrController.nextAutoLevel = t
34739                    }
34740                }, {
34741                    key: "playingDate",
34742                    get: function () {
34743                        return this.streamController.currentProgramDateTime
34744                    }
34745                }, {
34746                    key: "mainForwardBufferInfo",
34747                    get: function () {
34748                        return this.streamController.getMainFwdBufferInfo()
34749                    }
34750                }, {
34751                    key: "allAudioTracks",
34752                    get: function () {
34753                        var t = this.audioTrackController;
34754                        return t ? t.allAudioTracks : []
34755                    }
34756                }, {
34757                    key: "audioTracks",
34758                    get: function () {
34759                        var t = this.audioTrackController;
34760                        return t ? t.audioTracks : []
34761                    }
34762                }, {
34763                    key: "audioTrack",
34764                    get: function () {
34765                        var t = this.audioTrackController;
34766                        return t ? t.audioTrack : -1
34767                    },
34768                    set: function (t) {
34769                        var e = this.audioTrackController;
34770                        e && (e.audioTrack = t)
34771                    }
34772                }, {
34773                    key: "allSubtitleTracks",
34774                    get: function () {
34775                        var t = this.subtitleTrackController;
34776                        return t ? t.allSubtitleTracks : []
34777                    }
34778                }, {
34779                    key: "subtitleTracks",
34780                    get: function () {
34781                        var t = this.subtitleTrackController;
34782                        return t ? t.subtitleTracks : []
34783                    }
34784                }, {
34785                    key: "subtitleTrack",
34786                    get: function () {
34787                        var t = this.subtitleTrackController;
34788                        return t ? t.subtitleTrack : -1
34789                    },
34790                    set: function (t) {
34791                        var e = this.subtitleTrackController;
34792                        e && (e.subtitleTrack = t)
34793                    }
34794                }, {
34795                    key: "media",
34796                    get: function () {
34797                        return this._media
34798                    }
34799                }, {
34800                    key: "subtitleDisplay",
34801                    get: function () {
34802                        var t = this.subtitleTrackController;
34803                        return !!t && t.subtitleDisplay
34804                    },
34805                    set: function (t) {
34806                        var e = this.subtitleTrackController;
34807                        e && (e.subtitleDisplay = t)
34808                    }
34809                }, {
34810                    key: "lowLatencyMode",
34811                    get: function () {
34812                        return this.config.lowLatencyMode
34813                    },
34814                    set: function (t) {
34815                        this.config.lowLatencyMode = t
34816                    }
34817                }, {
34818                    key: "liveSyncPosition",
34819                    get: function () {
34820                        return this.latencyController.liveSyncPosition
34821                    }
34822                }, {
34823                    key: "latency",
34824                    get: function () {
34825                        return this.latencyController.latency
34826                    }
34827                }, {
34828                    key: "maxLatency",
34829                    get: function () {
34830                        return this.latencyController.maxLatency
34831                    }
34832                }, {
34833                    key: "targetLatency",
34834                    get: function () {
34835                        return this.latencyController.targetLatency
34836                    }
34837                }, {
34838                    key: "drift",
34839                    get: function () {
34840                        return this.latencyController.drift
34841                    }
34842                }, {
34843                    key: "forceStartLoad",
34844                    get: function () {
34845                        return this.streamController.forceStartLoad
34846                    }
34847                }], [{
34848                    key: "version",
34849                    get: function () {
34850                        return "1.5.9"
34851                    }
34852                }, {
34853                    key: "Events",
34854                    get: function () {
34855                        return S
34856                    }
34857                }, {
34858                    key: "ErrorTypes",
34859                    get: function () {
34860                        return L
34861                    }
34862                }, {
34863                    key: "ErrorDetails",
34864                    get: function () {
34865                        return A
34866                    }
34867                }, {
34868                    key: "DefaultConfig",
34869                    get: function () {
34870                        return t.defaultConfig ? t.defaultConfig : Qs
34871                    },
34872                    set: function (e) {
34873                        t.defaultConfig = e
34874                    }
34875                }]), t
34876            }();
34877        return so.defaultConfig = void 0, so
34878    }, "object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (r = "undefined" != typeof globalThis ? globalThis : r || self).Hls = i()
34879}(!1);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.