????
Current Path : /proc/self/cwd/wp-content/plugins/presto-player/dist/components/esm/ |
Current File : //proc/self/cwd/wp-content/plugins/presto-player/dist/components/esm/cache-cues-d738e7c8.js |
function timePassed({current:e,duration:t,showAfter:n=null}){if(0===n)return!0;if(null===n||!t)return!1;if(e===n)return!0;let i=e/t*100;return 99.9<i&&(i=100),i>=n}function lightOrDark(e){if(!e)return;let t,n,i,r;if(e.match(/^rgb/)){const r=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);t=r[1],n=r[2],i=r[3]}else{const r=+("0x"+e.slice(1).replace(e.length<5&&/./g,"$&$&"));t=r>>16,n=r>>8&255,i=255&r}return r=Math.sqrt(t*t*.299+n*n*.587+i*i*.114),r>127.5?"light":"dark"}function timeToSeconds(e){let t,n=e.split(":");return n.length>1&&(t=60*parseInt(n[0])),parseInt(n[1])+parseInt(t)}function getMobileOperatingSystem(){var e=navigator.userAgent||navigator.vendor;return/windows phone/i.test(e)?"Windows Phone":/android/i.test(e)?"Android":"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)?"iOS":"unknown"}function isIOS(){return"iOS"===getMobileOperatingSystem()}function isMobile(){return"unknown"!==getMobileOperatingSystem()}function isWebView(){var e=window.navigator.standalone,t=window.navigator.userAgent.toLowerCase(),n=/safari/.test(t);return/iphone|ipod|ipad/.test(t)?!(!e&&n)&&(!e&&!n||void 0):!!t.includes("wv")}function isAndroidWebView(){return!("Android"!==getMobileOperatingSystem()||!isWebView())}function parseColor(e){var t=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);return t?[t[1],t[2],t[3],"1"]:(t=e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*((0.)?\d+)\s*\)$/i))?[t[1],t[2],t[3],t[4]]:void 0}function exitFullScreen(e){var t,n,i,r,s;if(isMobile()&&!(null===(n=null===(t=null==e?void 0:e.config)||void 0===t?void 0:t.blockAttributes)||void 0===n?void 0:n.playsInline)&&("function"==typeof(null===(i=null==e?void 0:e.media)||void 0===i?void 0:i.webkitExitFullScreen)&&(null==e||e.media.webkitExitFullScreen()),"function"==typeof(null===(r=null==e?void 0:e.embed)||void 0===r?void 0:r.exitFullscreen)&&(null===(s=null==e?void 0:e.embed)||void 0===s||s.exitFullscreen()),"youtube"===e.provider)){const t=e.currentTime;e.currentTime=e.duration,e.once("playing",(()=>{e.currentTime=t}))}}const getConstructor=e=>null!=e?e.constructor:null,instanceOf=(e,t)=>Boolean(e&&t&&e instanceof t),isNullOrUndefined=e=>null==e,isObject$1=e=>getConstructor(e)===Object,isString$1=e=>getConstructor(e)===String,isArray$1=e=>Array.isArray(e),isNodeList=e=>instanceOf(e,NodeList),isElement=e=>null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument,isEmpty=e=>isNullOrUndefined(e)||(isString$1(e)||isArray$1(e)||isNodeList(e))&&!e.length||isObject$1(e)&&!Object.keys(e).length,is={nullOrUndefined:isNullOrUndefined,object:isObject$1,string:isString$1,nodeList:isNodeList,element:isElement,empty:isEmpty,array:isArray$1};function isArray(e){return Array.isArray?Array.isArray(e):"[object Array]"===getTag(e)}const INFINITY=1/0;function baseToString(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toString(e){return null==e?"":baseToString(e)}function isString(e){return"string"==typeof e}function isNumber(e){return"number"==typeof e}function isBoolean(e){return!0===e||!1===e||isObjectLike(e)&&"[object Boolean]"==getTag(e)}function isObject(e){return"object"==typeof e}function isObjectLike(e){return isObject(e)&&null!==e}function isDefined(e){return null!=e}function isBlank(e){return!e.trim().length}function getTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const EXTENDED_SEARCH_UNAVAILABLE="Extended search is not available",INCORRECT_INDEX_TYPE="Incorrect 'index' type",LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY=e=>`Invalid value for key ${e}`,PATTERN_LENGTH_TOO_LARGE=e=>`Pattern length exceeds max of ${e}.`,MISSING_KEY_PROPERTY=e=>`Missing ${e} property in key`,INVALID_KEY_WEIGHT_VALUE=e=>`Property 'weight' in key '${e}' must be a positive integer`,hasOwn=Object.prototype.hasOwnProperty;class KeyStore{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let n=createKey(e);t+=n.weight,this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function createKey(e){let t=null,n=null,i=null,r=1,s=null;if(isString(e)||isArray(e))i=e,t=createKeyPath(e),n=createKeyId(e);else{if(!hasOwn.call(e,"name"))throw new Error(MISSING_KEY_PROPERTY("name"));const o=e.name;if(i=o,hasOwn.call(e,"weight")&&(r=e.weight,r<=0))throw new Error(INVALID_KEY_WEIGHT_VALUE(o));t=createKeyPath(o),n=createKeyId(o),s=e.getFn}return{path:t,id:n,weight:r,src:i,getFn:s}}function createKeyPath(e){return isArray(e)?e:e.split(".")}function createKeyId(e){return isArray(e)?e.join("."):e}function get(e,t){let n=[],i=!1;const r=(e,t,s)=>{if(isDefined(e))if(t[s]){const o=e[t[s]];if(!isDefined(o))return;if(s===t.length-1&&(isString(o)||isNumber(o)||isBoolean(o)))n.push(toString(o));else if(isArray(o)){i=!0;for(let e=0,n=o.length;e<n;e+=1)r(o[e],t,s+1)}else t.length&&r(o,t,s+1)}else n.push(e)};return r(e,isString(t)?t.split("."):t,0),i?n:n[0]}const MatchOptions={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},BasicOptions={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},FuzzyOptions={location:0,threshold:.6,distance:100},AdvancedOptions={useExtendedSearch:!1,getFn:get,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Config={...BasicOptions,...MatchOptions,...FuzzyOptions,...AdvancedOptions};const SPACE=/[^ ]+/g;function norm(e=1,t=3){const n=new Map,i=Math.pow(10,t);return{get(t){const r=t.match(SPACE).length;if(n.has(r))return n.get(r);const s=1/Math.pow(r,.5*e),o=parseFloat(Math.round(s*i)/i);return n.set(r,o),o},clear(){n.clear()}}}class FuseIndex{constructor({getFn:e=Config.getFn,fieldNormWeight:t=Config.fieldNormWeight}={}){this.norm=norm(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,isString(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();isString(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!isDefined(e)||isBlank(e))return;let n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}_addObject(e,t){let n={i:t,$:{}};this.keys.forEach(((t,i)=>{let r=t.getFn?t.getFn(e):this.getFn(e,t.path);if(isDefined(r))if(isArray(r)){let e=[];const t=[{nestedArrIndex:-1,value:r}];for(;t.length;){const{nestedArrIndex:n,value:i}=t.pop();if(isDefined(i))if(isString(i)&&!isBlank(i)){let t={v:i,i:n,n:this.norm.get(i)};e.push(t)}else isArray(i)&&i.forEach(((e,n)=>{t.push({nestedArrIndex:n,value:e})}))}n.$[i]=e}else if(isString(r)&&!isBlank(r)){let e={v:r,n:this.norm.get(r)};n.$[i]=e}})),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function createIndex(e,t,{getFn:n=Config.getFn,fieldNormWeight:i=Config.fieldNormWeight}={}){const r=new FuseIndex({getFn:n,fieldNormWeight:i});return r.setKeys(e.map(createKey)),r.setSources(t),r.create(),r}function parseIndex(e,{getFn:t=Config.getFn,fieldNormWeight:n=Config.fieldNormWeight}={}){const{keys:i,records:r}=e,s=new FuseIndex({getFn:t,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s}function computeScore$1(e,{errors:t=0,currentLocation:n=0,expectedLocation:i=0,distance:r=Config.distance,ignoreLocation:s=Config.ignoreLocation}={}){const o=t/e.length;if(s)return o;const c=Math.abs(i-n);return r?o+c/r:c?1:o}function convertMaskToIndices(e=[],t=Config.minMatchCharLength){let n=[],i=-1,r=-1,s=0;for(let o=e.length;s<o;s+=1){let o=e[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=t&&n.push([i,r]),i=-1)}return e[s-1]&&s-i>=t&&n.push([i,s-1]),n}const MAX_BITS=32;function search(e,t,n,{location:i=Config.location,distance:r=Config.distance,threshold:s=Config.threshold,findAllMatches:o=Config.findAllMatches,minMatchCharLength:c=Config.minMatchCharLength,includeMatches:a=Config.includeMatches,ignoreLocation:h=Config.ignoreLocation}={}){if(t.length>32)throw new Error("Pattern length exceeds max of 32.");const l=t.length,u=e.length,d=Math.max(0,Math.min(i,u));let g=s,f=d;const p=c>1||a,m=p?Array(u):[];let y;for(;(y=e.indexOf(t,f))>-1;){let e=computeScore$1(t,{currentLocation:y,expectedLocation:d,distance:r,ignoreLocation:h});if(g=Math.min(e,g),f=y+l,p){let e=0;for(;e<l;)m[y+e]=1,e+=1}}f=-1;let M=[],v=1,x=l+u;const S=1<<l-1;for(let i=0;i<l;i+=1){let s=0,c=x;for(;s<c;)computeScore$1(t,{errors:i,currentLocation:d+c,expectedLocation:d,distance:r,ignoreLocation:h})<=g?s=c:x=c,c=Math.floor((x-s)/2+s);x=c;let a=Math.max(1,d-c+1),y=o?u:Math.min(d+c,u)+l,C=Array(y+2);C[y+1]=(1<<i)-1;for(let s=y;s>=a;s-=1){let o=s-1,c=n[e.charAt(o)];if(p&&(m[o]=+!!c),C[s]=(C[s+1]<<1|1)&c,i&&(C[s]|=(M[s+1]|M[s])<<1|1|M[s+1]),C[s]&S&&(v=computeScore$1(t,{errors:i,currentLocation:o,expectedLocation:d,distance:r,ignoreLocation:h}),v<=g)){if(g=v,f=o,f<=d)break;a=Math.max(1,2*d-f)}}if(computeScore$1(t,{errors:i+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>g)break;M=C}const C={isMatch:f>=0,score:Math.max(.001,v)};if(p){const e=convertMaskToIndices(m,c);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function createPatternAlphabet(e){let t={};for(let n=0,i=e.length;n<i;n+=1){const r=e.charAt(n);t[r]=(t[r]||0)|1<<i-n-1}return t}class BitapSearch{constructor(e,{location:t=Config.location,threshold:n=Config.threshold,distance:i=Config.distance,includeMatches:r=Config.includeMatches,findAllMatches:s=Config.findAllMatches,minMatchCharLength:o=Config.minMatchCharLength,isCaseSensitive:c=Config.isCaseSensitive,ignoreLocation:a=Config.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:c,ignoreLocation:a},this.pattern=c?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(e,t)=>{this.chunks.push({pattern:e,alphabet:createPatternAlphabet(e),startIndex:t})},l=this.pattern.length;if(l>32){let e=0;const t=l%32,n=l-t;for(;e<n;)h(this.pattern.substr(e,32),e),e+=32;if(t){const e=l-32;h(this.pattern.substr(e),e)}}else h(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,includeMatches:n}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}const{location:i,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:c,ignoreLocation:a}=this.options;let h=[],l=0,u=!1;this.chunks.forEach((({pattern:t,alphabet:d,startIndex:g})=>{const{isMatch:f,score:p,indices:m}=search(e,t,d,{location:i+g,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:c,includeMatches:n,ignoreLocation:a});f&&(u=!0),l+=p,f&&m&&(h=[...h,...m])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&n&&(d.indices=h),d}}class BaseMatch{constructor(e){this.pattern=e}static isMultiMatch(e){return getMatch(e,this.multiRegex)}static isSingleMatch(e){return getMatch(e,this.singleRegex)}search(){}}function getMatch(e,t){const n=e.match(t);return n?n[1]:null}class ExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class InverseExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class PrefixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}class InversePrefixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class SuffixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class InverseSuffixExactMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}class FuzzyMatch extends BaseMatch{constructor(e,{location:t=Config.location,threshold:n=Config.threshold,distance:i=Config.distance,includeMatches:r=Config.includeMatches,findAllMatches:s=Config.findAllMatches,minMatchCharLength:o=Config.minMatchCharLength,isCaseSensitive:c=Config.isCaseSensitive,ignoreLocation:a=Config.ignoreLocation}={}){super(e),this._bitapSearch=new BitapSearch(e,{location:t,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class IncludeMatch extends BaseMatch{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const i=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+r,i.push([t,n-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}}const searchers=[ExactMatch,IncludeMatch,PrefixExactMatch,InversePrefixExactMatch,InverseSuffixExactMatch,SuffixExactMatch,InverseExactMatch,FuzzyMatch],searchersLen=searchers.length,SPACE_RE=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,OR_TOKEN="|";function parseQuery(e,t={}){return e.split("|").map((e=>{let n=e.trim().split(SPACE_RE).filter((e=>e&&!!e.trim())),i=[];for(let e=0,r=n.length;e<r;e+=1){const r=n[e];let s=!1,o=-1;for(;!s&&++o<searchersLen;){const e=searchers[o];let n=e.isMultiMatch(r);n&&(i.push(new e(n,t)),s=!0)}if(!s)for(o=-1;++o<searchersLen;){const e=searchers[o];let n=e.isSingleMatch(r);if(n){i.push(new e(n,t));break}}}return i}))}const MultiMatchSet=new Set([FuzzyMatch.type,IncludeMatch.type]);class ExtendedSearch{constructor(e,{isCaseSensitive:t=Config.isCaseSensitive,includeMatches:n=Config.includeMatches,minMatchCharLength:i=Config.minMatchCharLength,ignoreLocation:r=Config.ignoreLocation,findAllMatches:s=Config.findAllMatches,location:o=Config.location,threshold:c=Config.threshold,distance:a=Config.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:o,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=parseQuery(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i}=this.options;e=i?e:e.toLowerCase();let r=0,s=[],o=0;for(let i=0,c=t.length;i<c;i+=1){const c=t[i];s.length=0,r=0;for(let t=0,i=c.length;t<i;t+=1){const i=c[t],{isMatch:a,indices:h,score:l}=i.search(e);if(!a){o=0,r=0,s.length=0;break}if(r+=1,o+=l,n){const e=i.constructor.type;MultiMatchSet.has(e)?s=[...s,...h]:s.push(h)}}if(r){let e={isMatch:!0,score:o/r};return n&&(e.indices=s),e}}return{isMatch:!1,score:1}}}const registeredSearchers=[];function register(...e){registeredSearchers.push(...e)}function createSearcher(e,t){for(let n=0,i=registeredSearchers.length;n<i;n+=1){let i=registeredSearchers[n];if(i.condition(e,t))return new i(e,t)}return new BitapSearch(e,t)}const LogicalOperator={AND:"$and",OR:"$or"},KeyType={PATH:"$path",PATTERN:"$val"},isExpression=e=>!(!e[LogicalOperator.AND]&&!e[LogicalOperator.OR]),isPath=e=>!!e[KeyType.PATH],isLeaf=e=>!isArray(e)&&isObject(e)&&!isExpression(e),convertToExplicit=e=>({[LogicalOperator.AND]:Object.keys(e).map((t=>({[t]:e[t]})))});function parse(e,t,{auto:n=!0}={}){const i=e=>{let r=Object.keys(e);const s=isPath(e);if(!s&&r.length>1&&!isExpression(e))return i(convertToExplicit(e));if(isLeaf(e)){const i=s?e[KeyType.PATH]:r[0],o=s?e[KeyType.PATTERN]:e[i];if(!isString(o))throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(i));const c={keyId:createKeyId(i),pattern:o};return n&&(c.searcher=createSearcher(o,t)),c}let o={children:[],operator:r[0]};return r.forEach((t=>{const n=e[t];isArray(n)&&n.forEach((e=>{o.children.push(i(e))}))})),o};return isExpression(e)||(e=convertToExplicit(e)),i(e)}function computeScore(e,{ignoreFieldNorm:t=Config.ignoreFieldNorm}){e.forEach((e=>{let n=1;e.matches.forEach((({key:e,norm:i,score:r})=>{const s=e?e.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(t?1:i))})),e.score=n}))}function transformMatches(e,t){const n=e.matches;t.matches=[],isDefined(n)&&n.forEach((e=>{if(!isDefined(e.indices)||!e.indices.length)return;const{indices:n,value:i}=e;let r={indices:n,value:i};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}))}function transformScore(e,t){t.score=e.score}function format(e,t,{includeMatches:n=Config.includeMatches,includeScore:i=Config.includeScore}={}){const r=[];return n&&r.push(transformMatches),i&&r.push(transformScore),e.map((e=>{const{idx:n}=e,i={item:t[n],refIndex:n};return r.length&&r.forEach((t=>{t(e,i)})),i}))}class Fuse{constructor(e,t={},n){this.options={...Config,...t},this.options.useExtendedSearch,this._keyStore=new KeyStore(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof FuseIndex))throw new Error(INCORRECT_INDEX_TYPE);this._myIndex=t||createIndex(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){isDefined(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let n=0,i=this._docs.length;n<i;n+=1){const r=this._docs[n];e(r,n)&&(this.removeAt(n),n-=1,i-=1,t.push(r))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:r,sortFn:s,ignoreFieldNorm:o}=this.options;let c=isString(e)?isString(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return computeScore(c,{ignoreFieldNorm:o}),r&&c.sort(s),isNumber(t)&&t>-1&&(c=c.slice(0,t)),format(c,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const t=createSearcher(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach((({v:e,i:n,n:r})=>{if(!isDefined(e))return;const{isMatch:s,score:o,indices:c}=t.searchIn(e);s&&i.push({item:e,idx:n,matches:[{score:o,value:e,norm:r,indices:c}]})})),i}_searchLogical(e){const t=parse(e,this.options),n=(e,t,i)=>{if(!e.children){const{keyId:n,searcher:r}=e,s=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:r});return s&&s.length?[{idx:i,item:t,matches:s}]:[]}const r=[];for(let s=0,o=e.children.length;s<o;s+=1){const o=e.children[s],c=n(o,t,i);if(c.length)r.push(...c);else if(e.operator===LogicalOperator.AND)return[]}return r},i=this._myIndex.records,r={},s=[];return i.forEach((({$:e,i:i})=>{if(isDefined(e)){let o=n(t,e,i);o.length&&(r[i]||(r[i]={idx:i,item:e,matches:[]},s.push(r[i])),o.forEach((({matches:e})=>{r[i].matches.push(...e)})))}})),s}_searchObjectList(e){const t=createSearcher(e,this.options),{keys:n,records:i}=this._myIndex,r=[];return i.forEach((({$:e,i:i})=>{if(!isDefined(e))return;let s=[];n.forEach(((n,i)=>{s.push(...this._findMatches({key:n,value:e[i],searcher:t}))})),s.length&&r.push({idx:i,item:e,matches:s})})),r}_findMatches({key:e,value:t,searcher:n}){if(!isDefined(t))return[];let i=[];if(isArray(t))t.forEach((({v:t,i:r,n:s})=>{if(!isDefined(t))return;const{isMatch:o,score:c,indices:a}=n.searchIn(t);o&&i.push({score:c,key:e,value:t,idx:r,norm:s,indices:a})}));else{const{v:r,n:s}=t,{isMatch:o,score:c,indices:a}=n.searchIn(r);o&&i.push({score:c,key:e,value:r,norm:s,indices:a})}return i}}function isHLS(e){return"string"==typeof e&&e.includes(".m3u8")}function getParents(e){for(var t=[];e.parentNode&&"body"!=e.parentNode.nodeName.toLowerCase();)e=e.parentNode,t.push(e);return t}function setAttributes(e,t){is.element(e)&&!is.empty(t)&&Object.entries(t).filter((([,e])=>!is.nullOrUndefined(e))).forEach((([t,n])=>e.setAttribute(t,n)))}function createElement(e,t,n){const i=document.createElement(e);return is.object(t)&&setAttributes(i,t),is.string(n)&&(i.innerText=n),i}Fuse.version="6.6.2",Fuse.createIndex=createIndex,Fuse.parseIndex=parseIndex,Fuse.config=Config,Fuse.parseQuery=parse,register(ExtendedSearch);const vttToJson=e=>e?["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((t,n)=>(e[n]&&(t[n]=e[n]),t)),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))}):null,fuzzySearch=(e,t,n)=>{if(is.empty(t))return[];if(is.empty(n))return[];if(!is.string(e))return[];const i=Object.assign(Object.assign(Object.assign({},null==n?void 0:n.minMatchCharLength),null==n?void 0:n.threshold),{shouldSort:!1,includeMatches:!0,threshold:.3,keys:["text"]});return null!==t&&t&&0!==t.length?new Fuse(t,i).search(e):[]},searchInJson=(e,t,n)=>{if(!is.string(e))return[];if(is.empty(t))return[];if(is.empty(n))return[];const i=fuzzySearch(e,t,n);return i&&Array.prototype.map.call(i,(function(e){return{time:Math.ceil(e.item.startTime),label:""}}))};function searchVtt(e,t){var n,i,r,s;if(!e)return;if(!(null===(n=null==e?void 0:e.media)||void 0===n?void 0:n.textTracks)||0===(null===(r=null===(i=null==e?void 0:e.media)||void 0===i?void 0:i.textTracks)||void 0===r?void 0:r.length))return;const o=e.media.textTracks,c=(null===(s=e.config.preset)||void 0===s?void 0:s.search)||"";let a="";if(a=-1===e.captions.currentTrack?getCues(e):o[e.captions.currentTrack],is.empty(a))return[];const h=vttToJson(a);return is.empty(h)?[]:searchInJson(t,null==h?void 0:h.cues,c)}function removeOldMarkers(e){var t;if(!e)return;if(!(null==e?void 0:e.elements)||!(null===(t=null==e?void 0:e.elements)||void 0===t?void 0:t.progress))return;let n=e.elements.progress.querySelectorAll(".plyr__progress__marker");if(!is.empty(n))for(var i=0;i<n.length;i++)n[i].remove()}function setMarkers(e,t){if(!e)return;if(removeOldMarkers(e),!(null==t?void 0:t.length))return;const n=document.createDocumentFragment(),i=document.createDocumentFragment();t.forEach((t=>{const n=createElement("span",{class:"plyr__progress__marker"},""),r=t.time/e.duration*100+"%";n.addEventListener("click",(()=>{e.currentTime=t.time})),n.style.left=r,i.appendChild(n)})),n.appendChild(i),e.elements.markers={points:i,tip:null},e.elements.progress.appendChild(n)}function cacheCues(e){var t,n,i,r,s,o;if(!(null===(n=null===(t=null==e?void 0:e.config.preset)||void 0===t?void 0:t.search)||void 0===n?void 0:n.enabled))return;if(!(null===(r=null===(i=null==e?void 0:e.media)||void 0===i?void 0:i.textTracks)||void 0===r?void 0:r.length)||0===(null===(o=null===(s=null==e?void 0:e.media)||void 0===s?void 0:s.textTracks)||void 0===o?void 0:o.length))return;if(-1!==(null==e?void 0:e.currentTrack))return;e.toggleCaptions(!0);let c=setInterval((()=>{var t;const n=null===(t=e.media.textTracks[0])||void 0===t?void 0:t.cues;(null==n?void 0:n.length)>0&&(setCues(e),e.toggleCaptions(!1),clearInterval(c))}),200)}function getCues(e){if(!e)return;const t=localStorage.getItem("presto-player-"+e.id+"-cues");return is.empty(t)?"":JSON.parse(t)}function setCues(e){var t,n,i,r,s;if(!e||!(null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.textTracks)||0===(null===(i=null===(n=null==e?void 0:e.media)||void 0===n?void 0:n.textTracks)||void 0===i?void 0:i.length))return;const o=(null===(s=null===(r=null==e?void 0:e.media)||void 0===r?void 0:r.textTracks)||void 0===s?void 0:s[0])?vttToJson(e.media.textTracks[0]):{};is.empty(o)||localStorage.setItem("presto-player-"+e.id+"-cues",JSON.stringify(o))}export{isIOS as a,timeToSeconds as b,cacheCues as c,setMarkers as d,exitFullScreen as e,isAndroidWebView as f,getParents as g,isHLS as i,lightOrDark as l,parseColor as p,removeOldMarkers as r,searchVtt as s,timePassed as t};