@gientech/modual 2.2.37 → 2.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chatCompare.js CHANGED
@@ -1 +1,333 @@
1
- import"react/jsx-runtime";import{C as c,C as g}from"./assets/index-BrQsYGxa.js";import"react";import"@mxmweb/zui";import"antd";import"./assets/index-CpW6Dhpp.js";import"@mxmweb/aichat";import"./assets/circle-plus-RlDPoPkb.js";import"@mxmweb/rtext";import"dayjs";import"axios";import"./assets/GientechStreamReader-_ih9ja1B.js";import"styled-components";import"@mxmweb/fviewer";import"./assets/createLucideIcon-Bj5DlX2s.js";import"./assets/x-CdZQbi--.js";import"./assets/loader-circle-C1Oa97Sz.js";export{c as ChatCompareComponent,g as default};
1
+ import{jsxs as Pe,jsx as J,Fragment as Ys}from"react/jsx-runtime";import*as ei from"react";import Qs,{useState as Ne,useEffect as Ye,useMemo as pt,forwardRef as Js,useImperativeHandle as Bd,useRef as nt,useCallback as Dt,createElement as Co,useContext as Zm,createContext as ey}from"react";import{ChatMessageAdapter as ty,mergeLiveChunkToNodes as iy}from"@mxmweb/rtext";import{useTheme as Ud,Icon as Eo,deepMergeTheme as ms,defaultTheme as $l}from"@mxmweb/zui";import Bt from"axios";import{Table as ry,Pagination as ny,Empty as sy,Tooltip as wo,ConfigProvider as qd,Drawer as jd,message as hi,Select as $d,Input as ay,Flex as oy,Badge as Hd,Button as uy}from"antd";import{c as Zs,z as ly,B as cy,N as dy,D as hy,g as qa,G as py,a as fy,W as gy,b as my,F as yy,h as Hl,d as Vl,e as bn,f as _y,m as by,i as vy,u as Vd,C as Ty}from"./assets/index-Ck0T7V1d.js";import{u as bi}from"./assets/index-CpW6Dhpp.js";import{G as zd,a as Sy,C as Cy}from"./assets/index-_ih9ja1B.js";import{X as Wd}from"./assets/x-CdZQbi--.js";import{c as Gd}from"./assets/createLucideIcon-Bj5DlX2s.js";import{L as zl}from"./assets/loader-circle-C1Oa97Sz.js";import{validateFileUpload as Xd,showValidationErrors as Kd}from"@mxmweb/aichat";import{C as Ey}from"./assets/circle-plus-RlDPoPkb.js";import"styled-components";import"@mxmweb/fviewer";/**
2
+ * @license lucide-react v0.456.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const wy=Gd("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
7
+ * @license lucide-react v0.456.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const xy=Gd("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Yd=i=>i||"",Qd=["txt","pdf","jpeg","jpg","png"],Jd=i=>[""].includes(i),kn=`http://${location.hostname}:9000/`,Ui=()=>"/proxy",Zd=i=>{var r;let e=i==null?void 0:i.file_type;const t=(r=i==null?void 0:i.metadata)==null?void 0:r.source;if(t)e=t.split(".").slice(-1)[0];else return(i==null?void 0:i.file_source)||"";return Qd.includes(e)?t.includes("http")?t:`${kn}${t}`:(i==null?void 0:i.file_source)||""},ky=i=>{if(!i)return"";const e=i.split("/"),t=e.length,r=e[t-3];if(!r)return"";const n=r.split(".");return n[n.length-1]},eh=i=>{try{if(!i)return"";const e=i.split("/"),t=e.length;return e[t-3]||""}catch{return""}},ru=i=>{var t;if(i!=null&&i.sourceFileName)return i.sourceFileName;if(!i)return"";const e=(t=i==null?void 0:i.metadata)==null?void 0:t.source;return e?eh(e):""},xo=(i,e)=>{var r;if(!i)return"";const t=(r=i==null?void 0:i.metadata)==null?void 0:r.source;if(t){const n=t.split(".");if(!n.length)return"";const s=n[n.length-1],a=(e||"").split(".");if(!a.length)return"";const o=a[a.length-1];switch(s.toLocaleLowerCase()){case"ppt":case"pub":case"pptx":return"pdf_slides";case"xls":case"xlsx":case"csv":return o==="pdf"?"pdf":"markdown_table";case"md":return"pdf";case"png":case"jpg":case"jpeg":return"image";case"html":case"htm":return"html";case"txt":return"text";default:return o==="ppt"||o==="pub"||o==="pptx"?"pdf_slides":"pdf"}}else return""},Ay=async({filePath:i,fileName:e,token:t})=>{if(i&&e)try{const r=await Bt.post("/proxy/index/knowledgeBase/file/stream",{convertedFilePath:i},{headers:{"Content-Type":"application/json",Authorization:t},responseType:"arraybuffer"});console.log("response",r);const n=new Blob([r.data]),s=window.URL.createObjectURL(n),a=document.createElement("a"),o=document.body;a.href=s,a.download=e,a.style.display="none",o.appendChild(a);const l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});a.dispatchEvent(l),setTimeout(()=>{o.removeChild(a),window.URL.revokeObjectURL(s)},100)}catch(r){console.error("\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF1A",r)}else console.error("\u7F3A\u5C11\u6587\u4EF6\u540D\u6216\u6587\u4EF6\u5730\u5740\uFF1A")};cy();const th=({curFileInfo:i,onClose:e,token:t})=>{var o;const r={title:"",subtitle:"",backgroundColor:"#f8f9fa",showLegend:!1,showTooltip:!1,showFullscreen:!1,showMinimap:!1},[n,s]=Ne({nodeList:[],edgeList:[]});Ye(()=>{console.log("curFileInfo",i)},[i]);const a=async l=>{if(!(!(l!=null&&l.id)||!(l!=null&&l.cyphers)||!(l!=null&&l.fetchUrl)))try{const{cyphers:d,fetchUrl:f,id:_}=l||{};console.log("getGraphData params",d,f,_);const w=await Bt.post(f,{cyphers:d,ontologyId:_},{headers:{Authorization:t}});console.log("getGraphData res",w),s((w==null?void 0:w.data)||{})}catch(d){console.log("error",d)}};return Ye(()=>{a(i)},[i]),Pe("div",{children:[Pe("div",{className:"flex justify-between h-[52px] leading-[52px] font-bold text-[16px] px-[15px] overflow-hidden border-t-none border-l-none border-b-[1px] border-solid border-[rgb(222,226,230)]",children:[J("div",{children:(i==null?void 0:i.name)||"\u56FE\u8C31\u9884\u89C8"}),J("img",{src:Zs,className:"cursor-pointer",onClick:()=>e()})]}),J("div",{className:"w-full h-[calc(100vh-52)]",style:{width:"100%",height:"calc(100vh - 52px)"},children:J(ly,{centerNode:{vid:(o=i==null?void 0:i.traceNode)==null?void 0:o.vid},data:n,layout:{type:"force",linkDistance:190},title:r.title,subtitle:r.subtitle,backgroundColor:r.backgroundColor,showGrid:!1,showLegend:r.showLegend,showTooltip:r.showTooltip,showFullscreen:r.showFullscreen,showMinimap:r.showMinimap,customPlugins:{},onReady:l=>{console.log("KnowledgeGraphPreview ready:",l)}})})]})},ih=({content:i,onClose:e,token:t})=>{const r=a=>{if(!(a!=null&&a.metadata))return;const o=xo(a,""),{page_number:l,page_size:d,position:f,offset:_,chunk_type:w}=a.metadata;if(o==="markdown_table")return _!=null&&_.length?{annotations:[{id:bi(),offsets:_}],initialPage:1}:{};{if(!d||!f)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size\u6216\u8005\u6587\u4EF6\u5750\u6807","color: red"),{};const T=Array.isArray(d)?d:JSON.parse(d);if(!T.length)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size","color: red"),{};const k=Array.isArray(f)?f:JSON.parse(f);return!k.length||!l?(console.log("%c\u7F3A\u5C11\u6587\u4EF6\u5750\u6807\u6216\u8005\u6587\u4EF6\u9875\u6570","color: red"),{}):{annotations:k.map((x,O)=>({id:bi(),pageNumber:l[O],x:+(x[0][0]/T[0][0]).toFixed(4),y:+(x[0][1]/T[0][1]).toFixed(4),width:+((x[1][0]-x[0][0])/T[0][0]).toFixed(4),height:+((x[2][1]-x[0][1])/T[0][1]).toFixed(4),content:"",color:w==="image"?"#60f74f":"#4FC3F7"})),initialPage:l[0]}}},n=pt(()=>{var a;if(console.log("content88888888888",i),i&&t){console.log("content999",i);const{annotations:o,initialPage:l}=r(i),d={...i,metadata:{source:((a=i==null?void 0:i.metadata)==null?void 0:a.source)||i.parse_url||i.url}},f=Yd(Zd(d));return{filePath:f,fileName:ru(d),fileType:xo(d,f),totalPages:d.pdfPages||0,token:t,annotations:o,initialPage:l}}else return{}},[i]),s=pt(()=>n.filePath?(console.log("curData",n),J(zd,{convertedFilePath:n.filePath,fileName:n.fileName,fileType:n.fileType,initialPage:n.initialPage,totalPages:n.totalPages,authorization:n.token,annotations:n.annotations,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:a=>{switch(a){case"viewer:close":e();break}},tools:{close:!0}})):J(Ys,{}),[n]);return J("div",{style:{fontFamily:"Source Han Sans CN",fontSize:"12px"},className:"h-full w-full",children:s})},rh=({curFileInfo:i,onClose:e,token:t})=>{const r=pt(()=>{var s;if(i&&t){console.log("content999",i);const a={file_source:i.parse_url||i.parsedFilePath||i.url,file_type:i.file_type,metadata:{source:((s=i==null?void 0:i.metadata)==null?void 0:s.source)||i.filePath||i.url||""},pdfPages:i.pdfPages},o=Yd(Zd(a));return{filePath:o,fileName:ru(a),fileType:xo(a,o),totalPages:a.pdfPages||0,token:t}}else return{}},[i]),n=pt(()=>(console.log("curData",r),r.filePath?J(zd,{convertedFilePath:r.filePath,fileName:r.fileName,fileType:r.fileType,initialPage:1,totalPages:r.totalPages,authorization:r.token,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:s=>{switch(s){case"viewer:close":e();break}},tools:{close:!0}}):J(Ys,{})),[r]);return J("div",{id:"pdfBox",className:"h-full overflow-y-auto",children:n})},nh=({curFileInfo:i})=>{const[e,t]=Ne(1),[r,n]=Ne(10),[s,a]=Ne([]),[o,l]=Ne([]),[d,f]=Ne(0);Ye(()=>{var b;const k=((b=i==null?void 0:i.metadata)==null?void 0:b.fetchUrl)||(i==null?void 0:i.fetchUrl);k&&w(k)},[i,e,r]);const _=async({url:k,params:b})=>{try{const x=await Bt.get(`${Ui()}${k}?${new URLSearchParams(b).toString()}`),O=x==null?void 0:x.data;if(O){const{columns:C,dataList:A,totalData:z}=O;a(((C==null?void 0:C.slice(1))||[]).map(V=>({title:V.businessName,dataIndex:V.physicalName,key:V.physicalName}))),l(A||[]),f(z||[])}}catch(x){console.log("error",x)}},w=async k=>{_({url:`${k}`,params:{pageNo:e,pageSize:r}})};return Pe("div",{children:[J("div",{className:"h-[52px] leading-[52px] font-bold text-[16px] px-[15px] overflow-hidden border-t-none border-l-none border-b-[1px] border-solid border-[rgb(222,226,230)]",children:(()=>{const{file:k,metadata:b}=i,{dataSourceType:x,databaseName:O,tableName:C,businessTableName:A}=b;return x=="DataTable"?`${O} - ${A}`:x=="DirectDB"?`${O} - ${C}`:k})()}),(s==null?void 0:s.length)>0?Pe("div",{children:[J("div",{className:"p-4 overflow-auto h-[calc(100vh-120px)]",children:J(ry,{columns:s,dataSource:o,pagination:!1,scroll:{x:"max-content"}})}),J("div",{className:"flex justify-end px-[18px]",children:J(ny,{current:e,pageSize:r,responsive:!0,simple:!0,total:d,showSizeChanger:!0,showQuickJumper:!0,onChange:(k,b)=>{t(k),n(b||10)},onShowSizeChange:(k,b)=>{t(1),n(b)}})})]}):J(sy,{})]})};var ks=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function On(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Dy(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var n=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return i[r]}})}),t}var Wl={exports:{}},cn={};/**
12
+ * @license React
13
+ * react-jsx-runtime.production.min.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */var Gl;function Iy(){if(Gl)return cn;Gl=1;var i=Qs,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,d){var f,_={},w=null,T=null;d!==void 0&&(w=""+d),l.key!==void 0&&(w=""+l.key),l.ref!==void 0&&(T=l.ref);for(f in l)r.call(l,f)&&!s.hasOwnProperty(f)&&(_[f]=l[f]);if(o&&o.defaultProps)for(f in l=o.defaultProps,l)_[f]===void 0&&(_[f]=l[f]);return{$$typeof:e,type:o,key:w,ref:T,props:_,_owner:n.current}}return cn.Fragment=t,cn.jsx=a,cn.jsxs=a,cn}var Xl;function Py(){return Xl||(Xl=1,Wl.exports=Iy()),Wl.exports}var De=Py(),ja,Kl;function ea(){if(Kl)return ja;Kl=1;var i;return typeof window<"u"?i=window:typeof ks<"u"?i=ks:typeof self<"u"?i=self:i={},ja=i,ja}var Ly=ea();const B=On(Ly),Oy={},Ny=Object.freeze(Object.defineProperty({__proto__:null,default:Oy},Symbol.toStringTag,{value:"Module"})),Fy=Dy(Ny);var $a,Yl;function sh(){if(Yl)return $a;Yl=1;var i=typeof ks<"u"?ks:typeof window<"u"?window:{},e=Fy,t;return typeof document<"u"?t=document:(t=i["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=i["__GLOBAL_DOCUMENT_CACHE@4"]=e)),$a=t,$a}var Ry=sh();const ce=On(Ry);var ys={exports:{}},Ql={exports:{}},Jl;function My(){return Jl||(Jl=1,(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(Ql)),Ql.exports}var Ha,Zl;function By(){if(Zl)return Ha;Zl=1,Ha=e;var i=Object.prototype.toString;function e(t){if(!t)return!1;var r=i.call(t);return r==="[object Function]"||typeof t=="function"&&r!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return Ha}var Va,ec;function Uy(){if(ec)return Va;ec=1;function i(n,s){var a=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a)return(a=a.call(n)).next.bind(a);if(Array.isArray(n)||(a=e(n))||s){a&&(n=a);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
20
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(n,s){if(n){if(typeof n=="string")return t(n,s);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(n);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(n,s)}}function t(n,s){(s==null||s>n.length)&&(s=n.length);for(var a=0,o=new Array(s);a<s;a++)o[a]=n[a];return o}var r=(function(){function n(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var s=n.prototype;return s.getIsEnabled=function(){return this.enabled_},s.enable=function(){this.enabled_=!0},s.disable=function(){this.enabled_=!1},s.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},s.addInterceptor=function(a,o){this.typeToInterceptorsMap_.has(a)||this.typeToInterceptorsMap_.set(a,new Set);var l=this.typeToInterceptorsMap_.get(a);return l.has(o)?!1:(l.add(o),!0)},s.removeInterceptor=function(a,o){var l=this.typeToInterceptorsMap_.get(a);return l&&l.has(o)?(l.delete(o),!0):!1},s.clearInterceptorsByType=function(a){var o=this.typeToInterceptorsMap_.get(a);return o?(this.typeToInterceptorsMap_.delete(a),this.typeToInterceptorsMap_.set(a,new Set),!0):!1},s.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},s.getForType=function(a){return this.typeToInterceptorsMap_.get(a)||new Set},s.execute=function(a,o){for(var l=this.getForType(a),d=i(l),f;!(f=d()).done;){var _=f.value;try{o=_(o)}catch{}}return o},n})();return Va=r,Va}var za,tc;function qy(){if(tc)return za;tc=1;var i=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var r=t.prototype;return r.getIsEnabled=function(){return this.enabled_},r.enable=function(){this.enabled_=!0},r.disable=function(){this.enabled_=!1},r.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},r.getMaxAttempts=function(){return this.maxAttempts_},r.setMaxAttempts=function(n){this.maxAttempts_=n},r.getDelayFactor=function(){return this.delayFactor_},r.setDelayFactor=function(n){this.delayFactor_=n},r.getFuzzFactor=function(){return this.fuzzFactor_},r.setFuzzFactor=function(n){this.fuzzFactor_=n},r.getInitialDelay=function(){return this.initialDelay_},r.setInitialDelay=function(n){this.initialDelay_=n},r.createRetry=function(n){var s=n===void 0?{}:n,a=s.maxAttempts,o=s.delayFactor,l=s.fuzzFactor,d=s.initialDelay;return new e({maxAttempts:a||this.maxAttempts_,delayFactor:o||this.delayFactor_,fuzzFactor:l||this.fuzzFactor_,initialDelay:d||this.initialDelay_})},t})(),e=(function(){function t(n){this.maxAttempts_=n.maxAttempts,this.delayFactor_=n.delayFactor,this.fuzzFactor_=n.fuzzFactor,this.currentDelay_=n.initialDelay,this.currentAttempt_=1}var r=t.prototype;return r.moveToNextAttempt=function(){this.currentAttempt_++;var n=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+n},r.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},r.getCurrentDelay=function(){return this.currentDelay_},r.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},r.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},r.getCurrentFuzzedDelay=function(){var n=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return n+Math.random()*(s-n)},t})();return za=i,za}var Wa,ic;function jy(){if(ic)return Wa;ic=1;var i=ea(),e=function(r,n){return n===void 0&&(n=!1),function(s,a,o){if(s){r(s);return}if(a.statusCode>=400&&a.statusCode<=599){var l=o;if(n)if(i.TextDecoder){var d=t(a.headers&&a.headers["content-type"]);try{l=new TextDecoder(d).decode(o)}catch{}}else l=String.fromCharCode.apply(null,new Uint8Array(o));r({cause:l});return}r(null,o)}};function t(r){return r===void 0&&(r=""),r.toLowerCase().split(";").reduce(function(n,s){var a=s.split("="),o=a[0],l=a[1];return o.trim()==="charset"?l.trim():n},"utf-8")}return Wa=e,Wa}var rc;function $y(){if(rc)return ys.exports;rc=1;var i=ea(),e=My(),t=By(),r=Uy(),n=qy();d.httpHandler=jy(),d.requestInterceptorsStorage=new r,d.responseInterceptorsStorage=new r,d.retryManager=new n;/**
21
+ * @license
22
+ * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
23
+ * Copyright (c) 2014 David Björklund
24
+ * Available under the MIT license
25
+ * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
26
+ */var s=function(T){var k={};return T&&T.trim().split(`
27
+ `).forEach(function(b){var x=b.indexOf(":"),O=b.slice(0,x).trim().toLowerCase(),C=b.slice(x+1).trim();typeof k[O]>"u"?k[O]=C:Array.isArray(k[O])?k[O].push(C):k[O]=[k[O],C]}),k};ys.exports=d,ys.exports.default=d,d.XMLHttpRequest=i.XMLHttpRequest||w,d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:i.XDomainRequest,a(["get","put","post","patch","head","delete"],function(T){d[T==="delete"?"del":T]=function(k,b,x){return b=l(k,b,x),b.method=T.toUpperCase(),f(b)}});function a(T,k){for(var b=0;b<T.length;b++)k(T[b])}function o(T){for(var k in T)if(T.hasOwnProperty(k))return!1;return!0}function l(T,k,b){var x=T;return t(k)?(b=k,typeof T=="string"&&(x={uri:T})):x=e({},k,{uri:T}),x.callback=b,x}function d(T,k,b){return k=l(T,k,b),f(k)}function f(T){if(typeof T.callback>"u")throw new Error("callback argument missing");if(T.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var k={uri:T.uri||T.url,headers:T.headers||{},body:T.body,metadata:T.metadata||{},retry:T.retry,timeout:T.timeout},b=d.requestInterceptorsStorage.execute(T.requestType,k);T.uri=b.uri,T.headers=b.headers,T.body=b.body,T.metadata=b.metadata,T.retry=b.retry,T.timeout=b.timeout}var x=!1,O=function(N,j,Y){x||(x=!0,T.callback(N,j,Y))};function C(){U.readyState===4&&!d.responseInterceptorsStorage.getIsEnabled()&&setTimeout(V,0)}function A(){var N=void 0;if(U.response?N=U.response:N=U.responseText||_(U),X)try{N=JSON.parse(N)}catch{}return N}function z(N){if(clearTimeout(G),clearTimeout(T.retryTimeout),N instanceof Error||(N=new Error(""+(N||"Unknown XMLHttpRequest Error"))),N.statusCode=0,!L&&d.retryManager.getIsEnabled()&&T.retry&&T.retry.shouldRetry()){T.retryTimeout=setTimeout(function(){T.retry.moveToNextAttempt(),T.xhr=U,f(T)},T.retry.getCurrentFuzzedDelay());return}if(T.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var j={headers:te.headers||{},body:te.body,responseUrl:U.responseURL,responseType:U.responseType},Y=d.responseInterceptorsStorage.execute(T.requestType,j);te.body=Y.body,te.headers=Y.headers}return O(N,te)}function V(){if(!L){var N;clearTimeout(G),clearTimeout(T.retryTimeout),T.useXDR&&U.status===void 0?N=200:N=U.status===1223?204:U.status;var j=te,Y=null;if(N!==0?(j={body:A(),statusCode:N,method:y,headers:{},url:v,rawRequest:U},U.getAllResponseHeaders&&(j.headers=s(U.getAllResponseHeaders()))):Y=new Error("Internal XMLHttpRequest Error"),T.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var Q={headers:j.headers||{},body:j.body,responseUrl:U.responseURL,responseType:U.responseType},ee=d.responseInterceptorsStorage.execute(T.requestType,Q);j.body=ee.body,j.headers=ee.headers}return O(Y,j,j.body)}}var U=T.xhr||null;U||(T.cors||T.useXDR?U=new d.XDomainRequest:U=new d.XMLHttpRequest);var I,L,v=U.url=T.uri||T.url,y=U.method=T.method||"GET",M=T.body||T.data,F=U.headers=T.headers||{},H=!!T.sync,X=!1,G,te={body:void 0,headers:{},statusCode:0,method:y,url:v,rawRequest:U};if("json"in T&&T.json!==!1&&(X=!0,F.accept||F.Accept||(F.Accept="application/json"),y!=="GET"&&y!=="HEAD"&&(F["content-type"]||F["Content-Type"]||(F["Content-Type"]="application/json"),M=JSON.stringify(T.json===!0?M:T.json))),U.onreadystatechange=C,U.onload=V,U.onerror=z,U.onprogress=function(){},U.onabort=function(){L=!0,clearTimeout(T.retryTimeout)},U.ontimeout=z,U.open(y,v,!H,T.username,T.password),H||(U.withCredentials=!!T.withCredentials),!H&&T.timeout>0&&(G=setTimeout(function(){if(!L){L=!0,U.abort("timeout");var N=new Error("XMLHttpRequest timeout");N.code="ETIMEDOUT",z(N)}},T.timeout)),U.setRequestHeader)for(I in F)F.hasOwnProperty(I)&&U.setRequestHeader(I,F[I]);else if(T.headers&&!o(T.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in T&&(U.responseType=T.responseType),"beforeSend"in T&&typeof T.beforeSend=="function"&&T.beforeSend(U),U.send(M||null),U}function _(T){try{if(T.responseType==="document")return T.responseXML;var k=T.responseXML&&T.responseXML.documentElement.nodeName==="parsererror";if(T.responseType===""&&!k)return T.responseXML}catch{}return null}function w(){}return ys.exports}var Hy=$y();const ah=On(Hy);var Ga={exports:{}},Xa,nc;function Vy(){if(nc)return Xa;nc=1;var i=sh(),e=Object.create||(function(){function v(){}return function(y){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return v.prototype=y,new v}})();function t(v,y){this.name="ParsingError",this.code=v.code,this.message=y||v.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function r(v){function y(F,H,X,G){return(F|0)*3600+(H|0)*60+(X|0)+(G|0)/1e3}var M=v.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return M?M[3]?y(M[1],M[2],M[3].replace(":",""),M[4]):M[1]>59?y(M[1],M[2],0,M[4]):y(0,M[1],M[2],M[4]):null}function n(){this.values=e(null)}n.prototype={set:function(v,y){!this.get(v)&&y!==""&&(this.values[v]=y)},get:function(v,y,M){return M?this.has(v)?this.values[v]:y[M]:this.has(v)?this.values[v]:y},has:function(v){return v in this.values},alt:function(v,y,M){for(var F=0;F<M.length;++F)if(y===M[F]){this.set(v,y);break}},integer:function(v,y){/^-?\d+$/.test(y)&&this.set(v,parseInt(y,10))},percent:function(v,y){return y.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(y=parseFloat(y),y>=0&&y<=100)?(this.set(v,y),!0):!1}};function s(v,y,M,F){var H=F?v.split(F):[v];for(var X in H)if(typeof H[X]=="string"){var G=H[X].split(M);if(G.length===2){var te=G[0].trim(),N=G[1].trim();y(te,N)}}}function a(v,y,M){var F=v;function H(){var te=r(v);if(te===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+F);return v=v.replace(/^[^\sa-zA-Z-]+/,""),te}function X(te,N){var j=new n;s(te,function(Y,Q){switch(Y){case"region":for(var ee=M.length-1;ee>=0;ee--)if(M[ee].id===Q){j.set(Y,M[ee].region);break}break;case"vertical":j.alt(Y,Q,["rl","lr"]);break;case"line":var ue=Q.split(","),le=ue[0];j.integer(Y,le),j.percent(Y,le)&&j.set("snapToLines",!1),j.alt(Y,le,["auto"]),ue.length===2&&j.alt("lineAlign",ue[1],["start","center","end"]);break;case"position":ue=Q.split(","),j.percent(Y,ue[0]),ue.length===2&&j.alt("positionAlign",ue[1],["start","center","end"]);break;case"size":j.percent(Y,Q);break;case"align":j.alt(Y,Q,["start","center","end","left","right"]);break}},/:/,/\s/),N.region=j.get("region",null),N.vertical=j.get("vertical","");try{N.line=j.get("line","auto")}catch{}N.lineAlign=j.get("lineAlign","start"),N.snapToLines=j.get("snapToLines",!0),N.size=j.get("size",100);try{N.align=j.get("align","center")}catch{N.align=j.get("align","middle")}try{N.position=j.get("position","auto")}catch{N.position=j.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},N.align)}N.positionAlign=j.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},N.align)}function G(){v=v.replace(/^\s+/,"")}if(G(),y.startTime=H(),G(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+F);v=v.substr(3),G(),y.endTime=H(),G(),X(v,y)}var o=i.createElement&&i.createElement("textarea"),l={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},f={v:"title",lang:"lang"},_={rt:"ruby"};function w(v,y){function M(){if(!y)return null;function le(fe){return y=y.substr(fe.length),fe}var he=y.match(/^([^<]*)(<[^>]*>?)?/);return le(he[1]?he[1]:he[2])}function F(le){return o.innerHTML=le,le=o.textContent,o.textContent="",le}function H(le,he){return!_[he.localName]||_[he.localName]===le.localName}function X(le,he){var fe=l[le];if(!fe)return null;var Fe=v.document.createElement(fe),xe=f[le];return xe&&he&&(Fe[xe]=he.trim()),Fe}for(var G=v.document.createElement("div"),te=G,N,j=[];(N=M())!==null;){if(N[0]==="<"){if(N[1]==="/"){j.length&&j[j.length-1]===N.substr(2).replace(">","")&&(j.pop(),te=te.parentNode);continue}var Y=r(N.substr(1,N.length-2)),Q;if(Y){Q=v.document.createProcessingInstruction("timestamp",Y),te.appendChild(Q);continue}var ee=N.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!ee||(Q=X(ee[1],ee[3]),!Q)||!H(te,Q))continue;if(ee[2]){var ue=ee[2].split(".");ue.forEach(function(le){var he=/^bg_/.test(le),fe=he?le.slice(3):le;if(d.hasOwnProperty(fe)){var Fe=he?"background-color":"color",xe=d[fe];Q.style[Fe]=xe}}),Q.className=ue.join(" ")}j.push(ee[1]),te.appendChild(Q),te=Q;continue}te.appendChild(v.document.createTextNode(F(N)))}return G}var T=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function k(v){for(var y=0;y<T.length;y++){var M=T[y];if(v>=M[0]&&v<=M[1])return!0}return!1}function b(v){var y=[],M="",F;if(!v||!v.childNodes)return"ltr";function H(te,N){for(var j=N.childNodes.length-1;j>=0;j--)te.push(N.childNodes[j])}function X(te){if(!te||!te.length)return null;var N=te.pop(),j=N.textContent||N.innerText;if(j){var Y=j.match(/^.*(\n|\r)/);return Y?(te.length=0,Y[0]):j}if(N.tagName==="ruby")return X(te);if(N.childNodes)return H(te,N),X(te)}for(H(y,v);M=X(y);)for(var G=0;G<M.length;G++)if(F=M.charCodeAt(G),k(F))return"rtl";return"ltr"}function x(v){if(typeof v.line=="number"&&(v.snapToLines||v.line>=0&&v.line<=100))return v.line;if(!v.track||!v.track.textTrackList||!v.track.textTrackList.mediaElement)return-1;for(var y=v.track,M=y.textTrackList,F=0,H=0;H<M.length&&M[H]!==y;H++)M[H].mode==="showing"&&F++;return++F*-1}function O(){}O.prototype.applyStyles=function(v,y){y=y||this.div;for(var M in v)v.hasOwnProperty(M)&&(y.style[M]=v[M])},O.prototype.formatStyle=function(v,y){return v===0?0:v+y};function C(v,y,M){O.call(this),this.cue=y,this.cueDiv=w(v,y.text);var F={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:y.vertical===""?"horizontal-tb":y.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(F,this.cueDiv),this.div=v.document.createElement("div"),F={direction:b(this.cueDiv),writingMode:y.vertical===""?"horizontal-tb":y.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:y.align==="middle"?"center":y.align,font:M.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(F),this.div.appendChild(this.cueDiv);var H=0;switch(y.positionAlign){case"start":case"line-left":H=y.position;break;case"center":H=y.position-y.size/2;break;case"end":case"line-right":H=y.position-y.size;break}y.vertical===""?this.applyStyles({left:this.formatStyle(H,"%"),width:this.formatStyle(y.size,"%")}):this.applyStyles({top:this.formatStyle(H,"%"),height:this.formatStyle(y.size,"%")}),this.move=function(X){this.applyStyles({top:this.formatStyle(X.top,"px"),bottom:this.formatStyle(X.bottom,"px"),left:this.formatStyle(X.left,"px"),right:this.formatStyle(X.right,"px"),height:this.formatStyle(X.height,"px"),width:this.formatStyle(X.width,"px")})}}C.prototype=e(O.prototype),C.prototype.constructor=C;function A(v){var y,M,F,H;if(v.div){M=v.div.offsetHeight,F=v.div.offsetWidth,H=v.div.offsetTop;var X=(X=v.div.childNodes)&&(X=X[0])&&X.getClientRects&&X.getClientRects();v=v.div.getBoundingClientRect(),y=X?Math.max(X[0]&&X[0].height||0,v.height/X.length):0}this.left=v.left,this.right=v.right,this.top=v.top||H,this.height=v.height||M,this.bottom=v.bottom||H+(v.height||M),this.width=v.width||F,this.lineHeight=y!==void 0?y:v.lineHeight}A.prototype.move=function(v,y){switch(y=y!==void 0?y:this.lineHeight,v){case"+x":this.left+=y,this.right+=y;break;case"-x":this.left-=y,this.right-=y;break;case"+y":this.top+=y,this.bottom+=y;break;case"-y":this.top-=y,this.bottom-=y;break}},A.prototype.overlaps=function(v){return this.left<v.right&&this.right>v.left&&this.top<v.bottom&&this.bottom>v.top},A.prototype.overlapsAny=function(v){for(var y=0;y<v.length;y++)if(this.overlaps(v[y]))return!0;return!1},A.prototype.within=function(v){return this.top>=v.top&&this.bottom<=v.bottom&&this.left>=v.left&&this.right<=v.right},A.prototype.overlapsOppositeAxis=function(v,y){switch(y){case"+x":return this.left<v.left;case"-x":return this.right>v.right;case"+y":return this.top<v.top;case"-y":return this.bottom>v.bottom}},A.prototype.intersectPercentage=function(v){var y=Math.max(0,Math.min(this.right,v.right)-Math.max(this.left,v.left)),M=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),F=y*M;return F/(this.height*this.width)},A.prototype.toCSSCompatValues=function(v){return{top:this.top-v.top,bottom:v.bottom-this.bottom,left:this.left-v.left,right:v.right-this.right,height:this.height,width:this.width}},A.getSimpleBoxPosition=function(v){var y=v.div?v.div.offsetHeight:v.tagName?v.offsetHeight:0,M=v.div?v.div.offsetWidth:v.tagName?v.offsetWidth:0,F=v.div?v.div.offsetTop:v.tagName?v.offsetTop:0;v=v.div?v.div.getBoundingClientRect():v.tagName?v.getBoundingClientRect():v;var H={left:v.left,right:v.right,top:v.top||F,height:v.height||y,bottom:v.bottom||F+(v.height||y),width:v.width||M};return H};function z(v,y,M,F){function H(fe,Fe){for(var xe,oe=new A(fe),ge=1,Ee=0;Ee<Fe.length;Ee++){for(;fe.overlapsOppositeAxis(M,Fe[Ee])||fe.within(M)&&fe.overlapsAny(F);)fe.move(Fe[Ee]);if(fe.within(M))return fe;var Ce=fe.intersectPercentage(M);ge>Ce&&(xe=new A(fe),ge=Ce),fe=new A(oe)}return xe||oe}var X=new A(y),G=y.cue,te=x(G),N=[];if(G.snapToLines){var j;switch(G.vertical){case"":N=["+y","-y"],j="height";break;case"rl":N=["+x","-x"],j="width";break;case"lr":N=["-x","+x"],j="width";break}var Y=X.lineHeight,Q=Y*Math.round(te),ee=M[j]+Y,ue=N[0];Math.abs(Q)>ee&&(Q=Q<0?-1:1,Q*=Math.ceil(ee/Y)*Y),te<0&&(Q+=G.vertical===""?M.height:M.width,N=N.reverse()),X.move(ue,Q)}else{var le=X.lineHeight/M.height*100;switch(G.lineAlign){case"center":te-=le/2;break;case"end":te-=le;break}switch(G.vertical){case"":y.applyStyles({top:y.formatStyle(te,"%")});break;case"rl":y.applyStyles({left:y.formatStyle(te,"%")});break;case"lr":y.applyStyles({right:y.formatStyle(te,"%")});break}N=["+y","-x","+x","-y"],X=new A(y)}var he=H(X,N);y.move(he.toCSSCompatValues(M))}function V(){}V.StringDecoder=function(){return{decode:function(v){if(!v)return"";if(typeof v!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(v))}}},V.convertCueToDOMTree=function(v,y){return!v||!y?null:w(v,y)};var U=.05,I="sans-serif",L="1.5%";return V.processCues=function(v,y,M){if(!v||!y||!M)return null;for(;M.firstChild;)M.removeChild(M.firstChild);var F=v.document.createElement("div");F.style.position="absolute",F.style.left="0",F.style.right="0",F.style.top="0",F.style.bottom="0",F.style.margin=L,M.appendChild(F);function H(Y){for(var Q=0;Q<Y.length;Q++)if(Y[Q].hasBeenReset||!Y[Q].displayState)return!0;return!1}if(!H(y)){for(var X=0;X<y.length;X++)F.appendChild(y[X].displayState);return}var G=[],te=A.getSimpleBoxPosition(F),N=Math.round(te.height*U*100)/100,j={font:N+"px "+I};(function(){for(var Y,Q,ee=0;ee<y.length;ee++)Q=y[ee],Y=new C(v,Q,j),F.appendChild(Y.div),z(v,Y,te,G),Q.displayState=Y.div,G.push(A.getSimpleBoxPosition(Y))})()},V.Parser=function(v,y,M){M||(M=y,y={}),y||(y={}),this.window=v,this.vttjs=y,this.state="INITIAL",this.buffer="",this.decoder=M||new TextDecoder("utf8"),this.regionList=[]},V.Parser.prototype={reportOrThrowError:function(v){if(v instanceof t)this.onparsingerror&&this.onparsingerror(v);else throw v},parse:function(v){var y=this;v&&(y.buffer+=y.decoder.decode(v,{stream:!0}));function M(){for(var Y=y.buffer,Q=0;Q<Y.length&&Y[Q]!=="\r"&&Y[Q]!==`
28
+ `;)++Q;var ee=Y.substr(0,Q);return Y[Q]==="\r"&&++Q,Y[Q]===`
29
+ `&&++Q,y.buffer=Y.substr(Q),ee}function F(Y){var Q=new n;if(s(Y,function(ue,le){switch(ue){case"id":Q.set(ue,le);break;case"width":Q.percent(ue,le);break;case"lines":Q.integer(ue,le);break;case"regionanchor":case"viewportanchor":var he=le.split(",");if(he.length!==2)break;var fe=new n;if(fe.percent("x",he[0]),fe.percent("y",he[1]),!fe.has("x")||!fe.has("y"))break;Q.set(ue+"X",fe.get("x")),Q.set(ue+"Y",fe.get("y"));break;case"scroll":Q.alt(ue,le,["up"]);break}},/=/,/\s/),Q.has("id")){var ee=new(y.vttjs.VTTRegion||y.window.VTTRegion);ee.width=Q.get("width",100),ee.lines=Q.get("lines",3),ee.regionAnchorX=Q.get("regionanchorX",0),ee.regionAnchorY=Q.get("regionanchorY",100),ee.viewportAnchorX=Q.get("viewportanchorX",0),ee.viewportAnchorY=Q.get("viewportanchorY",100),ee.scroll=Q.get("scroll",""),y.onregion&&y.onregion(ee),y.regionList.push({id:Q.get("id"),region:ee})}}function H(Y){var Q=new n;s(Y,function(ee,ue){switch(ee){case"MPEGT":Q.integer(ee+"S",ue);break;case"LOCA":Q.set(ee+"L",r(ue));break}},/[^\d]:/,/,/),y.ontimestampmap&&y.ontimestampmap({MPEGTS:Q.get("MPEGTS"),LOCAL:Q.get("LOCAL")})}function X(Y){Y.match(/X-TIMESTAMP-MAP/)?s(Y,function(Q,ee){switch(Q){case"X-TIMESTAMP-MAP":H(ee);break}},/=/):s(Y,function(Q,ee){switch(Q){case"Region":F(ee);break}},/:/)}try{var G;if(y.state==="INITIAL"){if(!/\r\n|\n/.test(y.buffer))return this;G=M();var te=G.match(/^WEBVTT([ \t].*)?$/);if(!te||!te[0])throw new t(t.Errors.BadSignature);y.state="HEADER"}for(var N=!1;y.buffer;){if(!/\r\n|\n/.test(y.buffer))return this;switch(N?N=!1:G=M(),y.state){case"HEADER":/:/.test(G)?X(G):G||(y.state="ID");continue;case"NOTE":G||(y.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(G)){y.state="NOTE";break}if(!G)continue;y.cue=new(y.vttjs.VTTCue||y.window.VTTCue)(0,0,"");try{y.cue.align="center"}catch{y.cue.align="middle"}if(y.state="CUE",G.indexOf("-->")===-1){y.cue.id=G;continue}case"CUE":try{a(G,y.cue,y.regionList)}catch(Y){y.reportOrThrowError(Y),y.cue=null,y.state="BADCUE";continue}y.state="CUETEXT";continue;case"CUETEXT":var j=G.indexOf("-->")!==-1;if(!G||j&&(N=!0)){y.oncue&&y.oncue(y.cue),y.cue=null,y.state="ID";continue}y.cue.text&&(y.cue.text+=`
30
+ `),y.cue.text+=G.replace(/\u2028/g,`
31
+ `).replace(/u2029/g,`
32
+ `);continue;case"BADCUE":G||(y.state="ID");continue}}}catch(Y){y.reportOrThrowError(Y),y.state==="CUETEXT"&&y.cue&&y.oncue&&y.oncue(y.cue),y.cue=null,y.state=y.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var v=this;try{if(v.buffer+=v.decoder.decode(),(v.cue||v.state==="HEADER")&&(v.buffer+=`
33
+
34
+ `,v.parse()),v.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(y){v.reportOrThrowError(y)}return v.onflush&&v.onflush(),this}},Xa=V,Xa}var Ka,sc;function zy(){if(sc)return Ka;sc=1;var i="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function r(a){if(typeof a!="string")return!1;var o=e[a.toLowerCase()];return o?a.toLowerCase():!1}function n(a){if(typeof a!="string")return!1;var o=t[a.toLowerCase()];return o?a.toLowerCase():!1}function s(a,o,l){this.hasBeenReset=!1;var d="",f=!1,_=a,w=o,T=l,k=null,b="",x=!0,O="auto",C="start",A="auto",z="auto",V=100,U="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return d},set:function(I){d=""+I}},pauseOnExit:{enumerable:!0,get:function(){return f},set:function(I){f=!!I}},startTime:{enumerable:!0,get:function(){return _},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");_=I,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return w},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");w=I,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return T},set:function(I){T=""+I,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return k},set:function(I){k=I,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return b},set:function(I){var L=r(I);if(L===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");b=L,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return x},set:function(I){x=!!I,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return O},set:function(I){if(typeof I!="number"&&I!==i)throw new SyntaxError("Line: an invalid number or illegal string was specified.");O=I,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return C},set:function(I){var L=n(I);L?(C=L,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return A},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");A=I,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return z},set:function(I){var L=n(I);L?(z=L,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return V},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");V=I,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return U},set:function(I){var L=n(I);if(!L)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");U=L,this.hasBeenReset=!0}}}),this.displayState=void 0}return s.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Ka=s,Ka}var Ya,ac;function Wy(){if(ac)return Ya;ac=1;var i={"":!0,up:!0};function e(n){if(typeof n!="string")return!1;var s=i[n.toLowerCase()];return s?n.toLowerCase():!1}function t(n){return typeof n=="number"&&n>=0&&n<=100}function r(){var n=100,s=3,a=0,o=100,l=0,d=100,f="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return n},set:function(_){if(!t(_))throw new Error("Width must be between 0 and 100.");n=_}},lines:{enumerable:!0,get:function(){return s},set:function(_){if(typeof _!="number")throw new TypeError("Lines must be set to a number.");s=_}},regionAnchorY:{enumerable:!0,get:function(){return o},set:function(_){if(!t(_))throw new Error("RegionAnchorX must be between 0 and 100.");o=_}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(_){if(!t(_))throw new Error("RegionAnchorY must be between 0 and 100.");a=_}},viewportAnchorY:{enumerable:!0,get:function(){return d},set:function(_){if(!t(_))throw new Error("ViewportAnchorY must be between 0 and 100.");d=_}},viewportAnchorX:{enumerable:!0,get:function(){return l},set:function(_){if(!t(_))throw new Error("ViewportAnchorX must be between 0 and 100.");l=_}},scroll:{enumerable:!0,get:function(){return f},set:function(_){var w=e(_);w===!1?console.warn("Scroll: an invalid or illegal string was specified."):f=w}}})}return Ya=r,Ya}var oc;function Gy(){if(oc)return Ga.exports;oc=1;var i=ea(),e=Ga.exports={WebVTT:Vy(),VTTCue:zy(),VTTRegion:Wy()};i.vttjs=e,i.WebVTT=e.WebVTT;var t=e.VTTCue,r=e.VTTRegion,n=i.VTTCue,s=i.VTTRegion;return e.shim=function(){i.VTTCue=t,i.VTTRegion=r},e.restore=function(){i.VTTCue=n,i.VTTRegion=s},i.VTTCue||e.shim(),Ga.exports}var Xy=Gy();const uc=On(Xy);function dt(){return dt=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},dt.apply(null,arguments)}var lc="https://example.com",ta=function(i,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(i)&&(i=B.location&&B.location.href||"");var t=/^\/\//.test(i),r=!B.location&&!/\/\//i.test(i);i=new B.URL(i,B.location||lc);var n=new URL(e,i);return r?n.href.slice(lc.length):t?n.href.slice(n.protocol.length):n.href},nu=(function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)},e.off=function(t,r){if(!this.listeners[t])return!1;var n=this.listeners[t].indexOf(r);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(n,1),n>-1},e.trigger=function(t){var r=this.listeners[t];if(r)if(arguments.length===2)for(var n=r.length,s=0;s<n;++s)r[s].call(this,arguments[1]);else for(var a=Array.prototype.slice.call(arguments,1),o=r.length,l=0;l<o;++l)r[l].apply(this,a)},e.dispose=function(){this.listeners={}},e.pipe=function(t){this.on("data",function(r){t.push(r)})},i})(),Ky=function(i){return B.atob?B.atob(i):Buffer.from(i,"base64").toString("binary")};function oh(i){for(var e=Ky(i),t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class Yy extends nu{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
35
+ `);t>-1;t=this.buffer.indexOf(`
36
+ `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Qy=" ",Qa=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},Jy=function(){const i='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+i+")")},kt=function(i){const e={};if(!i)return e;const t=i.split(Jy());let r=t.length,n;for(;r--;)t[r]!==""&&(n=/([^=]*)=(.*)/.exec(t[r]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},cc=i=>{const e=i.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class Zy extends nu{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,r;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,s)=>{const a=s(e);return a===e?n:n.concat([a])},[e]).forEach(n=>{for(let s=0;s<this.customParsers.length;s++)if(this.customParsers[s].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){r={type:"tag",tagType:"inf"},t[1]&&(r.duration=parseFloat(t[1])),t[2]&&(r.title=t[2]),this.trigger("data",r);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"targetduration"},t[1]&&(r.duration=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"version"},t[1]&&(r.version=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"media-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){r={type:"tag",tagType:"playlist-type"},t[1]&&(r.playlistType=t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){r=dt(Qa(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){r={type:"tag",tagType:"allow-cache"},t[1]&&(r.allowed=!/NO/.test(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(r={type:"tag",tagType:"map"},t[1]){const s=kt(t[1]);s.URI&&(r.uri=s.URI),s.BYTERANGE&&(r.byterange=Qa(s.BYTERANGE))}this.trigger("data",r);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"stream-inf"},t[1]&&(r.attributes=kt(t[1]),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=cc(r.attributes.RESOLUTION)),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"]&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10))),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){r={type:"tag",tagType:"media"},t[1]&&(r.attributes=kt(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){r={type:"tag",tagType:"program-date-time"},t[1]&&(r.dateTimeString=t[1],r.dateTimeObject=new Date(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){r={type:"tag",tagType:"key"},t[1]&&(r.attributes=kt(t[1]),r.attributes.IV&&(r.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV))),this.trigger("data",r);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){r={type:"tag",tagType:"start"},t[1]&&(r.attributes=kt(t[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out-cont"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-in"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"skip"},r.attributes=kt(t[1]),r.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(r.attributes["SKIPPED-SEGMENTS"]=parseInt(r.attributes["SKIPPED-SEGMENTS"],10)),r.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(r.attributes["RECENTLY-REMOVED-DATERANGES"]=r.attributes["RECENTLY-REMOVED-DATERANGES"].split(Qy)),this.trigger("data",r);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part"},r.attributes=kt(t[1]),["DURATION"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["INDEPENDENT","GAP"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),r.attributes.hasOwnProperty("BYTERANGE")&&(r.attributes.byterange=Qa(r.attributes.BYTERANGE)),this.trigger("data",r);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"server-control"},r.attributes=kt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part-inf"},r.attributes=kt(t[1]),["PART-TARGET"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"preload-hint"},r.attributes=kt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(s){if(r.attributes.hasOwnProperty(s)){r.attributes[s]=parseInt(r.attributes[s],10);const a=s==="BYTERANGE-LENGTH"?"length":"offset";r.attributes.byterange=r.attributes.byterange||{},r.attributes.byterange[a]=r.attributes[s],delete r.attributes[s]}}),this.trigger("data",r);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"rendition-report"},r.attributes=kt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseInt(r.attributes[s],10))}),this.trigger("data",r);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"daterange"},r.attributes=kt(t[1]),["ID","CLASS"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=String(r.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=new Date(r.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=/YES/i.test(r.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=r.attributes[a].toString(16))});const s=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in r.attributes){if(!s.test(a))continue;const o=/[0-9A-Fa-f]{6}/g.test(r.attributes[a]),l=/^\d+(\.\d+)?$/.test(r.attributes[a]);r.attributes[a]=o?r.attributes[a].toString(16):l?parseFloat(r.attributes[a]):String(r.attributes[a])}this.trigger("data",r);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){r={type:"tag",tagType:"content-steering"},r.attributes=kt(t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"i-frame-playlist"},r.attributes=kt(t[1]),r.attributes.URI&&(r.uri=r.attributes.URI),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=cc(r.attributes.RESOLUTION)),r.attributes["AVERAGE-BANDWIDTH"]&&(r.attributes["AVERAGE-BANDWIDTH"]=parseInt(r.attributes["AVERAGE-BANDWIDTH"],10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),this.trigger("data",r);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){r={type:"tag",tagType:"define"},r.attributes=kt(t[1]),this.trigger("data",r);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}}addParser({expression:e,customType:t,dataParser:r,segment:n}){typeof r!="function"&&(r=s=>s),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:r(s),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const r=n=>e.test(n)?t(n):n;this.tagMappers.push(r)}}const e0=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Fi=function(i){const e={};return Object.keys(i).forEach(function(t){e[e0(t)]=i[t]}),e},Ja=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:r}=i;if(!e)return;const n="#EXT-X-SERVER-CONTROL",s="holdBack",a="partHoldBack",o=t&&t*3,l=r&&r*2;t&&!e.hasOwnProperty(s)&&(e[s]=o,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[s]<o&&(this.trigger("warn",{message:`${n} clamping HOLD-BACK (${e[s]}) to targetDuration * 3 (${o})`}),e[s]=o),r&&!e.hasOwnProperty(a)&&(e[a]=r*3,this.trigger("info",{message:`${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),r&&e[a]<l&&(this.trigger("warn",{message:`${n} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${l}).`}),e[a]=l)};class t0 extends nu{constructor(e={}){super(),this.lineStream=new Yy,this.parseStream=new Zy,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,r=[];let n={},s,a,o=!1;const l=function(){},d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},f="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let w=0,T=0;const k={};this.on("end",()=>{n.uri||!n.parts&&!n.preloadHints||(!n.map&&s&&(n.map=s),!n.key&&a&&(n.key=a),!n.timeline&&typeof _=="number"&&(n.timeline=_),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(b){let x,O;if(t.manifest.definitions){for(const C in t.manifest.definitions)if(b.uri&&(b.uri=b.uri.replace(`{$${C}}`,t.manifest.definitions[C])),b.attributes)for(const A in b.attributes)typeof b.attributes[A]=="string"&&(b.attributes[A]=b.attributes[A].replace(`{$${C}}`,t.manifest.definitions[C]))}({tag(){({version(){b.version&&(this.manifest.version=b.version)},"allow-cache"(){this.manifest.allowCache=b.allowed,"allowed"in b||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const C={};"length"in b&&(n.byterange=C,C.length=b.length,"offset"in b||(b.offset=w)),"offset"in b&&(n.byterange=C,C.offset=b.offset),w=C.offset+C.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),b.title&&(n.title=b.title),b.duration>0&&(n.duration=b.duration),b.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!b.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(b.attributes.METHOD==="NONE"){a=null;return}if(!b.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(b.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:b.attributes};return}if(b.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:b.attributes.URI};return}if(b.attributes.KEYFORMAT===f){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(b.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(b.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),b.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(b.attributes.KEYID&&b.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:b.attributes.KEYFORMAT,keyId:b.attributes.KEYID.substring(2)},pssh:oh(b.attributes.URI.split(",")[1])};return}b.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:b.attributes.METHOD||"AES-128",uri:b.attributes.URI},typeof b.attributes.IV<"u"&&(a.iv=b.attributes.IV)},"media-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+b.number});return}this.manifest.mediaSequence=b.number},"discontinuity-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+b.number});return}this.manifest.discontinuitySequence=b.number,_=b.number},"playlist-type"(){if(!/VOD|EVENT/.test(b.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+b.playlist});return}this.manifest.playlistType=b.playlistType},map(){s={},b.uri&&(s.uri=b.uri),b.byterange&&(s.byterange=b.byterange),a&&(s.key=a)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!b.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),dt(n.attributes,b.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(b.attributes&&b.attributes.TYPE&&b.attributes["GROUP-ID"]&&b.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const C=this.manifest.mediaGroups[b.attributes.TYPE];C[b.attributes["GROUP-ID"]]=C[b.attributes["GROUP-ID"]]||{},x=C[b.attributes["GROUP-ID"]],O={default:/yes/i.test(b.attributes.DEFAULT)},O.default?O.autoselect=!0:O.autoselect=/yes/i.test(b.attributes.AUTOSELECT),b.attributes.LANGUAGE&&(O.language=b.attributes.LANGUAGE),b.attributes.URI&&(O.uri=b.attributes.URI),b.attributes["INSTREAM-ID"]&&(O.instreamId=b.attributes["INSTREAM-ID"]),b.attributes.CHARACTERISTICS&&(O.characteristics=b.attributes.CHARACTERISTICS),b.attributes.FORCED&&(O.forced=/yes/i.test(b.attributes.FORCED)),x[b.attributes.NAME]=O},discontinuity(){_+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=b.dateTimeString,this.manifest.dateTimeObject=b.dateTimeObject),n.dateTimeString=b.dateTimeString,n.dateTimeObject=b.dateTimeObject;const{lastProgramDateTime:C}=this;this.lastProgramDateTime=new Date(b.dateTimeString).getTime(),C===null&&this.manifest.segments.reduceRight((A,z)=>(z.programDateTime=A-z.duration*1e3,z.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(b.duration)||b.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+b.duration});return}this.manifest.targetDuration=b.duration,Ja.call(this,this.manifest)},start(){if(!b.attributes||isNaN(b.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:b.attributes["TIME-OFFSET"],precise:b.attributes.PRECISE}},"cue-out"(){n.cueOut=b.data},"cue-out-cont"(){n.cueOutCont=b.data},"cue-in"(){n.cueIn=b.data},skip(){this.manifest.skip=Fi(b.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",b.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const C=this.manifest.segments.length,A=Fi(b.attributes);n.parts=n.parts||[],n.parts.push(A),A.byterange&&(A.byterange.hasOwnProperty("offset")||(A.byterange.offset=T),T=A.byterange.offset+A.byterange.length);const z=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${z} for segment #${C}`,b.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((V,U)=>{V.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${U} lacks required attribute(s): LAST-PART`})})},"server-control"(){const C=this.manifest.serverControl=Fi(b.attributes);C.hasOwnProperty("canBlockReload")||(C.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ja.call(this,this.manifest),C.canSkipDateranges&&!C.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const C=this.manifest.segments.length,A=Fi(b.attributes),z=A.type&&A.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(A),A.byterange&&(A.byterange.hasOwnProperty("offset")||(A.byterange.offset=z?T:0,z&&(T=A.byterange.offset+A.byterange.length)));const V=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${V} for segment #${C}`,b.attributes,["TYPE","URI"]),!!A.type)for(let U=0;U<n.preloadHints.length-1;U++){const I=n.preloadHints[U];I.type&&I.type===A.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${V} for segment #${C} has the same TYPE ${A.type} as preload hint #${U}`})}},"rendition-report"(){const C=Fi(b.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(C);const A=this.manifest.renditionReports.length-1,z=["LAST-MSN","URI"];o&&z.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${A}`,b.attributes,z)},"part-inf"(){this.manifest.partInf=Fi(b.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",b.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Ja.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Fi(b.attributes));const C=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${C}`,b.attributes,["ID","START-DATE"]);const A=this.manifest.dateRanges[C];A.endDate&&A.startDate&&new Date(A.endDate)<new Date(A.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),A.duration&&A.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),A.plannedDuration&&A.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const z=!!A.endOnNext;if(z&&!A.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),z&&(A.duration||A.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),A.duration&&A.endDate){const V=A.startDate.getTime()+A.duration*1e3;this.manifest.dateRanges[C].endDate=new Date(V)}if(!k[A.id])k[A.id]=A;else{for(const U in k[A.id])if(A[U]&&JSON.stringify(k[A.id][U])!==JSON.stringify(A[U])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const V=this.manifest.dateRanges.findIndex(U=>U.id===A.id);this.manifest.dateRanges[V]=dt(this.manifest.dateRanges[V],A),k[A.id]=dt(k[A.id],A),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Fi(b.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",b.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const C=(A,z)=>{if(A in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${A}`});return}this.manifest.definitions[A]=z};if("QUERYPARAM"in b.attributes){if("NAME"in b.attributes||"IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const A=this.params.get(b.attributes.QUERYPARAM);if(!A){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${b.attributes.QUERYPARAM}`});return}C(b.attributes.QUERYPARAM,decodeURIComponent(A));return}if("NAME"in b.attributes){if("IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in b.attributes)||typeof b.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${b.attributes.NAME}`});return}C(b.attributes.NAME,b.attributes.VALUE);return}if("IMPORT"in b.attributes){if(!this.mainDefinitions[b.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${b.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}C(b.attributes.IMPORT,this.mainDefinitions[b.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:b.attributes,uri:b.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",b.attributes,["BANDWIDTH","URI"])}}[b.tagType]||l).call(t)},uri(){n.uri=b.uri,r.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=_,s&&(n.map=s),T=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){b.segment?(n.custom=n.custom||{},n.custom[b.customType]=b.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[b.customType]=b.data)}})[b.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,r){const n=[];r.forEach(function(s){t.hasOwnProperty(s)||n.push(s)}),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
37
+ `),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var nr={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},i0=["video","audio","text"],dc=["Video","Audio","Text"],uh=function(i){return i&&i.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,r){var n=("00"+Number(t).toString(16)).slice(-2),s=("00"+Number(r).toString(16)).slice(-2);return"avc1."+n+"00"+s})},ci=function(i){i===void 0&&(i="");var e=i.split(","),t=[];return e.forEach(function(r){r=r.trim();var n;i0.forEach(function(s){var a=nr[s].exec(r.toLowerCase());if(!(!a||a.length<=1)){n=s;var o=r.substring(0,a[1].length),l=r.replace(o,"");t.push({type:o,details:l,mediaType:s})}}),n||t.push({type:r,details:"",mediaType:"unknown"})}),t},r0=function(i,e){if(!i.mediaGroups.AUDIO||!e)return null;var t=i.mediaGroups.AUDIO[e];if(!t)return null;for(var r in t){var n=t[r];if(n.default&&n.playlists)return ci(n.playlists[0].attributes.CODECS)}return null},lh=function(i){return i===void 0&&(i=""),nr.audio.test(i.trim().toLowerCase())},n0=function(i){return i===void 0&&(i=""),nr.text.test(i.trim().toLowerCase())},Pr=function(i){if(!(!i||typeof i!="string")){var e=i.toLowerCase().split(",").map(function(n){return uh(n.trim())}),t="video";e.length===1&&lh(e[0])?t="audio":e.length===1&&n0(e[0])&&(t="application");var r="mp4";return e.every(function(n){return nr.mp4.test(n)})?r="mp4":e.every(function(n){return nr.webm.test(n)})?r="webm":e.every(function(n){return nr.ogg.test(n)})&&(r="ogg"),t+"/"+r+';codecs="'+i+'"'}},vn=function(i,e){return i===void 0&&(i=""),e===void 0&&(e=!1),B.MediaSource&&B.MediaSource.isTypeSupported&&B.MediaSource.isTypeSupported(Pr(i))||e&&B.ManagedMediaSource&&B.ManagedMediaSource.isTypeSupported&&B.ManagedMediaSource.isTypeSupported(Pr(i))||!1},Za=function(i){return i===void 0&&(i=""),i.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<dc.length;t++){var r=dc[t];if(nr["muxer"+r].test(e))return!0}return!1})},hc="mp4a.40.2",s0="avc1.4d400d",a0=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,o0=/^application\/dash\+xml/i,ch=function(i){return a0.test(i)?"hls":o0.test(i)?"dash":i==="application/vnd.videojs.vhs+json"?"vhs-json":null},u0=function(i){return i.toString(2).length},l0=function(i){return Math.ceil(u0(i)/8)},dh=function(i){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer},c0=function(i){return dh(i)},Ie=function(i){return i instanceof Uint8Array?i:(!Array.isArray(i)&&!c0(i)&&!(i instanceof ArrayBuffer)&&(typeof i!="number"||typeof i=="number"&&i!==i?i=0:i=[i]),new Uint8Array(i&&i.buffer||i,i&&i.byteOffset||0,i&&i.byteLength||0))},_t=B.BigInt||Number,ko=[_t("0x1"),_t("0x100"),_t("0x10000"),_t("0x1000000"),_t("0x100000000"),_t("0x10000000000"),_t("0x1000000000000"),_t("0x100000000000000"),_t("0x10000000000000000")];(function(){var i=new Uint16Array([65484]),e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var d0=function(i,e){var t=e===void 0?{}:e,r=t.signed,n=r===void 0?!1:r,s=t.le,a=s===void 0?!1:s;i=Ie(i);var o=a?"reduce":"reduceRight",l=i[o]?i[o]:Array.prototype[o],d=l.call(i,function(_,w,T){var k=a?T:Math.abs(T+1-i.length);return _+_t(w)*ko[k]},_t(0));if(n){var f=ko[i.length]/_t(2)-_t(1);d=_t(d),d>f&&(d-=f,d-=f,d-=_t(2))}return Number(d)},h0=function(i,e){var t={},r=t.le,n=r===void 0?!1:r;(typeof i!="bigint"&&typeof i!="number"||typeof i=="number"&&i!==i)&&(i=0),i=_t(i);for(var s=l0(i),a=new Uint8Array(new ArrayBuffer(s)),o=0;o<s;o++){var l=n?o:Math.abs(o+1-a.length);a[l]=Number(i/ko[o]&_t(255)),i<0&&(a[l]=Math.abs(~a[l]),a[l]-=o===0?1:2)}return a},hh=function(i,e){if(typeof i!="string"&&i&&typeof i.toString=="function"&&(i=i.toString()),typeof i!="string")return new Uint8Array;e||(i=unescape(encodeURIComponent(i)));for(var t=new Uint8Array(i.length),r=0;r<i.length;r++)t[r]=i.charCodeAt(r);return t},p0=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return Ie(e[0]);var r=e.reduce(function(a,o,l){return a+(o.byteLength||o.length)},0),n=new Uint8Array(r),s=0;return e.forEach(function(a){a=Ie(a),n.set(a,s),s+=a.byteLength}),n},rt=function(i,e,t){var r=t===void 0?{}:t,n=r.offset,s=n===void 0?0:n,a=r.mask,o=a===void 0?[]:a;i=Ie(i),e=Ie(e);var l=e.every?e.every:Array.prototype.every;return e.length&&i.length-s>=e.length&&l.call(e,function(d,f){var _=o[f]?o[f]&i[s+f]:i[s+f];return d===_})},f0=function(i,e,t){e.forEach(function(r){for(var n in i.mediaGroups[r])for(var s in i.mediaGroups[r][n]){var a=i.mediaGroups[r][n][s];t(a,r,n,s)}})},dn={},wi={},Ji={},pc;function ia(){if(pc)return Ji;pc=1;function i(s,a,o){if(o===void 0&&(o=Array.prototype),s&&typeof o.find=="function")return o.find.call(s,a);for(var l=0;l<s.length;l++)if(Object.prototype.hasOwnProperty.call(s,l)){var d=s[l];if(a.call(void 0,d,l,s))return d}}function e(s,a){return a===void 0&&(a=Object),a&&typeof a.freeze=="function"?a.freeze(s):s}function t(s,a){if(s===null||typeof s!="object")throw new TypeError("target is not an object");for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(s[o]=a[o]);return s}var r=e({HTML:"text/html",isHTML:function(s){return s===r.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),n=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(s){return s===n.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Ji.assign=t,Ji.find=i,Ji.freeze=e,Ji.MIME_TYPE=r,Ji.NAMESPACE=n,Ji}var fc;function ph(){if(fc)return wi;fc=1;var i=ia(),e=i.find,t=i.NAMESPACE;function r(S){return S!==""}function n(S){return S?S.split(/[\t\n\f\r ]+/).filter(r):[]}function s(S,E){return S.hasOwnProperty(E)||(S[E]=!0),S}function a(S){if(!S)return[];var E=n(S);return Object.keys(E.reduce(s,{}))}function o(S){return function(E){return S&&S.indexOf(E)!==-1}}function l(S,E){for(var $ in S)Object.prototype.hasOwnProperty.call(S,$)&&(E[$]=S[$])}function d(S,E){var $=S.prototype;if(!($ instanceof E)){let Z=function(){};Z.prototype=E.prototype,Z=new Z,l($,Z),S.prototype=$=Z}$.constructor!=S&&(typeof S!="function"&&console.error("unknown Class:"+S),$.constructor=S)}var f={},_=f.ELEMENT_NODE=1,w=f.ATTRIBUTE_NODE=2,T=f.TEXT_NODE=3,k=f.CDATA_SECTION_NODE=4,b=f.ENTITY_REFERENCE_NODE=5,x=f.ENTITY_NODE=6,O=f.PROCESSING_INSTRUCTION_NODE=7,C=f.COMMENT_NODE=8,A=f.DOCUMENT_NODE=9,z=f.DOCUMENT_TYPE_NODE=10,V=f.DOCUMENT_FRAGMENT_NODE=11,U=f.NOTATION_NODE=12,I={},L={};I.INDEX_SIZE_ERR=(L[1]="Index size error",1),I.DOMSTRING_SIZE_ERR=(L[2]="DOMString size error",2);var v=I.HIERARCHY_REQUEST_ERR=(L[3]="Hierarchy request error",3);I.WRONG_DOCUMENT_ERR=(L[4]="Wrong document",4),I.INVALID_CHARACTER_ERR=(L[5]="Invalid character",5),I.NO_DATA_ALLOWED_ERR=(L[6]="No data allowed",6),I.NO_MODIFICATION_ALLOWED_ERR=(L[7]="No modification allowed",7);var y=I.NOT_FOUND_ERR=(L[8]="Not found",8);I.NOT_SUPPORTED_ERR=(L[9]="Not supported",9);var M=I.INUSE_ATTRIBUTE_ERR=(L[10]="Attribute in use",10);I.INVALID_STATE_ERR=(L[11]="Invalid state",11),I.SYNTAX_ERR=(L[12]="Syntax error",12),I.INVALID_MODIFICATION_ERR=(L[13]="Invalid modification",13),I.NAMESPACE_ERR=(L[14]="Invalid namespace",14),I.INVALID_ACCESS_ERR=(L[15]="Invalid access",15);function F(S,E){if(E instanceof Error)var $=E;else $=this,Error.call(this,L[S]),this.message=L[S],Error.captureStackTrace&&Error.captureStackTrace(this,F);return $.code=S,E&&(this.message=this.message+": "+E),$}F.prototype=Error.prototype,l(I,F);function H(){}H.prototype={length:0,item:function(S){return S>=0&&S<this.length?this[S]:null},toString:function(S,E){for(var $=[],Z=0;Z<this.length;Z++)Pi(this[Z],$,S,E);return $.join("")},filter:function(S){return Array.prototype.filter.call(this,S)},indexOf:function(S){return Array.prototype.indexOf.call(this,S)}};function X(S,E){this._node=S,this._refresh=E,G(this)}function G(S){var E=S._node._inc||S._node.ownerDocument._inc;if(S._inc!==E){var $=S._refresh(S._node);if(Vn(S,"length",$.length),!S.$$length||$.length<S.$$length)for(var Z=$.length;Z in S;Z++)Object.prototype.hasOwnProperty.call(S,Z)&&delete S[Z];l($,S),S._inc=E}}X.prototype.item=function(S){return G(this),this[S]||null},d(X,H);function te(){}function N(S,E){for(var $=S.length;$--;)if(S[$]===E)return $}function j(S,E,$,Z){if(Z?E[N(E,Z)]=$:E[E.length++]=$,S){$.ownerElement=S;var pe=S.ownerDocument;pe&&(Z&&Fe(pe,S,Z),fe(pe,S,$))}}function Y(S,E,$){var Z=N(E,$);if(Z>=0){for(var pe=E.length-1;Z<pe;)E[Z]=E[++Z];if(E.length=pe,S){var Oe=S.ownerDocument;Oe&&(Fe(Oe,S,$),$.ownerElement=null)}}else throw new F(y,new Error(S.tagName+"@"+$))}te.prototype={length:0,item:H.prototype.item,getNamedItem:function(S){for(var E=this.length;E--;){var $=this[E];if($.nodeName==S)return $}},setNamedItem:function(S){var E=S.ownerElement;if(E&&E!=this._ownerElement)throw new F(M);var $=this.getNamedItem(S.nodeName);return j(this._ownerElement,this,S,$),$},setNamedItemNS:function(S){var E=S.ownerElement,$;if(E&&E!=this._ownerElement)throw new F(M);return $=this.getNamedItemNS(S.namespaceURI,S.localName),j(this._ownerElement,this,S,$),$},removeNamedItem:function(S){var E=this.getNamedItem(S);return Y(this._ownerElement,this,E),E},removeNamedItemNS:function(S,E){var $=this.getNamedItemNS(S,E);return Y(this._ownerElement,this,$),$},getNamedItemNS:function(S,E){for(var $=this.length;$--;){var Z=this[$];if(Z.localName==E&&Z.namespaceURI==S)return Z}return null}};function Q(){}Q.prototype={hasFeature:function(S,E){return!0},createDocument:function(S,E,$){var Z=new he;if(Z.implementation=this,Z.childNodes=new H,Z.doctype=$||null,$&&Z.appendChild($),E){var pe=Z.createElementNS(S,E);Z.appendChild(pe)}return Z},createDocumentType:function(S,E,$){var Z=new Yt;return Z.name=S,Z.nodeName=S,Z.publicId=E||"",Z.systemId=$||"",Z}};function ee(){}ee.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(S,E){return Se(this,S,E)},replaceChild:function(S,E){Se(this,S,E,se),E&&this.removeChild(E)},removeChild:function(S){return oe(this,S)},appendChild:function(S){return this.insertBefore(S,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(S){return Kr(this.ownerDocument||this,this,S)},normalize:function(){for(var S=this.firstChild;S;){var E=S.nextSibling;E&&E.nodeType==T&&S.nodeType==T?(this.removeChild(E),S.appendData(E.data)):(S.normalize(),S=E)}},isSupported:function(S,E){return this.ownerDocument.implementation.hasFeature(S,E)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(S){for(var E=this;E;){var $=E._nsMap;if($){for(var Z in $)if(Object.prototype.hasOwnProperty.call($,Z)&&$[Z]===S)return Z}E=E.nodeType==w?E.ownerDocument:E.parentNode}return null},lookupNamespaceURI:function(S){for(var E=this;E;){var $=E._nsMap;if($&&Object.prototype.hasOwnProperty.call($,S))return $[S];E=E.nodeType==w?E.ownerDocument:E.parentNode}return null},isDefaultNamespace:function(S){var E=this.lookupPrefix(S);return E==null}};function ue(S){return S=="<"&&"&lt;"||S==">"&&"&gt;"||S=="&"&&"&amp;"||S=='"'&&"&quot;"||"&#"+S.charCodeAt()+";"}l(f,ee),l(f,ee.prototype);function le(S,E){if(E(S))return!0;if(S=S.firstChild)do if(le(S,E))return!0;while(S=S.nextSibling)}function he(){this.ownerDocument=this}function fe(S,E,$){S&&S._inc++;var Z=$.namespaceURI;Z===t.XMLNS&&(E._nsMap[$.prefix?$.localName:""]=$.value)}function Fe(S,E,$,Z){S&&S._inc++;var pe=$.namespaceURI;pe===t.XMLNS&&delete E._nsMap[$.prefix?$.localName:""]}function xe(S,E,$){if(S&&S._inc){S._inc++;var Z=E.childNodes;if($)Z[Z.length++]=$;else{for(var pe=E.firstChild,Oe=0;pe;)Z[Oe++]=pe,pe=pe.nextSibling;Z.length=Oe,delete Z[Z.length]}}}function oe(S,E){var $=E.previousSibling,Z=E.nextSibling;return $?$.nextSibling=Z:S.firstChild=Z,Z?Z.previousSibling=$:S.lastChild=$,E.parentNode=null,E.previousSibling=null,E.nextSibling=null,xe(S.ownerDocument,S),E}function ge(S){return S&&(S.nodeType===ee.DOCUMENT_NODE||S.nodeType===ee.DOCUMENT_FRAGMENT_NODE||S.nodeType===ee.ELEMENT_NODE)}function Ee(S){return S&&(Me(S)||Ge(S)||Ce(S)||S.nodeType===ee.DOCUMENT_FRAGMENT_NODE||S.nodeType===ee.COMMENT_NODE||S.nodeType===ee.PROCESSING_INSTRUCTION_NODE)}function Ce(S){return S&&S.nodeType===ee.DOCUMENT_TYPE_NODE}function Me(S){return S&&S.nodeType===ee.ELEMENT_NODE}function Ge(S){return S&&S.nodeType===ee.TEXT_NODE}function ye(S,E){var $=S.childNodes||[];if(e($,Me)||Ce(E))return!1;var Z=e($,Ce);return!(E&&Z&&$.indexOf(Z)>$.indexOf(E))}function be(S,E){var $=S.childNodes||[];function Z(Oe){return Me(Oe)&&Oe!==E}if(e($,Z))return!1;var pe=e($,Ce);return!(E&&pe&&$.indexOf(pe)>$.indexOf(E))}function Te(S,E,$){if(!ge(S))throw new F(v,"Unexpected parent node type "+S.nodeType);if($&&$.parentNode!==S)throw new F(y,"child not in parent");if(!Ee(E)||Ce(E)&&S.nodeType!==ee.DOCUMENT_NODE)throw new F(v,"Unexpected node type "+E.nodeType+" for parent node type "+S.nodeType)}function _e(S,E,$){var Z=S.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ee.DOCUMENT_FRAGMENT_NODE){var Oe=pe.filter(Me);if(Oe.length>1||e(pe,Ge))throw new F(v,"More than one element or text in fragment");if(Oe.length===1&&!ye(S,$))throw new F(v,"Element in fragment can not be inserted before doctype")}if(Me(E)&&!ye(S,$))throw new F(v,"Only one element can be added and only after doctype");if(Ce(E)){if(e(Z,Ce))throw new F(v,"Only one doctype is allowed");var Je=e(Z,Me);if($&&Z.indexOf(Je)<Z.indexOf($))throw new F(v,"Doctype can only be inserted before an element");if(!$&&Je)throw new F(v,"Doctype can not be appended since element is present")}}function se(S,E,$){var Z=S.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ee.DOCUMENT_FRAGMENT_NODE){var Oe=pe.filter(Me);if(Oe.length>1||e(pe,Ge))throw new F(v,"More than one element or text in fragment");if(Oe.length===1&&!be(S,$))throw new F(v,"Element in fragment can not be inserted before doctype")}if(Me(E)&&!be(S,$))throw new F(v,"Only one element can be added and only after doctype");if(Ce(E)){if(e(Z,function(Xe){return Ce(Xe)&&Xe!==$}))throw new F(v,"Only one doctype is allowed");var Je=e(Z,Me);if($&&Z.indexOf(Je)<Z.indexOf($))throw new F(v,"Doctype can only be inserted before an element")}}function Se(S,E,$,Z){Te(S,E,$),S.nodeType===ee.DOCUMENT_NODE&&(Z||_e)(S,E,$);var pe=E.parentNode;if(pe&&pe.removeChild(E),E.nodeType===V){var Oe=E.firstChild;if(Oe==null)return E;var Je=E.lastChild}else Oe=Je=E;var Xe=$?$.previousSibling:S.lastChild;Oe.previousSibling=Xe,Je.nextSibling=$,Xe?Xe.nextSibling=Oe:S.firstChild=Oe,$==null?S.lastChild=Je:$.previousSibling=Je;do{Oe.parentNode=S;var Qt=S.ownerDocument||S;ne(Oe,Qt)}while(Oe!==Je&&(Oe=Oe.nextSibling));return xe(S.ownerDocument||S,S),E.nodeType==V&&(E.firstChild=E.lastChild=null),E}function ne(S,E){if(S.ownerDocument!==E){if(S.ownerDocument=E,S.nodeType===_&&S.attributes)for(var $=0;$<S.attributes.length;$++){var Z=S.attributes.item($);Z&&(Z.ownerDocument=E)}for(var pe=S.firstChild;pe;)ne(pe,E),pe=pe.nextSibling}}function de(S,E){E.parentNode&&E.parentNode.removeChild(E),E.parentNode=S,E.previousSibling=S.lastChild,E.nextSibling=null,E.previousSibling?E.previousSibling.nextSibling=E:S.firstChild=E,S.lastChild=E,xe(S.ownerDocument,S,E);var $=S.ownerDocument||S;return ne(E,$),E}he.prototype={nodeName:"#document",nodeType:A,doctype:null,documentElement:null,_inc:1,insertBefore:function(S,E){if(S.nodeType==V){for(var $=S.firstChild;$;){var Z=$.nextSibling;this.insertBefore($,E),$=Z}return S}return Se(this,S,E),ne(S,this),this.documentElement===null&&S.nodeType===_&&(this.documentElement=S),S},removeChild:function(S){return this.documentElement==S&&(this.documentElement=null),oe(this,S)},replaceChild:function(S,E){Se(this,S,E,se),ne(S,this),E&&this.removeChild(E),Me(S)&&(this.documentElement=S)},importNode:function(S,E){return Hn(this,S,E)},getElementById:function(S){var E=null;return le(this.documentElement,function($){if($.nodeType==_&&$.getAttribute("id")==S)return E=$,!0}),E},getElementsByClassName:function(S){var E=a(S);return new X(this,function($){var Z=[];return E.length>0&&le($.documentElement,function(pe){if(pe!==$&&pe.nodeType===_){var Oe=pe.getAttribute("class");if(Oe){var Je=S===Oe;if(!Je){var Xe=a(Oe);Je=E.every(o(Xe))}Je&&Z.push(pe)}}}),Z})},createElement:function(S){var E=new we;E.ownerDocument=this,E.nodeName=S,E.tagName=S,E.localName=S,E.childNodes=new H;var $=E.attributes=new te;return $._ownerElement=E,E},createDocumentFragment:function(){var S=new Ve;return S.ownerDocument=this,S.childNodes=new H,S},createTextNode:function(S){var E=new bt;return E.ownerDocument=this,E.appendData(S),E},createComment:function(S){var E=new je;return E.ownerDocument=this,E.appendData(S),E},createCDATASection:function(S){var E=new ft;return E.ownerDocument=this,E.appendData(S),E},createProcessingInstruction:function(S,E){var $=new Gr;return $.ownerDocument=this,$.tagName=$.nodeName=$.target=S,$.nodeValue=$.data=E,$},createAttribute:function(S){var E=new qe;return E.ownerDocument=this,E.name=S,E.nodeName=S,E.localName=S,E.specified=!0,E},createEntityReference:function(S){var E=new hr;return E.ownerDocument=this,E.nodeName=S,E},createElementNS:function(S,E){var $=new we,Z=E.split(":"),pe=$.attributes=new te;return $.childNodes=new H,$.ownerDocument=this,$.nodeName=E,$.tagName=E,$.namespaceURI=S,Z.length==2?($.prefix=Z[0],$.localName=Z[1]):$.localName=E,pe._ownerElement=$,$},createAttributeNS:function(S,E){var $=new qe,Z=E.split(":");return $.ownerDocument=this,$.nodeName=E,$.name=E,$.namespaceURI=S,$.specified=!0,Z.length==2?($.prefix=Z[0],$.localName=Z[1]):$.localName=E,$}},d(he,ee);function we(){this._nsMap={}}we.prototype={nodeType:_,hasAttribute:function(S){return this.getAttributeNode(S)!=null},getAttribute:function(S){var E=this.getAttributeNode(S);return E&&E.value||""},getAttributeNode:function(S){return this.attributes.getNamedItem(S)},setAttribute:function(S,E){var $=this.ownerDocument.createAttribute(S);$.value=$.nodeValue=""+E,this.setAttributeNode($)},removeAttribute:function(S){var E=this.getAttributeNode(S);E&&this.removeAttributeNode(E)},appendChild:function(S){return S.nodeType===V?this.insertBefore(S,null):de(this,S)},setAttributeNode:function(S){return this.attributes.setNamedItem(S)},setAttributeNodeNS:function(S){return this.attributes.setNamedItemNS(S)},removeAttributeNode:function(S){return this.attributes.removeNamedItem(S.nodeName)},removeAttributeNS:function(S,E){var $=this.getAttributeNodeNS(S,E);$&&this.removeAttributeNode($)},hasAttributeNS:function(S,E){return this.getAttributeNodeNS(S,E)!=null},getAttributeNS:function(S,E){var $=this.getAttributeNodeNS(S,E);return $&&$.value||""},setAttributeNS:function(S,E,$){var Z=this.ownerDocument.createAttributeNS(S,E);Z.value=Z.nodeValue=""+$,this.setAttributeNode(Z)},getAttributeNodeNS:function(S,E){return this.attributes.getNamedItemNS(S,E)},getElementsByTagName:function(S){return new X(this,function(E){var $=[];return le(E,function(Z){Z!==E&&Z.nodeType==_&&(S==="*"||Z.tagName==S)&&$.push(Z)}),$})},getElementsByTagNameNS:function(S,E){return new X(this,function($){var Z=[];return le($,function(pe){pe!==$&&pe.nodeType===_&&(S==="*"||pe.namespaceURI===S)&&(E==="*"||pe.localName==E)&&Z.push(pe)}),Z})}},he.prototype.getElementsByTagName=we.prototype.getElementsByTagName,he.prototype.getElementsByTagNameNS=we.prototype.getElementsByTagNameNS,d(we,ee);function qe(){}qe.prototype.nodeType=w,d(qe,ee);function He(){}He.prototype={data:"",substringData:function(S,E){return this.data.substring(S,S+E)},appendData:function(S){S=this.data+S,this.nodeValue=this.data=S,this.length=S.length},insertData:function(S,E){this.replaceData(S,0,E)},appendChild:function(S){throw new Error(L[v])},deleteData:function(S,E){this.replaceData(S,E,"")},replaceData:function(S,E,$){var Z=this.data.substring(0,S),pe=this.data.substring(S+E);$=Z+$+pe,this.nodeValue=this.data=$,this.length=$.length}},d(He,ee);function bt(){}bt.prototype={nodeName:"#text",nodeType:T,splitText:function(S){var E=this.data,$=E.substring(S);E=E.substring(0,S),this.data=this.nodeValue=E,this.length=E.length;var Z=this.ownerDocument.createTextNode($);return this.parentNode&&this.parentNode.insertBefore(Z,this.nextSibling),Z}},d(bt,He);function je(){}je.prototype={nodeName:"#comment",nodeType:C},d(je,He);function ft(){}ft.prototype={nodeName:"#cdata-section",nodeType:k},d(ft,He);function Yt(){}Yt.prototype.nodeType=z,d(Yt,ee);function si(){}si.prototype.nodeType=U,d(si,ee);function dr(){}dr.prototype.nodeType=x,d(dr,ee);function hr(){}hr.prototype.nodeType=b,d(hr,ee);function Ve(){}Ve.prototype.nodeName="#document-fragment",Ve.prototype.nodeType=V,d(Ve,ee);function Gr(){}Gr.prototype.nodeType=O,d(Gr,ee);function zi(){}zi.prototype.serializeToString=function(S,E,$){return jn.call(S,E,$)},ee.prototype.toString=jn;function jn(S,E){var $=[],Z=this.nodeType==9&&this.documentElement||this,pe=Z.prefix,Oe=Z.namespaceURI;if(Oe&&pe==null){var pe=Z.lookupPrefix(Oe);if(pe==null)var Je=[{namespace:Oe,prefix:null}]}return Pi(this,$,S,E,Je),$.join("")}function $n(S,E,$){var Z=S.prefix||"",pe=S.namespaceURI;if(!pe||Z==="xml"&&pe===t.XML||pe===t.XMLNS)return!1;for(var Oe=$.length;Oe--;){var Je=$[Oe];if(Je.prefix===Z)return Je.namespace!==pe}return!0}function Xr(S,E,$){S.push(" ",E,'="',$.replace(/[<>&"\t\n\r]/g,ue),'"')}function Pi(S,E,$,Z,pe){if(pe||(pe=[]),Z)if(S=Z(S),S){if(typeof S=="string"){E.push(S);return}}else return;switch(S.nodeType){case _:var Oe=S.attributes,Je=Oe.length,Xe=S.firstChild,Qt=S.tagName;$=t.isHTML(S.namespaceURI)||$;var ai=Qt;if(!$&&!S.prefix&&S.namespaceURI){for(var jt,Li=0;Li<Oe.length;Li++)if(Oe.item(Li).name==="xmlns"){jt=Oe.item(Li).value;break}if(!jt)for(var $t=pe.length-1;$t>=0;$t--){var ut=pe[$t];if(ut.prefix===""&&ut.namespace===S.namespaceURI){jt=ut.namespace;break}}if(jt!==S.namespaceURI)for(var $t=pe.length-1;$t>=0;$t--){var ut=pe[$t];if(ut.namespace===S.namespaceURI){ut.prefix&&(ai=ut.prefix+":"+Qt);break}}}E.push("<",ai);for(var Ci=0;Ci<Je;Ci++){var Ht=Oe.item(Ci);Ht.prefix=="xmlns"?pe.push({prefix:Ht.localName,namespace:Ht.value}):Ht.nodeName=="xmlns"&&pe.push({prefix:"",namespace:Ht.value})}for(var Ci=0;Ci<Je;Ci++){var Ht=Oe.item(Ci);if($n(Ht,$,pe)){var Vt=Ht.prefix||"",Et=Ht.namespaceURI;Xr(E,Vt?"xmlns:"+Vt:"xmlns",Et),pe.push({prefix:Vt,namespace:Et})}Pi(Ht,E,$,Z,pe)}if(Qt===ai&&$n(S,$,pe)){var Vt=S.prefix||"",Et=S.namespaceURI;Xr(E,Vt?"xmlns:"+Vt:"xmlns",Et),pe.push({prefix:Vt,namespace:Et})}if(Xe||$&&!/^(?:meta|link|img|br|hr|input)$/i.test(Qt)){if(E.push(">"),$&&/^script$/i.test(Qt))for(;Xe;)Xe.data?E.push(Xe.data):Pi(Xe,E,$,Z,pe.slice()),Xe=Xe.nextSibling;else for(;Xe;)Pi(Xe,E,$,Z,pe.slice()),Xe=Xe.nextSibling;E.push("</",ai,">")}else E.push("/>");return;case A:case V:for(var Xe=S.firstChild;Xe;)Pi(Xe,E,$,Z,pe.slice()),Xe=Xe.nextSibling;return;case w:return Xr(E,S.name,S.value);case T:return E.push(S.data.replace(/[<&>]/g,ue));case k:return E.push("<![CDATA[",S.data,"]]>");case C:return E.push("<!--",S.data,"-->");case z:var Wi=S.publicId,$e=S.systemId;if(E.push("<!DOCTYPE ",S.name),Wi)E.push(" PUBLIC ",Wi),$e&&$e!="."&&E.push(" ",$e),E.push(">");else if($e&&$e!=".")E.push(" SYSTEM ",$e,">");else{var zn=S.internalSubset;zn&&E.push(" [",zn,"]"),E.push(">")}return;case O:return E.push("<?",S.target," ",S.data,"?>");case b:return E.push("&",S.nodeName,";");default:E.push("??",S.nodeName)}}function Hn(S,E,$){var Z;switch(E.nodeType){case _:Z=E.cloneNode(!1),Z.ownerDocument=S;case V:break;case w:$=!0;break}if(Z||(Z=E.cloneNode(!1)),Z.ownerDocument=S,Z.parentNode=null,$)for(var pe=E.firstChild;pe;)Z.appendChild(Hn(S,pe,$)),pe=pe.nextSibling;return Z}function Kr(S,E,$){var Z=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var Oe=E[pe];typeof Oe!="object"&&Oe!=Z[pe]&&(Z[pe]=Oe)}switch(E.childNodes&&(Z.childNodes=new H),Z.ownerDocument=S,Z.nodeType){case _:var Je=E.attributes,Xe=Z.attributes=new te,Qt=Je.length;Xe._ownerElement=Z;for(var ai=0;ai<Qt;ai++)Z.setAttributeNode(Kr(S,Je.item(ai),!0));break;case w:$=!0}if($)for(var jt=E.firstChild;jt;)Z.appendChild(Kr(S,jt,$)),jt=jt.nextSibling;return Z}function Vn(S,E,$){S[E]=$}try{if(Object.defineProperty){let S=function(E){switch(E.nodeType){case _:case V:var $=[];for(E=E.firstChild;E;)E.nodeType!==7&&E.nodeType!==8&&$.push(S(E)),E=E.nextSibling;return $.join("");default:return E.nodeValue}};Object.defineProperty(X.prototype,"length",{get:function(){return G(this),this.$$length}}),Object.defineProperty(ee.prototype,"textContent",{get:function(){return S(this)},set:function(E){switch(this.nodeType){case _:case V:for(;this.firstChild;)this.removeChild(this.firstChild);(E||String(E))&&this.appendChild(this.ownerDocument.createTextNode(E));break;default:this.data=E,this.value=E,this.nodeValue=E}}}),Vn=function(E,$,Z){E["$$"+$]=Z}}}catch{}return wi.DocumentType=Yt,wi.DOMException=F,wi.DOMImplementation=Q,wi.Element=we,wi.Node=ee,wi.NodeList=H,wi.XMLSerializer=zi,wi}var hn={},gc={},mc;function g0(){return mc||(mc=1,(function(i){var e=ia().freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
38
+ `,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),i.entityMap=i.HTML_ENTITIES})(gc)),gc}var _s={},yc;function m0(){if(yc)return _s;yc=1;var i=ia().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),r=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),n=0,s=1,a=2,o=3,l=4,d=5,f=6,_=7;function w(v,y){this.message=v,this.locator=y,Error.captureStackTrace&&Error.captureStackTrace(this,w)}w.prototype=new Error,w.prototype.name=w.name;function T(){}T.prototype={parse:function(v,y,M){var F=this.domBuilder;F.startDocument(),z(y,y={}),k(v,y,M,F,this.errorHandler),F.endDocument()}};function k(v,y,M,F,H){function X(de){if(de>65535){de-=65536;var we=55296+(de>>10),qe=56320+(de&1023);return String.fromCharCode(we,qe)}else return String.fromCharCode(de)}function G(de){var we=de.slice(1,-1);return Object.hasOwnProperty.call(M,we)?M[we]:we.charAt(0)==="#"?X(parseInt(we.substr(1).replace("x","0x"))):(H.error("entity not found:"+de),de)}function te(de){if(de>he){var we=v.substring(he,de).replace(/&#?\w+;/g,G);ee&&N(he),F.characters(we,0,de-he),he=de}}function N(de,we){for(;de>=Y&&(we=Q.exec(v));)j=we.index,Y=j+we[0].length,ee.lineNumber++;ee.columnNumber=de-j+1}for(var j=0,Y=0,Q=/.*(?:\r\n?|\n)|.*$/g,ee=F.locator,ue=[{currentNSMap:y}],le={},he=0;;){try{var fe=v.indexOf("<",he);if(fe<0){if(!v.substr(he).match(/^\s*$/)){var Fe=F.doc,xe=Fe.createTextNode(v.substr(he));Fe.appendChild(xe),F.currentElement=xe}return}switch(fe>he&&te(fe),v.charAt(fe+1)){case"/":var Te=v.indexOf(">",fe+3),oe=v.substring(fe+2,Te).replace(/[ \t\n\r]+$/g,""),ge=ue.pop();Te<0?(oe=v.substring(fe+2).replace(/[\s<].*/,""),H.error("end tag name: "+oe+" is not complete:"+ge.tagName),Te=fe+1+oe.length):oe.match(/\s</)&&(oe=oe.replace(/[\s<].*/,""),H.error("end tag name: "+oe+" maybe not complete"),Te=fe+1+oe.length);var Ee=ge.localNSMap,Ce=ge.tagName==oe,Me=Ce||ge.tagName&&ge.tagName.toLowerCase()==oe.toLowerCase();if(Me){if(F.endElement(ge.uri,ge.localName,oe),Ee)for(var Ge in Ee)Object.prototype.hasOwnProperty.call(Ee,Ge)&&F.endPrefixMapping(Ge);Ce||H.fatalError("end tag name: "+oe+" is not match the current start tagName:"+ge.tagName)}else ue.push(ge);Te++;break;case"?":ee&&N(fe),Te=U(v,fe,F);break;case"!":ee&&N(fe),Te=V(v,fe,F,H);break;default:ee&&N(fe);var ye=new I,be=ue[ue.length-1].currentNSMap,Te=x(v,fe,ye,be,G,H),_e=ye.length;if(!ye.closed&&A(v,Te,ye.tagName,le)&&(ye.closed=!0,M.nbsp||H.warning("unclosed xml attribute")),ee&&_e){for(var se=b(ee,{}),Se=0;Se<_e;Se++){var ne=ye[Se];N(ne.offset),ne.locator=b(ee,{})}F.locator=se,O(ye,F,be)&&ue.push(ye),F.locator=ee}else O(ye,F,be)&&ue.push(ye);i.isHTML(ye.uri)&&!ye.closed?Te=C(v,Te,ye.tagName,G,F):Te++}}catch(de){if(de instanceof w)throw de;H.error("element parse error: "+de),Te=-1}Te>he?he=Te:te(Math.max(fe,he)+1)}}function b(v,y){return y.lineNumber=v.lineNumber,y.columnNumber=v.columnNumber,y}function x(v,y,M,F,H,X){function G(ee,ue,le){M.attributeNames.hasOwnProperty(ee)&&X.fatalError("Attribute "+ee+" redefined"),M.addValue(ee,ue.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,H),le)}for(var te,N,j=++y,Y=n;;){var Q=v.charAt(j);switch(Q){case"=":if(Y===s)te=v.slice(y,j),Y=o;else if(Y===a)Y=o;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(Y===o||Y===s)if(Y===s&&(X.warning('attribute value must after "="'),te=v.slice(y,j)),y=j+1,j=v.indexOf(Q,y),j>0)N=v.slice(y,j),G(te,N,y-1),Y=d;else throw new Error("attribute value no end '"+Q+"' match");else if(Y==l)N=v.slice(y,j),G(te,N,y),X.warning('attribute "'+te+'" missed start quot('+Q+")!!"),y=j+1,Y=d;else throw new Error('attribute value must after "="');break;case"/":switch(Y){case n:M.setTagName(v.slice(y,j));case d:case f:case _:Y=_,M.closed=!0;case l:case s:break;case a:M.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return X.error("unexpected end of input"),Y==n&&M.setTagName(v.slice(y,j)),j;case">":switch(Y){case n:M.setTagName(v.slice(y,j));case d:case f:case _:break;case l:case s:N=v.slice(y,j),N.slice(-1)==="/"&&(M.closed=!0,N=N.slice(0,-1));case a:Y===a&&(N=te),Y==l?(X.warning('attribute "'+N+'" missed quot(")!'),G(te,N,y)):((!i.isHTML(F[""])||!N.match(/^(?:disabled|checked|selected)$/i))&&X.warning('attribute "'+N+'" missed value!! "'+N+'" instead!!'),G(N,N,y));break;case o:throw new Error("attribute value missed!!")}return j;case"\x80":Q=" ";default:if(Q<=" ")switch(Y){case n:M.setTagName(v.slice(y,j)),Y=f;break;case s:te=v.slice(y,j),Y=a;break;case l:var N=v.slice(y,j);X.warning('attribute "'+N+'" missed quot(")!!'),G(te,N,y);case d:Y=f;break}else switch(Y){case a:M.tagName,(!i.isHTML(F[""])||!te.match(/^(?:disabled|checked|selected)$/i))&&X.warning('attribute "'+te+'" missed value!! "'+te+'" instead2!!'),G(te,te,y),y=j,Y=s;break;case d:X.warning('attribute space is required"'+te+'"!!');case f:Y=s,y=j;break;case o:Y=l,y=j;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}j++}}function O(v,y,M){for(var F=v.tagName,H=null,X=v.length;X--;){var G=v[X],te=G.qName,N=G.value,ee=te.indexOf(":");if(ee>0)var j=G.prefix=te.slice(0,ee),Y=te.slice(ee+1),Q=j==="xmlns"&&Y;else Y=te,j=null,Q=te==="xmlns"&&"";G.localName=Y,Q!==!1&&(H==null&&(H={},z(M,M={})),M[Q]=H[Q]=N,G.uri=i.XMLNS,y.startPrefixMapping(Q,N))}for(var X=v.length;X--;){G=v[X];var j=G.prefix;j&&(j==="xml"&&(G.uri=i.XML),j!=="xmlns"&&(G.uri=M[j||""]))}var ee=F.indexOf(":");ee>0?(j=v.prefix=F.slice(0,ee),Y=v.localName=F.slice(ee+1)):(j=null,Y=v.localName=F);var ue=v.uri=M[j||""];if(y.startElement(ue,Y,F,v),v.closed){if(y.endElement(ue,Y,F),H)for(j in H)Object.prototype.hasOwnProperty.call(H,j)&&y.endPrefixMapping(j)}else return v.currentNSMap=M,v.localNSMap=H,!0}function C(v,y,M,F,H){if(/^(?:script|textarea)$/i.test(M)){var X=v.indexOf("</"+M+">",y),G=v.substring(y+1,X);if(/[&<]/.test(G))return/^script$/i.test(M)?(H.characters(G,0,G.length),X):(G=G.replace(/&#?\w+;/g,F),H.characters(G,0,G.length),X)}return y+1}function A(v,y,M,F){var H=F[M];return H==null&&(H=v.lastIndexOf("</"+M+">"),H<y&&(H=v.lastIndexOf("</"+M)),F[M]=H),H<y}function z(v,y){for(var M in v)Object.prototype.hasOwnProperty.call(v,M)&&(y[M]=v[M])}function V(v,y,M,F){var H=v.charAt(y+2);switch(H){case"-":if(v.charAt(y+3)==="-"){var X=v.indexOf("-->",y+4);return X>y?(M.comment(v,y+4,X-y-4),X+3):(F.error("Unclosed comment"),-1)}else return-1;default:if(v.substr(y+3,6)=="CDATA["){var X=v.indexOf("]]>",y+9);return M.startCDATA(),M.characters(v,y+9,X-y-9),M.endCDATA(),X+3}var G=L(v,y),te=G.length;if(te>1&&/!doctype/i.test(G[0][0])){var N=G[1][0],j=!1,Y=!1;te>3&&(/^public$/i.test(G[2][0])?(j=G[3][0],Y=te>4&&G[4][0]):/^system$/i.test(G[2][0])&&(Y=G[3][0]));var Q=G[te-1];return M.startDTD(N,j,Y),M.endDTD(),Q.index+Q[0].length}}return-1}function U(v,y,M){var F=v.indexOf("?>",y);if(F){var H=v.substring(y,F).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return H?(H[0].length,M.processingInstruction(H[1],H[2]),F+2):-1}return-1}function I(){this.attributeNames={}}I.prototype={setTagName:function(v){if(!r.test(v))throw new Error("invalid tagName:"+v);this.tagName=v},addValue:function(v,y,M){if(!r.test(v))throw new Error("invalid attribute:"+v);this.attributeNames[v]=this.length,this[this.length++]={qName:v,value:y,offset:M}},length:0,getLocalName:function(v){return this[v].localName},getLocator:function(v){return this[v].locator},getQName:function(v){return this[v].qName},getURI:function(v){return this[v].uri},getValue:function(v){return this[v].value}};function L(v,y){var M,F=[],H=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(H.lastIndex=y,H.exec(v);M=H.exec(v);)if(F.push(M),M[1])return F}return _s.XMLReader=T,_s.ParseError=w,_s}var _c;function y0(){if(_c)return hn;_c=1;var i=ia(),e=ph(),t=g0(),r=m0(),n=e.DOMImplementation,s=i.NAMESPACE,a=r.ParseError,o=r.XMLReader;function l(x){return x.replace(/\r[\n\u0085]/g,`
39
+ `).replace(/[\r\u0085\u2028]/g,`
40
+ `)}function d(x){this.options=x||{locator:{}}}d.prototype.parseFromString=function(x,O){var C=this.options,A=new o,z=C.domBuilder||new _,V=C.errorHandler,U=C.locator,I=C.xmlns||{},L=/\/x?html?$/.test(O),v=L?t.HTML_ENTITIES:t.XML_ENTITIES;U&&z.setDocumentLocator(U),A.errorHandler=f(V,z,U),A.domBuilder=C.domBuilder||z,L&&(I[""]=s.HTML),I.xml=I.xml||s.XML;var y=C.normalizeLineEndings||l;return x&&typeof x=="string"?A.parse(y(x),I,v):A.errorHandler.error("invalid doc source"),z.doc};function f(x,O,C){if(!x){if(O instanceof _)return O;x=O}var A={},z=x instanceof Function;C=C||{};function V(U){var I=x[U];!I&&z&&(I=x.length==2?function(L){x(U,L)}:x),A[U]=I&&function(L){I("[xmldom "+U+"] "+L+T(C))}||function(){}}return V("warning"),V("error"),V("fatalError"),A}function _(){this.cdata=!1}function w(x,O){O.lineNumber=x.lineNumber,O.columnNumber=x.columnNumber}_.prototype={startDocument:function(){this.doc=new n().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(x,O,C,A){var z=this.doc,V=z.createElementNS(x,C||O),U=A.length;b(this,V),this.currentElement=V,this.locator&&w(this.locator,V);for(var I=0;I<U;I++){var x=A.getURI(I),L=A.getValue(I),C=A.getQName(I),v=z.createAttributeNS(x,C);this.locator&&w(A.getLocator(I),v),v.value=v.nodeValue=L,V.setAttributeNode(v)}},endElement:function(x,O,C){var A=this.currentElement;A.tagName,this.currentElement=A.parentNode},startPrefixMapping:function(x,O){},endPrefixMapping:function(x){},processingInstruction:function(x,O){var C=this.doc.createProcessingInstruction(x,O);this.locator&&w(this.locator,C),b(this,C)},ignorableWhitespace:function(x,O,C){},characters:function(x,O,C){if(x=k.apply(this,arguments),x){if(this.cdata)var A=this.doc.createCDATASection(x);else var A=this.doc.createTextNode(x);this.currentElement?this.currentElement.appendChild(A):/^\s*$/.test(x)&&this.doc.appendChild(A),this.locator&&w(this.locator,A)}},skippedEntity:function(x){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(x){(this.locator=x)&&(x.lineNumber=0)},comment:function(x,O,C){x=k.apply(this,arguments);var A=this.doc.createComment(x);this.locator&&w(this.locator,A),b(this,A)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(x,O,C){var A=this.doc.implementation;if(A&&A.createDocumentType){var z=A.createDocumentType(x,O,C);this.locator&&w(this.locator,z),b(this,z),this.doc.doctype=z}},warning:function(x){console.warn("[xmldom warning] "+x,T(this.locator))},error:function(x){console.error("[xmldom error] "+x,T(this.locator))},fatalError:function(x){throw new a(x,this.locator)}};function T(x){if(x)return`
41
+ @`+(x.systemId||"")+"#[line:"+x.lineNumber+",col:"+x.columnNumber+"]"}function k(x,O,C){return typeof x=="string"?x.substr(O,C):x.length>=O+C||O?new java.lang.String(x,O,C)+"":x}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(x){_.prototype[x]=function(){return null}});function b(x,O){x.currentElement?x.currentElement.appendChild(O):x.doc.appendChild(O)}return hn.__DOMHandler=_,hn.normalizeLineEndings=l,hn.DOMParser=d,hn}var bc;function _0(){if(bc)return dn;bc=1;var i=ph();return dn.DOMImplementation=i.DOMImplementation,dn.XMLSerializer=i.XMLSerializer,dn.DOMParser=y0().DOMParser,dn}var b0=_0();/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const vc=i=>!!i&&typeof i=="object",yt=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):vc(e[r])&&vc(t[r])?e[r]=yt(e[r],t[r]):e[r]=t[r]}),e),{}),fh=i=>Object.keys(i).map(e=>i[e]),v0=(i,e)=>{const t=[];for(let r=i;r<e;r++)t.push(r);return t},Lr=i=>i.reduce((e,t)=>e.concat(t),[]),gh=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},T0=(i,e)=>i.reduce((t,r,n)=>(r[e]&&t.push(n),t),[]),S0=(i,e)=>fh(i.reduce((t,r)=>(r.forEach(n=>{t[e(n)]=n}),t),{}));var Or={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const An=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const n={uri:e,resolvedUri:ta(i||"",e)};if(t||r){const s=(t||r).split("-");let a=B.BigInt?B.BigInt(s[0]):parseInt(s[0],10),o=B.BigInt?B.BigInt(s[1]):parseInt(s[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o));let l;typeof o=="bigint"||typeof a=="bigint"?l=B.BigInt(o)-B.BigInt(a)+B.BigInt(1):l=o-a+1,typeof l=="bigint"&&l<Number.MAX_SAFE_INTEGER&&(l=Number(l)),n.byterange={length:l,offset:a}}return n},C0=i=>{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=B.BigInt(i.offset)+B.BigInt(i.length)-B.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},Tc=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),E0={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:n}=i,s=Tc(i.endNumber),a=e/t;return typeof s=="number"?{start:0,end:s}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:n=1,duration:s,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=i,d=Tc(i.endNumber),f=(e+t)/1e3,_=r+a,w=f+o-_,T=Math.ceil(w*n/s),k=Math.floor((f-_-l)*n/s),b=Math.floor((f-_)*n/s);return{start:Math.max(0,k),end:typeof d=="number"?d:Math.min(T,b)}}},w0=i=>e=>{const{duration:t,timescale:r=1,periodStart:n,startNumber:s=1}=i;return{number:s+e,duration:t/r,timeline:n,time:e*t}},su=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:n,sourceDuration:s}=i,{start:a,end:o}=E0[e](i),l=v0(a,o).map(w0(i));if(e==="static"){const d=l.length-1,f=typeof n=="number"?n:s;l[d].duration=f-t/r*d}return l},mh=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:n="",periodStart:s,presentationTime:a,number:o=0,duration:l}=i;if(!e)throw new Error(Or.NO_BASE_URL);const d=An({baseUrl:e,source:t.sourceURL,range:t.range}),f=An({baseUrl:e,source:e,indexRange:n});if(f.map=d,l){const _=su(i);_.length&&(f.duration=_[0].duration,f.timeline=_[0].timeline)}else r&&(f.duration=r,f.timeline=s);return f.presentationTime=a||s,f.number=o,[f]},au=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,n=i.sidx.duration,s=i.timeline||0,a=i.sidx.byterange,o=a.offset+a.length,l=e.timescale,d=e.references.filter(x=>x.referenceType!==1),f=[],_=i.endList?"static":"dynamic",w=i.sidx.timeline;let T=w,k=i.mediaSequence||0,b;typeof e.firstOffset=="bigint"?b=B.BigInt(o)+e.firstOffset:b=o+e.firstOffset;for(let x=0;x<d.length;x++){const O=e.references[x],C=O.referencedSize,A=O.subsegmentDuration;let z;typeof b=="bigint"?z=b+B.BigInt(C)-B.BigInt(1):z=b+C-1;const V=`${b}-${z}`,U=mh({baseUrl:t,timescale:l,timeline:s,periodStart:w,presentationTime:T,number:k,duration:A,sourceDuration:n,indexRange:V,type:_})[0];r&&(U.map=r),f.push(U),typeof b=="bigint"?b+=B.BigInt(C):b+=C,T+=A/l,k++}return i.segments=f,i},x0=["AUDIO","SUBTITLES"],k0=1/60,yh=i=>S0(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),A0=(i,e)=>{for(let t=0;t<i.length;t++)if(i[t].attributes.NAME===e)return i[t];return null},Sc=i=>{let e=[];return f0(i,x0,(t,r,n,s)=>{e=e.concat(t.playlists||[])}),e},Cc=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},D0=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:o}){return o===r.timeline});const n=A0(i,r.attributes.NAME);if(!n||r.sidx)return;const s=r.segments[0],a=n.segments.findIndex(function(o){return Math.abs(o.presentationTime-s.presentationTime)<k0});if(a===-1){Cc({playlist:r,mediaSequence:n.mediaSequence+n.segments.length}),r.segments[0].discontinuity=!0,r.discontinuityStarts.unshift(0),(!n.segments.length&&r.timeline>n.timeline||n.segments.length&&r.timeline>n.segments[n.segments.length-1].timeline)&&r.discontinuitySequence--;return}n.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),Cc({playlist:r,mediaSequence:n.segments[a].number})})},I0=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(Sc(i)),r=e.playlists.concat(Sc(e));return e.timelineStarts=yh([i.timelineStarts,e.timelineStarts]),D0({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},ra=i=>i&&i.uri+"-"+C0(i.byterange),eo=i=>{const e=i.reduce(function(r,n){return r[n.attributes.baseUrl]||(r[n.attributes.baseUrl]=[]),r[n.attributes.baseUrl].push(n),r},{});let t=[];return Object.values(e).forEach(r=>{const n=fh(r.reduce((s,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return s[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),s[o].segments.push(...a.segments)),a.attributes.contentProtection&&(s[o].attributes.contentProtection=a.attributes.contentProtection)):(s[o]=a,s[o].attributes.timelineStarts=[]),s[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),s},{}));t=t.concat(n)}),t.map(r=>(r.discontinuityStarts=T0(r.segments||[],"discontinuity"),r))},ou=(i,e)=>{const t=ra(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&au(i,r,i.sidx.resolvedUri),i},P0=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=ou(i[t],e);return i},L0=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:n,discontinuityStarts:s},a)=>{const o={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:n,discontinuityStarts:s,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(o.contentProtection=i.contentProtection),i.serviceLocation&&(o.attributes.serviceLocation=i.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},O0=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const s={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(s.CODECS=i.codecs);const a={attributes:s,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:n,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},N0=(i,e={},t=!1)=>{let r;const n=i.reduce((s,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let d=a.attributes.label||"main";if(l&&!a.attributes.label){const _=o?` (${o})`:"";d=`${a.attributes.lang}${_}`}s[d]||(s[d]={language:l,autoselect:!0,default:o==="main",playlists:[],uri:""});const f=ou(L0(a,t),e);return s[d].playlists.push(f),typeof r>"u"&&o==="main"&&(r=a,r.default=!0),s},{});if(!r){const s=Object.keys(n)[0];n[s].default=!0}return n},F0=(i,e={})=>i.reduce((t,r)=>{const n=r.attributes.label||r.attributes.lang||"text",s=r.attributes.lang||"und";return t[n]||(t[n]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(ou(O0(r),e)),t},{}),R0=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:n,language:s}=r;e[s]={autoselect:!1,default:!1,instreamId:n,language:s},r.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[s].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[s]["3D"]=r["3D"])}),e),{}),M0=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const n={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(n.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(n.contentProtection=i.contentProtection),i.serviceLocation&&(n.attributes.serviceLocation=i.serviceLocation),t&&(n.sidx=t),n},B0=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",U0=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",q0=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",j0=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,n)=>{r.number=n})})},Ec=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],$0=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:n,eventStream:s})=>{if(!i.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:d}=i[0].attributes,f=eo(i.filter(B0)).map(M0),_=eo(i.filter(U0)),w=eo(i.filter(q0)),T=i.map(z=>z.attributes.captionServices).filter(Boolean),k={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:P0(f,r)};d>=0&&(k.minimumUpdatePeriod=d*1e3),e&&(k.locations=e),t&&(k.contentSteering=t),o==="dynamic"&&(k.suggestedPresentationDelay=l),s&&s.length>0&&(k.eventStream=s);const b=k.playlists.length===0,x=_.length?N0(_,r,b):null,O=w.length?F0(w,r):null,C=f.concat(Ec(x),Ec(O)),A=C.map(({timelineStarts:z})=>z);return k.timelineStarts=yh(A),j0(C,k.timelineStarts),x&&(k.mediaGroups.AUDIO.audio=x),O&&(k.mediaGroups.SUBTITLES.subs=O),T.length&&(k.mediaGroups["CLOSED-CAPTIONS"].cc=R0(T)),n?I0({oldManifest:n,newManifest:k}):k},H0=(i,e,t)=>{const{NOW:r,clientOffset:n,availabilityStartTime:s,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=i,d=(r+n)/1e3,f=s+o,_=d+l-f;return Math.ceil((_*a-e)/t)},_h=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:n="",sourceDuration:s,timescale:a=1,startNumber:o=1,periodStart:l}=i,d=[];let f=-1;for(let _=0;_<e.length;_++){const w=e[_],T=w.d,k=w.r||0,b=w.t||0;f<0&&(f=b),b&&b>f&&(f=b);let x;if(k<0){const A=_+1;A===e.length?t==="dynamic"&&r>0&&n.indexOf("$Number$")>0?x=H0(i,f,T):x=(s*a-f)/T:x=(e[A].t-f)/T}else x=k+1;const O=o+d.length+x;let C=o+d.length;for(;C<O;)d.push({number:C,duration:T/a,time:f,timeline:l}),f+=T,C++}return d},V0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,z0=i=>(e,t,r,n)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const s=""+i[t];return t==="RepresentationID"||(r?n=parseInt(n,10):n=1,s.length>=n)?s:`${new Array(n-s.length+1).join("0")}${s}`},wc=(i,e)=>i.replace(V0,z0(e)),W0=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?su(i):_h(i,e),G0=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,n=An({baseUrl:i.baseUrl,source:wc(r.sourceURL,t),range:r.range});return W0(i,e).map(s=>{t.Number=s.number,t.Time=s.time;const a=wc(i.media||"",t),o=i.timescale||1,l=i.presentationTimeOffset||0,d=i.periodStart+(s.time-l)/o;return{uri:a,timeline:s.timeline,duration:s.duration,resolvedUri:ta(i.baseUrl||"",a),map:n,number:s.number,presentationTime:d}})},X0=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,n=An({baseUrl:t,source:r.sourceURL,range:r.range}),s=An({baseUrl:t,source:e.media,range:e.mediaRange});return s.map=n,s},K0=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:n}=i;if(!t&&!e||t&&e)throw new Error(Or.SEGMENT_TIME_UNSPECIFIED);const s=r.map(o=>X0(i,o));let a;return t&&(a=su(i)),e&&(a=_h(i,e)),a.map((o,l)=>{if(s[l]){const d=s[l],f=i.timescale||1,_=i.presentationTimeOffset||0;return d.timeline=o.timeline,d.duration=o.duration,d.number=o.number,d.presentationTime=n+(o.time-_)/f,d}}).filter(o=>o)},Y0=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=G0,t=yt(i,e.template)):e.base?(r=mh,t=yt(i,e.base)):e.list&&(r=K0,t=yt(i,e.list));const n={attributes:i};if(!r)return n;const s=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else s.length?t.duration=s.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return n.attributes=t,n.segments=s,e.base&&t.indexRange&&(n.sidx=s[0],n.segments=[]),n},Q0=i=>i.map(Y0),st=(i,e)=>gh(i.childNodes).filter(({tagName:t})=>t===e),Nn=i=>i.textContent.trim(),J0=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),mr=i=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!e)return 0;const[t,r,n,s,a,o]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(r||0)*2592e3+parseFloat(n||0)*86400+parseFloat(s||0)*3600+parseFloat(a||0)*60+parseFloat(o||0)},Z0=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),xc={mediaPresentationDuration(i){return mr(i)},availabilityStartTime(i){return Z0(i)/1e3},minimumUpdatePeriod(i){return mr(i)},suggestedPresentationDelay(i){return mr(i)},type(i){return i},timeShiftBufferDepth(i){return mr(i)},start(i){return mr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return J0(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?mr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},ht=i=>i&&i.attributes?gh(i.attributes).reduce((e,t)=>{const r=xc[t.name]||xc.DEFAULT;return e[t.name]=r(t.value),e},{}):{},e2={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},na=(i,e)=>e.length?Lr(i.map(function(t){return e.map(function(r){const n=Nn(r),s=ta(t.baseUrl,n),a=yt(ht(r),{baseUrl:s});return s!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,uu=i=>{const e=st(i,"SegmentTemplate")[0],t=st(i,"SegmentList")[0],r=t&&st(t,"SegmentURL").map(_=>yt({tag:"SegmentURL"},ht(_))),n=st(i,"SegmentBase")[0],s=t||e,a=s&&st(s,"SegmentTimeline")[0],o=t||n||e,l=o&&st(o,"Initialization")[0],d=e&&ht(e);d&&l?d.initialization=l&&ht(l):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});const f={template:d,segmentTimeline:a&&st(a,"S").map(_=>ht(_)),list:t&&yt(ht(t),{segmentUrls:r,initialization:ht(l)}),base:n&&yt(ht(n),{initialization:ht(l)})};return Object.keys(f).forEach(_=>{f[_]||delete f[_]}),f},t2=(i,e,t)=>r=>{const n=st(r,"BaseURL"),s=na(e,n),a=yt(i,ht(r)),o=uu(r);return s.map(l=>({segmentInfo:yt(t,o),attributes:yt(a,l)}))},i2=i=>i.reduce((e,t)=>{const r=ht(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const n=e2[r.schemeIdUri];if(n){e[n]={attributes:r};const s=st(t,"cenc:pssh")[0];if(s){const a=Nn(s);e[n].pssh=a&&oh(a)}}return e},{}),r2=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{let t,r;return r=e,/^CC\d=/.test(e)?[t,r]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:r}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[r,n=""]=e.split("=");t.channel=r,t.language=e,n.split(",").forEach(s=>{const[a,o]=s.split(":");a==="lang"?t.language=o:a==="er"?t.easyReader=Number(o):a==="war"?t.aspectRatio=Number(o):a==="3D"&&(t["3D"]=Number(o))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},n2=i=>Lr(st(i.node,"EventStream").map(e=>{const t=ht(e),r=t.schemeIdUri;return st(e,"Event").map(n=>{const s=ht(n),a=s.presentationTime||0,o=t.timescale||1,l=s.duration||0,d=a/o+i.attributes.start;return{schemeIdUri:r,value:t.value,id:s.id,start:d,end:d+l/o,messageData:Nn(n)||s.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),s2=(i,e,t)=>r=>{const n=ht(r),s=na(e,st(r,"BaseURL")),a=st(r,"Role")[0],o={role:ht(a)};let l=yt(i,n,o);const d=st(r,"Accessibility")[0],f=r2(ht(d));f&&(l=yt(l,{captionServices:f}));const _=st(r,"Label")[0];if(_&&_.childNodes.length){const x=_.childNodes[0].nodeValue.trim();l=yt(l,{label:x})}const w=i2(st(r,"ContentProtection"));Object.keys(w).length&&(l=yt(l,{contentProtection:w}));const T=uu(r),k=st(r,"Representation"),b=yt(t,T);return Lr(k.map(t2(l,s,b)))},a2=(i,e)=>(t,r)=>{const n=na(e,st(t.node,"BaseURL")),s=yt(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(s.periodDuration=t.attributes.duration);const a=st(t.node,"AdaptationSet"),o=uu(t.node);return Lr(a.map(s2(s,n,o)))},o2=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=yt({serverURL:Nn(i[0])},ht(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},u2=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,l2=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:n=0,eventHandler:s=function(){}}=e,a=st(i,"Period");if(!a.length)throw new Error(Or.INVALID_NUMBER_OF_PERIOD);const o=st(i,"Location"),l=ht(i),d=na([{baseUrl:t}],st(i,"BaseURL")),f=st(i,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=r,l.clientOffset=n,o.length&&(l.locations=o.map(Nn));const _=[];return a.forEach((w,T)=>{const k=ht(w),b=_[T-1];k.start=u2({attributes:k,priorPeriodAttributes:b?b.attributes:null,mpdType:l.type}),_.push({node:w,attributes:k})}),{locations:l.locations,contentSteeringInfo:o2(f,s),representationInfo:Lr(_.map(a2(l,d))),eventStream:Lr(_.map(n2))}},bh=i=>{if(i==="")throw new Error(Or.DASH_EMPTY_MANIFEST);const e=new b0.DOMParser;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Or.DASH_INVALID_XML);return r},c2=i=>{const e=st(i,"UTCTiming")[0];if(!e)return null;const t=ht(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Or.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},d2=(i,e={})=>{const t=l2(bh(i),e),r=Q0(t.representationInfo);return $0({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},h2=i=>c2(bh(i));var to,kc;function p2(){if(kc)return to;kc=1;var i=Math.pow(2,32),e=function(t){var r=new DataView(t.buffer,t.byteOffset,t.byteLength),n;return r.getBigUint64?(n=r.getBigUint64(0),n<Number.MAX_SAFE_INTEGER?Number(n):n):r.getUint32(0)*i+r.getUint32(4)};return to={getUint64:e,MAX_UINT32:i},to}var io,Ac;function f2(){if(Ac)return io;Ac=1;var i=p2().getUint64,e=function(t){var r=new DataView(t.buffer,t.byteOffset,t.byteLength),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:r.getUint32(4),timescale:r.getUint32(8)},s=12;n.version===0?(n.earliestPresentationTime=r.getUint32(s),n.firstOffset=r.getUint32(s+4),s+=8):(n.earliestPresentationTime=i(t.subarray(s)),n.firstOffset=i(t.subarray(s+8)),s+=16),s+=2;var a=r.getUint16(s);for(s+=2;a>0;s+=12,a--)n.references.push({referenceType:(t[s]&128)>>>7,referencedSize:r.getUint32(s)&2147483647,subsegmentDuration:r.getUint32(s+4),startsWithSap:!!(t[s+8]&128),sapType:(t[s+8]&112)>>>4,sapDeltaTime:r.getUint32(s+8)&268435455});return n};return io=e,io}var g2=f2();const m2=On(g2);var y2=Ie([73,68,51]),_2=function(i,e){e===void 0&&(e=0),i=Ie(i);var t=i[e+5],r=i[e+6]<<21|i[e+7]<<14|i[e+8]<<7|i[e+9],n=(t&16)>>4;return n?r+20:r+10},mn=function i(e,t){return t===void 0&&(t=0),e=Ie(e),e.length-t<10||!rt(e,y2,{offset:t})?t:(t+=_2(e,t),i(e,t))},Dc=function(i){return typeof i=="string"?hh(i):i},b2=function(i){return Array.isArray(i)?i.map(function(e){return Dc(e)}):[Dc(i)]},v2=function i(e,t,r){r===void 0&&(r=!1),t=b2(t),e=Ie(e);var n=[];if(!t.length)return n;for(var s=0;s<e.length;){var a=(e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3])>>>0,o=e.subarray(s+4,s+8);if(a===0)break;var l=s+a;if(l>e.length){if(r)break;l=e.length}var d=e.subarray(s+8,l);rt(o,t[0])&&(t.length===1?n.push(d):n.push.apply(n,i(d,t.slice(1),r))),s=l}return n},bs={EBML:Ie([26,69,223,163]),DocType:Ie([66,130]),Segment:Ie([24,83,128,103]),SegmentInfo:Ie([21,73,169,102]),Tracks:Ie([22,84,174,107]),Track:Ie([174]),TrackNumber:Ie([215]),DefaultDuration:Ie([35,227,131]),TrackEntry:Ie([174]),TrackType:Ie([131]),FlagDefault:Ie([136]),CodecID:Ie([134]),CodecPrivate:Ie([99,162]),VideoTrack:Ie([224]),AudioTrack:Ie([225]),Cluster:Ie([31,67,182,117]),Timestamp:Ie([231]),TimestampScale:Ie([42,215,177]),BlockGroup:Ie([160]),BlockDuration:Ie([155]),Block:Ie([161]),SimpleBlock:Ie([163])},Ao=[128,64,32,16,8,4,2,1],T2=function(i){for(var e=1,t=0;t<Ao.length&&!(i&Ao[t]);t++)e++;return e},As=function(i,e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1);var n=T2(i[e]),s=i.subarray(e,e+n);return t&&(s=Array.prototype.slice.call(i,e,e+n),s[0]^=Ao[n-1]),{length:n,value:d0(s,{signed:r}),bytes:s}},Ic=function i(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return i(t)}):typeof e=="number"?h0(e):e},S2=function(i){return Array.isArray(i)?i.map(function(e){return Ic(e)}):[Ic(i)]},C2=function i(e,t,r){if(r>=t.length)return t.length;var n=As(t,r,!1);if(rt(e.bytes,n.bytes))return r;var s=As(t,r+n.length);return i(e,t,r+s.length+s.value+n.length)},Pc=function i(e,t){t=S2(t),e=Ie(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var s=As(e,n,!1),a=As(e,n+s.length),o=n+s.length+a.length;a.value===127&&(a.value=C2(s,e,o),a.value!==e.length&&(a.value-=o));var l=o+a.value>e.length?e.length:o+a.value,d=e.subarray(o,l);rt(t[0],s.bytes)&&(t.length===1?r.push(d):r=r.concat(i(d,t.slice(1))));var f=s.length+a.length+d.length;n+=f}return r},E2=Ie([0,0,0,1]),w2=Ie([0,0,1]),x2=Ie([0,0,3]),k2=function(i){for(var e=[],t=1;t<i.length-2;)rt(i.subarray(t,t+3),x2)&&(e.push(t+2),t++),t++;if(e.length===0)return i;var r=i.length-e.length,n=new Uint8Array(r),s=0;for(t=0;t<r;s++,t++)s===e[0]&&(s++,e.shift()),n[t]=i[s];return n},vh=function(i,e,t,r){i=Ie(i),t=[].concat(t);for(var n=0,s,a=0;n<i.length&&(a<r||s);){var o=void 0;if(rt(i.subarray(n),E2)?o=4:rt(i.subarray(n),w2)&&(o=3),!o){n++;continue}if(a++,s)return k2(i.subarray(s,n));var l=void 0;e==="h264"?l=i[n+o]&31:e==="h265"&&(l=i[n+o]>>1&63),t.indexOf(l)!==-1&&(s=n+o),n+=o+(e==="h264"?1:2)}return i.subarray(0,0)},A2=function(i,e,t){return vh(i,"h264",e,t)},D2=function(i,e,t){return vh(i,"h265",e,t)},At={webm:Ie([119,101,98,109]),matroska:Ie([109,97,116,114,111,115,107,97]),flac:Ie([102,76,97,67]),ogg:Ie([79,103,103,83]),ac3:Ie([11,119]),riff:Ie([82,73,70,70]),avi:Ie([65,86,73]),wav:Ie([87,65,86,69]),"3gp":Ie([102,116,121,112,51,103]),mp4:Ie([102,116,121,112]),fmp4:Ie([115,116,121,112]),mov:Ie([102,116,121,112,113,116]),moov:Ie([109,111,111,118]),moof:Ie([109,111,111,102])},Nr={aac:function(i){var e=mn(i);return rt(i,[255,16],{offset:e,mask:[255,22]})},mp3:function(i){var e=mn(i);return rt(i,[255,2],{offset:e,mask:[255,6]})},webm:function(i){var e=Pc(i,[bs.EBML,bs.DocType])[0];return rt(e,At.webm)},mkv:function(i){var e=Pc(i,[bs.EBML,bs.DocType])[0];return rt(e,At.matroska)},mp4:function(i){if(Nr["3gp"](i)||Nr.mov(i))return!1;if(rt(i,At.mp4,{offset:4})||rt(i,At.fmp4,{offset:4})||rt(i,At.moof,{offset:4})||rt(i,At.moov,{offset:4}))return!0},mov:function(i){return rt(i,At.mov,{offset:4})},"3gp":function(i){return rt(i,At["3gp"],{offset:4})},ac3:function(i){var e=mn(i);return rt(i,At.ac3,{offset:e})},ts:function(i){if(i.length<189&&i.length>=1)return i[0]===71;for(var e=0;e+188<i.length&&e<188;){if(i[e]===71&&i[e+188]===71)return!0;e+=1}return!1},flac:function(i){var e=mn(i);return rt(i,At.flac,{offset:e})},ogg:function(i){return rt(i,At.ogg)},avi:function(i){return rt(i,At.riff)&&rt(i,At.avi,{offset:8})},wav:function(i){return rt(i,At.riff)&&rt(i,At.wav,{offset:8})},h264:function(i){return A2(i,7,3).length},h265:function(i){return D2(i,[32,33],3).length}},Do=Object.keys(Nr).filter(function(i){return i!=="ts"&&i!=="h264"&&i!=="h265"}).concat(["ts","h264","h265"]);Do.forEach(function(i){var e=Nr[i];Nr[i]=function(t){return e(Ie(t))}});var I2=Nr,lu=function(i){i=Ie(i);for(var e=0;e<Do.length;e++){var t=Do[e];if(I2[t](i))return t}return""},P2=function(i){return v2(i,["moof"]).length>0},ro,Lc;function L2(){if(Lc)return ro;Lc=1;var i=9e4,e,t,r,n,s,a,o;return e=function(l){return l*i},t=function(l,d){return l*d},r=function(l){return l/i},n=function(l,d){return l/d},s=function(l,d){return e(n(l,d))},a=function(l,d){return t(r(l),d)},o=function(l,d,f){return r(f?l:l-d)},ro={ONE_SECOND_IN_TS:i,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:r,audioTsToSeconds:n,audioTsToVideoTs:s,videoTsToAudioTs:a,metadataTsToSeconds:o},ro}var ir=L2();/**
42
+ * @license
43
+ * Video.js 8.23.4 <http://videojs.com/>
44
+ * Copyright Brightcove, Inc. <https://www.brightcove.com/>
45
+ * Available under Apache License Version 2.0
46
+ * <https://github.com/videojs/video.js/blob/main/LICENSE>
47
+ *
48
+ * Includes vtt.js <https://github.com/mozilla/vtt.js>
49
+ * Available under Apache License Version 2.0
50
+ * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
51
+ */var Io="8.23.4";const xi={},$i=function(i,e){return xi[i]=xi[i]||[],e&&(xi[i]=xi[i].concat(e)),xi[i]},O2=function(i,e){$i(i,e)},Th=function(i,e){const t=$i(i).indexOf(e);return t<=-1?!1:(xi[i]=xi[i].slice(),xi[i].splice(t,1),!0)},N2=function(i,e){$i(i,[].concat(e).map(t=>{const r=(...n)=>(Th(i,r),t(...n));return r}))},Ds={prefixed:!0},Es=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Oc=Es[0];let yn;for(let i=0;i<Es.length;i++)if(Es[i][1]in ce){yn=Es[i];break}if(yn){for(let i=0;i<yn.length;i++)Ds[Oc[i]]=yn[i];Ds.prefixed=yn[0]!==Oc[0]}let Lt=[];const F2=(i,e,t)=>(r,n,s)=>{const a=e.levels[n],o=new RegExp(`^(${a})$`);let l=i;if(r!=="log"&&s.unshift(r.toUpperCase()+":"),t&&(l=`%c${i}`,s.unshift(t)),s.unshift(l+":"),Lt){Lt.push([].concat(s));const f=Lt.length-1e3;Lt.splice(0,f>0?f:0)}if(!B.console)return;let d=B.console[r];!d&&r==="debug"&&(d=B.console.info||B.console.log),!(!d||!a||!o.test(r))&&d[Array.isArray(s)?"apply":"call"](B.console,s)};function Po(i,e=":",t=""){let r="info",n;function s(...a){n("log",r,a)}return n=F2(i,s,t),s.createLogger=(a,o,l)=>{const d=o!==void 0?o:e,f=l!==void 0?l:t,_=`${i} ${d} ${a}`;return Po(_,d,f)},s.createNewLogger=(a,o,l)=>Po(a,o,l),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},s.level=a=>{if(typeof a=="string"){if(!s.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},s.history=()=>Lt?[].concat(Lt):[],s.history.filter=a=>(Lt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),s.history.clear=()=>{Lt&&(Lt.length=0)},s.history.disable=()=>{Lt!==null&&(Lt.length=0,Lt=null)},s.history.enable=()=>{Lt===null&&(Lt=[])},s.error=(...a)=>n("error",r,a),s.warn=(...a)=>n("warn",r,a),s.debug=(...a)=>n("debug",r,a),s}const Ue=Po("VIDEOJS"),Sh=Ue.createLogger,R2=Object.prototype.toString,Ch=function(i){return vi(i)?Object.keys(i):[]};function Sr(i,e){Ch(i).forEach(t=>e(i[t],t))}function Eh(i,e,t=0){return Ch(i).reduce((r,n)=>e(r,i[n],n),t)}function vi(i){return!!i&&typeof i=="object"}function Fr(i){return vi(i)&&R2.call(i)==="[object Object]"&&i.constructor===Object}function Qe(...i){const e={};return i.forEach(t=>{t&&Sr(t,(r,n)=>{if(!Fr(r)){e[n]=r;return}Fr(e[n])||(e[n]={}),e[n]=Qe(e[n],r)})}),e}function wh(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function sa(i,e,t,r=!0){const n=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),s={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return r&&(s.set=n),Object.defineProperty(i,e,s)}var M2=Object.freeze({__proto__:null,each:Sr,reduce:Eh,isObject:vi,isPlain:Fr,merge:Qe,values:wh,defineLazyProperty:sa});let cu=!1,xh=null,ri=!1,kh,Ah=!1,Cr=!1,Er=!1,Ti=!1,du=null,aa=null;const B2=!!(B.cast&&B.cast.framework&&B.cast.framework.CastReceiverContext);let Dh=null,Is=!1,oa=!1,Ps=!1,ua=!1,Ls=!1,Os=!1,Ns=!1;const Dn=!!(qr()&&("ontouchstart"in B||B.navigator.maxTouchPoints||B.DocumentTouch&&B.document instanceof B.DocumentTouch)),Ri=B.navigator&&B.navigator.userAgentData;Ri&&Ri.platform&&Ri.brands&&(ri=Ri.platform==="Android",Cr=!!Ri.brands.find(i=>i.brand==="Microsoft Edge"),Er=!!Ri.brands.find(i=>i.brand==="Chromium"),Ti=!Cr&&Er,du=aa=(Ri.brands.find(i=>i.brand==="Chromium")||{}).version||null,oa=Ri.platform==="Windows");if(!Er){const i=B.navigator&&B.navigator.userAgent||"";cu=/iPod/i.test(i),xh=(function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),ri=/Android/i.test(i),kh=(function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null})(),Ah=/Firefox/i.test(i),Cr=/Edg/i.test(i),Er=/Chrome/i.test(i)||/CriOS/i.test(i),Ti=!Cr&&Er,du=aa=(function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),Dh=(function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t})(),Ls=/Tizen/i.test(i),Os=/Web0S/i.test(i),Ns=Ls||Os,Is=/Safari/i.test(i)&&!Ti&&!ri&&!Cr&&!Ns,oa=/Windows/i.test(i),Ps=/iPad/i.test(i)||Is&&Dn&&!/iPhone/i.test(i),ua=/iPhone/i.test(i)&&!Ps}const vt=ua||Ps||cu,la=(Is||vt)&&!Ti;var Ih=Object.freeze({__proto__:null,get IS_IPOD(){return cu},get IOS_VERSION(){return xh},get IS_ANDROID(){return ri},get ANDROID_VERSION(){return kh},get IS_FIREFOX(){return Ah},get IS_EDGE(){return Cr},get IS_CHROMIUM(){return Er},get IS_CHROME(){return Ti},get CHROMIUM_VERSION(){return du},get CHROME_VERSION(){return aa},IS_CHROMECAST_RECEIVER:B2,get IE_VERSION(){return Dh},get IS_SAFARI(){return Is},get IS_WINDOWS(){return oa},get IS_IPAD(){return Ps},get IS_IPHONE(){return ua},get IS_TIZEN(){return Ls},get IS_WEBOS(){return Os},get IS_SMART_TV(){return Ns},TOUCH_ENABLED:Dn,IS_IOS:vt,IS_ANY_SAFARI:la});function Nc(i){return typeof i=="string"&&!!i.trim()}function U2(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function qr(){return ce===B.document}function jr(i){return vi(i)&&i.nodeType===1}function Ph(){try{return B.parent!==B.self}catch{return!0}}function Lh(i){return function(e,t){if(!Nc(e))return ce[i](null);Nc(t)&&(t=ce.querySelector(t));const r=jr(t)?t:ce;return r[i]&&r[i](e)}}function Le(i="div",e={},t={},r){const n=ce.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(s){const a=e[s];s==="textContent"?Vi(n,a):(n[s]!==a||s==="tabIndex")&&(n[s]=a)}),Object.getOwnPropertyNames(t).forEach(function(s){n.setAttribute(s,t[s])}),r&&hu(n,r),n}function Vi(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function Lo(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Tn(i,e){return U2(e),i.classList.contains(e)}function sr(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function ca(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(Ue.warn("removeClass was called with an element that doesn't exist"),null)}function Oh(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function Nh(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r>"u"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function qi(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let n=r.length-1;n>=0;n--){const s=r[n].name;let a=r[n].value;t.includes(s)&&(a=a!==null),e[s]=a}}return e}function Fh(i,e){return i.getAttribute(e)}function Rr(i,e,t){i.setAttribute(e,t)}function da(i,e){i.removeAttribute(e)}function Rh(){ce.body.focus(),ce.onselectstart=function(){return!1}}function Mh(){ce.onselectstart=function(){return!0}}function Mr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat(Br(i,"height"))),t.width||(t.width=parseFloat(Br(i,"width"))),t}}function In(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,n=0;for(;i.offsetParent&&i!==ce[Ds.fullscreenElement];)r+=i.offsetLeft,n+=i.offsetTop,i=i.offsetParent;return{left:r,top:n,width:e,height:t}}function ha(i,e){const t={x:0,y:0};if(vt){let f=i;for(;f&&f.nodeName.toLowerCase()!=="html";){const _=Br(f,"transform");if(/^matrix/.test(_)){const w=_.slice(7,-1).split(/,\s/).map(Number);t.x+=w[4],t.y+=w[5]}else if(/^matrix3d/.test(_)){const w=_.slice(9,-1).split(/,\s/).map(Number);t.x+=w[12],t.y+=w[13]}if(f.assignedSlot&&f.assignedSlot.parentElement&&B.WebKitCSSMatrix){const w=B.getComputedStyle(f.assignedSlot.parentElement).transform,T=new B.WebKitCSSMatrix(w);t.x+=T.m41,t.y+=T.m42}f=f.parentNode||f.host}}const r={},n=In(e.target),s=In(i),a=s.width,o=s.height;let l=e.offsetY-(s.top-n.top),d=e.offsetX-(s.left-n.left);return e.changedTouches&&(d=e.changedTouches[0].pageX-s.left,l=e.changedTouches[0].pageY+s.top,vt&&(d-=t.x,l-=t.y)),r.y=1-Math.max(0,Math.min(1,l/o)),r.x=Math.max(0,Math.min(1,d/a)),r}function Bh(i){return vi(i)&&i.nodeType===3}function pa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function Uh(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),jr(e)||Bh(e))return e;if(typeof e=="string"&&/\S/.test(e))return ce.createTextNode(e)}).filter(e=>e)}function hu(i,e){return Uh(e).forEach(t=>i.appendChild(t)),i}function qh(i,e){return hu(pa(i),e)}function Pn(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Hi=Lh("querySelector"),jh=Lh("querySelectorAll");function Br(i,e){if(!i||!e)return"";if(typeof B.getComputedStyle=="function"){let t;try{t=B.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function $h(i){[...ce.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),r=ce.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch{const t=ce.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,i.document.head.appendChild(t)}})}var Hh=Object.freeze({__proto__:null,isReal:qr,isEl:jr,isInFrame:Ph,createEl:Le,textContent:Vi,prependTo:Lo,hasClass:Tn,addClass:sr,removeClass:ca,toggleClass:Oh,setAttributes:Nh,getAttributes:qi,getAttribute:Fh,setAttribute:Rr,removeAttribute:da,blockTextSelection:Rh,unblockTextSelection:Mh,getBoundingClientRect:Mr,findPosition:In,getPointerPosition:ha,isTextNode:Bh,emptyEl:pa,normalizeContent:Uh,appendContent:hu,insertContent:qh,isSingleLeftClick:Pn,$:Hi,$$:jh,computedStyle:Br,copyStyleSheetsToWindow:$h});let Vh=!1,Oo;const q2=function(){if(Oo.options.autoSetup===!1)return;const i=Array.prototype.slice.call(ce.getElementsByTagName("video")),e=Array.prototype.slice.call(ce.getElementsByTagName("audio")),t=Array.prototype.slice.call(ce.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let n=0,s=r.length;n<s;n++){const a=r[n];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Oo(a);else{No(1);break}}else Vh||No(1)};function No(i,e){qr()&&(e&&(Oo=e),B.setTimeout(q2,i))}function Fo(){Vh=!0,B.removeEventListener("load",Fo)}qr()&&(ce.readyState==="complete"?Fo():B.addEventListener("load",Fo));const zh=function(i){const e=ce.createElement("style");return e.className=i,e},Wh=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var Pt=new WeakMap;const j2=3;let $2=j2;function Gt(){return $2++}function Fc(i,e){if(!Pt.has(i))return;const t=Pt.get(i);t.handlers[e].length===0&&(delete t.handlers[e],i.removeEventListener?i.removeEventListener(e,t.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&Pt.delete(i)}function pu(i,e,t,r){t.forEach(function(n){i(e,n,r)})}function fa(i){if(i.fixed_)return i;function e(){return!0}function t(){return!1}if(!i||!i.isPropagationStopped||!i.isImmediatePropagationStopped){const r=i||B.event;i={};const n=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const s in r)n.includes(s)||s==="returnValue"&&r.preventDefault||(i[s]=r[s]);if(i.target||(i.target=i.srcElement||ce),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){r.preventDefault&&r.preventDefault(),i.returnValue=!1,r.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),i.cancelBubble=!0,r.cancelBubble=!0,i.isPropagationStopped=e},i.isPropagationStopped=t,i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),i.isImmediatePropagationStopped=e,i.stopPropagation()},i.isImmediatePropagationStopped=t,i.clientX!==null&&i.clientX!==void 0){const s=ce.documentElement,a=ce.body;i.pageX=i.clientX+(s&&s.scrollLeft||a&&a.scrollLeft||0)-(s&&s.clientLeft||a&&a.clientLeft||0),i.pageY=i.clientY+(s&&s.scrollTop||a&&a.scrollTop||0)-(s&&s.clientTop||a&&a.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}let vs;const H2=function(){if(typeof vs!="boolean"){vs=!1;try{const i=Object.defineProperty({},"passive",{get(){vs=!0}});B.addEventListener("test",null,i),B.removeEventListener("test",null,i)}catch{}}return vs},V2=["touchstart","touchmove"];function Ut(i,e,t){if(Array.isArray(e))return pu(Ut,i,e,t);Pt.has(i)||Pt.set(i,{});const r=Pt.get(i);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),t.guid||(t.guid=Gt()),r.handlers[e].push(t),r.dispatcher||(r.disabled=!1,r.dispatcher=function(n,s){if(r.disabled)return;n=fa(n);const a=r.handlers[n.type];if(a){const o=a.slice(0);for(let l=0,d=o.length;l<d&&!n.isImmediatePropagationStopped();l++)try{o[l].call(i,n,s)}catch(f){Ue.error(f)}}}),r.handlers[e].length===1)if(i.addEventListener){let n=!1;H2()&&V2.indexOf(e)>-1&&(n={passive:!0}),i.addEventListener(e,r.dispatcher,n)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function Tt(i,e,t){if(!Pt.has(i))return;const r=Pt.get(i);if(!r.handlers)return;if(Array.isArray(e))return pu(Tt,i,e,t);const n=function(a,o){r.handlers[o]=[],Fc(a,o)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&n(i,a);return}const s=r.handlers[e];if(s){if(!t){n(i,e);return}if(t.guid)for(let a=0;a<s.length;a++)s[a].guid===t.guid&&s.splice(a--,1);Fc(i,e)}}function $r(i,e,t){const r=Pt.has(i)?Pt.get(i):{},n=i.parentNode||i.ownerDocument;if(typeof e=="string"?e={type:e,target:i}:e.target||(e.target=i),e=fa(e),r.dispatcher&&r.dispatcher.call(i,e,t),n&&!e.isPropagationStopped()&&e.bubbles===!0)$r.call(null,n,e,t);else if(!n&&!e.defaultPrevented&&e.target&&e.target[e.type]){Pt.has(e.target)||Pt.set(e.target,{});const s=Pt.get(e.target);e.target[e.type]&&(s.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),s.disabled=!1)}return!e.defaultPrevented}function ga(i,e,t){if(Array.isArray(e))return pu(ga,i,e,t);const r=function(){Tt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Gt(),Ut(i,e,r)}function fu(i,e,t){const r=function(){Tt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Gt(),Ut(i,e,r)}var z2=Object.freeze({__proto__:null,fixEvent:fa,on:Ut,off:Tt,trigger:$r,one:ga,any:fu});const Xt=30,et=function(i,e,t){e.guid||(e.guid=Gt());const r=e.bind(i);return r.guid=t?t+"_"+e.guid:e.guid,r},Si=function(i,e){let t=B.performance.now();return function(...r){const n=B.performance.now();n-t>=e&&(i(...r),t=n)}},Gh=function(i,e,t,r=B){let n;const s=()=>{r.clearTimeout(n),n=null},a=function(){const o=this,l=arguments;let d=function(){n=null,d=null,t||i.apply(o,l)};!n&&t&&i.apply(o,l),r.clearTimeout(n),n=r.setTimeout(d,e)};return a.cancel=s,a};var W2=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Xt,bind_:et,throttle:Si,debounce:Gh});let pn;class qt{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Ut(this,e,t),this.addEventListener=r}off(e,t){Tt(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},ga(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},fu(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=fa(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),$r(this,e)}queueTrigger(e){pn||(pn=new Map);const t=e.type||e;let r=pn.get(this);r||(r=new Map,pn.set(this,r));const n=r.get(t);r.delete(t),B.clearTimeout(n);const s=B.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,pn.delete(this)),this.trigger(e)},0);r.set(t,s)}}qt.prototype.allowedEvents_={};qt.prototype.addEventListener=qt.prototype.on;qt.prototype.removeEventListener=qt.prototype.off;qt.prototype.dispatchEvent=qt.prototype.trigger;const ma=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,Ai=i=>i instanceof qt||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),G2=(i,e)=>{Ai(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},Ro=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,Fs=(i,e,t)=>{if(!i||!i.nodeName&&!Ai(i))throw new Error(`Invalid target for ${ma(e)}#${t}; must be a DOM node or evented object.`)},Xh=(i,e,t)=>{if(!Ro(i))throw new Error(`Invalid event type for ${ma(e)}#${t}; must be a non-empty string or array.`)},Kh=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${ma(e)}#${t}; must be a function.`)},no=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let n,s,a;return r?(n=i.eventBusEl_,e.length>=3&&e.shift(),[s,a]=e):(n=e[0],s=e[1],a=e[2]),Fs(n,i,t),Xh(s,i,t),Kh(a,i,t),a=et(i,a),{isTargetingSelf:r,target:n,type:s,listener:a}},Zi=(i,e,t,r)=>{Fs(i,i,e),i.nodeName?z2[e](i,t,r):i[e](t,r)},X2={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=no(this,i,"on");if(Zi(t,"on",r,n),!e){const s=()=>this.off(t,r,n);s.guid=n.guid;const a=()=>this.off("dispose",s);a.guid=n.guid,Zi(this,"on","dispose",s),Zi(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=no(this,i,"one");if(e)Zi(t,"one",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Zi(t,"one",r,s)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=no(this,i,"any");if(e)Zi(t,"any",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Zi(t,"any",r,s)}},off(i,e,t){if(!i||Ro(i))Tt(this.eventBusEl_,i,e);else{const r=i,n=e;Fs(r,this,"off"),Xh(n,this,"off"),Kh(t,this,"off"),t=et(this,t),this.off("dispose",t),r.nodeName?(Tt(r,n,t),Tt(r,"dispose",t)):Ai(r)&&(r.off(n,t),r.off("dispose",t))}},trigger(i,e){Fs(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!Ro(t))throw new Error(`Invalid event type for ${ma(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return $r(this.eventBusEl_,i,e)}};function gu(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=Le("span",{className:"vjs-event-bus"});return Object.assign(i,X2),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&Pt.has(r)&&Pt.delete(r)}),B.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const K2={state:{},setState(i){typeof i=="function"&&(i=i());let e;return Sr(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&Ai(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Yh(i,e){return Object.assign(i,K2),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&Ai(i)&&i.on("statechanged",i.handleStateChanged),i}const Sn=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},lt=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},Qh=function(i,e){return lt(i)===lt(e)};var Y2=Object.freeze({__proto__:null,toLowerCase:Sn,toTitleCase:lt,titleCaseEquals:Qh});class re{constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Qe({},this.options_),t=this.options_=Qe(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${Gt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(gu(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Yh(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Qe(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return Le(e,t,r)}localize(e,t,r=e){const n=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),a=s&&s[n],o=n&&n.split("-")[0],l=s&&s[o];let d=r;return a&&a[e]?d=a[e]:l&&l[e]&&(d=l[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(f,_){const w=t[_-1];let T=w;return typeof w>"u"&&(T=f),T})),d}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,n)=>r.concat(n),[]);let t=this;for(let r=0;r<e.length;r++)if(t=t.getChild(e[r]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const r="http://www.w3.org/2000/svg",n=Le("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),s=ce.createElementNS(r,"svg");s.setAttributeNS(null,"viewBox","0 0 512 512");const a=ce.createElementNS(r,"use");return s.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),n.appendChild(s),this.iconIsSet_?t.replaceChild(n,t.querySelector(".vjs-icon-placeholder")):t.appendChild(n),this.iconIsSet_=!0,n}addChild(e,t={},r=this.children_.length){let n,s;if(typeof e=="string"){s=lt(e);const a=t.componentClass||s;t.name=s;const o=re.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;n=new o(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(r,0,n),n.parentComponent_=this,typeof n.id=="function"&&(this.childIndex_[n.id()]=n),s=s||n.name&&lt(n.name()),s&&(this.childNameIndex_[s]=n,this.childNameIndex_[Sn(s)]=n),typeof n.el=="function"&&n.el()){let a=null;this.children_[r+1]&&(this.children_[r+1].el_?a=this.children_[r+1].el_:jr(this.children_[r+1])&&(a=this.children_[r+1])),this.contentEl().insertBefore(n.el(),a)}return n}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[lt(e.name())]=null,this.childNameIndex_[Sn(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const o=a.name;let l=a.opts;if(t[o]!==void 0&&(l=t[o]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const d=this.addChild(o,l);d&&(this[o]=d)};let n;const s=re.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,l;return typeof a=="string"?(o=a,l=e[o]||this.options_[o]||{}):(o=a.name,l=a),{name:o,opts:l}}).filter(a=>{const o=re.getComponent(a.opts.componentClass||lt(a.name));return o&&!s.isTech(o)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Hi(e,t||this.contentEl())}$$(e,t){return jh(e,t||this.contentEl())}hasClass(e){return Tn(this.el_,e)}addClass(...e){sr(this.el_,...e)}removeClass(...e){ca(this.el_,...e)}toggleClass(e,t){Oh(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Fh(this.el_,e)}setAttribute(e,t){Rr(this.el_,e,t)}removeAttribute(e){da(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],s=n.indexOf("px");return parseInt(s!==-1?n.slice(0,s):this.el_["offset"+lt(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Br(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${lt(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},r={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:r}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const r=10,n=200;let s;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=B.performance.now(),s=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)s=!1;else if(t){const l=o.touches[0].pageX-t.pageX,d=o.touches[0].pageY-t.pageY;Math.sqrt(l*l+d*d)>r&&(s=!1)}});const a=function(){s=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,s===!0&&B.performance.now()-e<n&&(o.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=et(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const r=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",r),this.on("touchcancel",r)}setTimeout(e,t){var r;return e=et(this,e),this.clearTimersOnDispose_(),r=B.setTimeout(()=>{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),B.clearTimeout(e)),e}setInterval(e,t){e=et(this,e),this.clearTimersOnDispose_();const r=B.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),B.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=et(this,e),t=B.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=et(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),B.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(s){const a=B.getComputedStyle(s,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function r(s){return!(!t(s.parentElement)||!t(s)||s.style.opacity==="0"||B.getComputedStyle(s).height==="0px"||B.getComputedStyle(s).width==="0px")}function n(s){if(s.offsetWidth+s.offsetHeight+s.getBoundingClientRect().height+s.getBoundingClientRect().width===0)return!1;const a={x:s.getBoundingClientRect().left+s.offsetWidth/2,y:s.getBoundingClientRect().top+s.offsetHeight/2};if(a.x<0||a.x>(ce.documentElement.clientWidth||B.innerWidth)||a.y<0||a.y>(ce.documentElement.clientHeight||B.innerHeight))return!1;let o=ce.elementFromPoint(a.x,a.y);for(;o;){if(o===s)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&r(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const r=re.getComponent("Tech"),n=r&&r.isTech(t),s=re===t||re.prototype.isPrototypeOf(t.prototype);if(n||!s){let o;throw n?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=lt(e),re.components_||(re.components_={});const a=re.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,l=Object.keys(o);if(o&&l.length>0){for(let d=0;d<l.length;d++)if(o[l[d]]!==null)throw new Error("Can not register Player component after player has been created.")}}return re.components_[e]=t,re.components_[Sn(e)]=t,t}static getComponent(e){if(!(!e||!re.components_))return re.components_[e]}}re.registerComponent("Component",re);function Q2(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Rc(i,e,t,r){return Q2(i,r,t.length-1),t[r][e]}function so(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:Rc.bind(null,"start",0,i),end:Rc.bind(null,"end",1,i)},B.Symbol&&B.Symbol.iterator&&(e[B.Symbol.iterator]=()=>(i||[]).values()),e}function ii(i,e){return Array.isArray(i)?so(i):i===void 0||e===void 0?so():so([[i,e]])}const Jh=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const s=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=t="-"),n=n>0||a>0?n+":":"",r=((n||s>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,n+r+t};let mu=Jh;function Zh(i){mu=i}function ep(){mu=Jh}function lr(i,e=i){return mu(i,e)}var J2=Object.freeze({__proto__:null,createTimeRanges:ii,createTimeRange:ii,setFormatTime:Zh,resetFormatTime:ep,formatTime:lr});function tp(i,e){let t=0,r,n;if(!e)return 0;(!i||!i.length)&&(i=ii(0,0));for(let s=0;s<i.length;s++)r=i.start(s),n=i.end(s),n>e&&(n=e),t+=n-r;return t/e}function ot(i){if(i instanceof ot)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:vi(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=ot.defaultMessages[this.code]||"")}ot.prototype.code=0;ot.prototype.message="";ot.prototype.status=null;ot.prototype.metadata=null;ot.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];ot.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};ot.MEDIA_ERR_CUSTOM=0;ot.prototype.MEDIA_ERR_CUSTOM=0;ot.MEDIA_ERR_ABORTED=1;ot.prototype.MEDIA_ERR_ABORTED=1;ot.MEDIA_ERR_NETWORK=2;ot.prototype.MEDIA_ERR_NETWORK=2;ot.MEDIA_ERR_DECODE=3;ot.prototype.MEDIA_ERR_DECODE=3;ot.MEDIA_ERR_SRC_NOT_SUPPORTED=4;ot.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;ot.MEDIA_ERR_ENCRYPTED=5;ot.prototype.MEDIA_ERR_ENCRYPTED=5;function Cn(i){return i!=null&&typeof i.then=="function"}function pi(i){Cn(i)&&i.then(null,e=>{})}const Mo=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,r)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Z2=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=Mo(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(r){return t.indexOf(r)===-1}).map(Mo))},e_=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>r.addCue(n))}),e.textTracks()};var Bo={textTracksToJson:Z2,jsonToTextTracks:e_,trackToJson:Mo};const ao="vjs-modal-dialog";class Hr extends re{constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=Le("div",{className:`${ao}-content`},{role:"document"}),this.descEl_=Le("p",{className:`${ao}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Vi(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${ao} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let r=this.getChild("closeButton");if(t&&!r){const n=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),qh(t,e),this.trigger("modalfill"),n?r.insertBefore(t,n):r.appendChild(t);const s=this.getChild("closeButton");s&&r.appendChild(s.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),pa(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=ce.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),r=this.el_.querySelector(":focus");let n;for(let s=0;s<t.length;s++)if(r===t[s]){n=s;break}ce.activeElement===this.el_&&(n=0),e.shiftKey&&n===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof B.HTMLAnchorElement||t instanceof B.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof B.HTMLInputElement||t instanceof B.HTMLSelectElement||t instanceof B.HTMLTextAreaElement||t instanceof B.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof B.HTMLIFrameElement||t instanceof B.HTMLObjectElement||t instanceof B.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Hr.prototype.options_={pauseOnOpen:!0,temporary:!0};re.registerComponent("ModalDialog",Hr);class cr extends qt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Ai(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,n=this.length;r<n;r++)if(this[r]===e){t=this[r],t.off&&t.off(),this.tracks_.splice(r,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}cr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const i in cr.prototype.allowedEvents_)cr.prototype["on"+i]=null;const oo=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].enabled=!1)};class ip extends cr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){oo(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&oo(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,oo(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const uo=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].selected=!1)};class rp extends cr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){uo(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&uo(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,uo(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class yu extends cr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class t_{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t<r;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let r=0,n=this.trackElements_.length;r<n;r++)if(e===this.trackElements_[r].track){t=this.trackElements_[r];break}return t}removeTrackElement_(e){for(let t=0,r=this.trackElements_.length;t<r;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class Rs{constructor(e){Rs.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let r=0;const n=e.length;this.cues_=e,this.length_=e.length;const s=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<n)for(r=t;r<n;r++)s.call(this,r)}getCueById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}const i_={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},r_={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},n_={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Mc={disabled:"disabled",hidden:"hidden",showing:"showing"};class _u extends qt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Gt(),kind:e.kind||"",language:e.language||""};let r=e.label||"";for(const n in t)Object.defineProperty(this,n,{get(){return t[n]},set(){}});Object.defineProperty(this,"label",{get(){return r},set(n){n!==r&&(r=n,this.trigger("labelchange"))}})}}const bu=function(i){return new URL(i,ce.baseURI)},np=function(i){return new URL(i,ce.baseURI).href},vu=function(i){if(typeof i=="string"){const e=i.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return e?e[1].toLowerCase():""}return""},ya=function(i,e=B.location){return bu(i).origin!==e.origin};var s_=Object.freeze({__proto__:null,parseUrl:bu,getAbsoluteURL:np,getFileExtension:vu,isCrossOrigin:ya});const Bc=function(i,e){const t=new B.WebVTT.Parser(B,B.vttjs,B.WebVTT.StringDecoder()),r=[];t.oncue=function(n){e.addCue(n)},t.onparsingerror=function(n){r.push(n)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(i),r.length>0&&(B.console&&B.console.groupCollapsed&&B.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(n=>Ue.error(n)),B.console&&B.console.groupEnd&&B.console.groupEnd()),t.flush()},Uc=function(i,e){const t={uri:i},r=ya(i);r&&(t.cors=r);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),ah(t,et(this,function(s,a,o){if(s)return Ue.error(s,a);e.loaded_=!0,typeof B.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){Ue.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Bc(o,e)}):Bc(o,e)}))};class Fn extends _u{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Qe(e,{kind:n_[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=Mc[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const s=new Rs(this.cues_),a=new Rs(this.activeCues_);let o=!1;this.timeupdateHandler=et(this,function(d={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return r},set(d){Mc[d]&&r!==d&&(r=d,!this.preload_&&r!=="disabled"&&this.cues.length===0&&Uc(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const d=this.tech_.currentTime(),f=[];for(let _=0,w=this.cues.length;_<w;_++){const T=this.cues[_];T.startTime<=d&&T.endTime>=d&&f.push(T)}if(o=!1,f.length!==this.activeCues_.length)o=!0;else for(let _=0;_<f.length;_++)this.activeCues_.indexOf(f[_])===-1&&(o=!0);return this.activeCues_=f,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&Uc(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new B.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const r=this.tech_.textTracks();for(let n=0;n<r.length;n++)r[n]!==this&&r[n].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return Bo.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const r=this.cues_[t];if(r===e||r.originalCue_&&r.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Fn.prototype.allowedEvents_={cuechange:"cuechange"};class sp extends _u{constructor(e={}){const t=Qe(e,{kind:r_[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"enabled",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class ap extends _u{constructor(e={}){const t=Qe(e,{kind:i_[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"selected",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Ii extends qt{constructor(e={}){super();let t;const r=new Fn(e);this.kind=r.kind,this.src=r.src,this.srclang=r.language,this.label=r.label,this.default=r.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return r}}}),t=Ii.NONE,r.addEventListener("loadeddata",()=>{t=Ii.LOADED,this.trigger({type:"load",target:this})})}}Ii.prototype.allowedEvents_={load:"load"};Ii.NONE=0;Ii.LOADING=1;Ii.LOADED=2;Ii.ERROR=3;const Wt={audio:{ListClass:ip,TrackClass:sp,capitalName:"Audio"},video:{ListClass:rp,TrackClass:ap,capitalName:"Video"},text:{ListClass:yu,TrackClass:Fn,capitalName:"Text"}};Object.keys(Wt).forEach(function(i){Wt[i].getterName=`${i}Tracks`,Wt[i].privateName=`${i}Tracks_`});const Ur={remoteText:{ListClass:yu,TrackClass:Fn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:t_,TrackClass:Ii,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},It=Object.assign({},Wt,Ur);Ur.names=Object.keys(Ur);Wt.names=Object.keys(Wt);It.names=[].concat(Ur.names).concat(Wt.names);function a_(i,e,t,r,n={}){const s=i.textTracks();n.kind=e,t&&(n.label=t),r&&(n.language=r),n.tech=i;const a=new It.text.TrackClass(n);return s.addTrack(a),a}class Re extends re{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),It.names.forEach(r=>{const n=It[r];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new It.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(et(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return ii(0,0)}bufferedPercent(){return tp(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Wt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let n=r.length;for(;n--;){const s=r[n];t==="text"&&this.removeRemoteTextTrack(s),r.removeTrack(s)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new ot(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?ii(0,0):ii()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Wt.names.forEach(e=>{const t=Wt[e],r=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),this.on("dispose",()=>{n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!B.WebVTT)if(ce.body.contains(this.el())){if(!this.options_["vtt.js"]&&Fr(uc)&&Object.keys(uc).length>0){this.trigger("vttjsloaded");return}const e=ce.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),B.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=o=>e.addTrack(o.track),n=o=>e.removeTrack(o.track);t.on("addtrack",r),t.on("removetrack",n),this.addWebVttScript_();const s=()=>this.trigger("texttrackchange"),a=()=>{s();for(let o=0;o<e.length;o++){const l=e[o];l.removeEventListener("cuechange",s),l.mode==="showing"&&l.addEventListener("cuechange",s)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",r),t.off("removetrack",n),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",s)})}addTextTrack(e,t,r){if(!e)throw new Error("TextTrack kind is required but was not provided");return a_(this,e,t,r)}createRemoteTextTrack(e){const t=Qe(e,{tech:this});return new Ur.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const r=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Gt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Re.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Re||e instanceof Re||e===Re}static registerTech(e,t){if(Re.techs_||(Re.techs_={}),!Re.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Re.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Re.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=lt(e),Re.techs_[e]=t,Re.techs_[Sn(e)]=t,e!=="Tech"&&Re.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(Re.techs_&&Re.techs_[e])return Re.techs_[e];if(e=lt(e),B&&B.videojs&&B.videojs[e])return Ue.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),B.videojs[e]}}}It.names.forEach(function(i){const e=It[i];Re.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});Re.prototype.featuresVolumeControl=!0;Re.prototype.featuresMuteControl=!0;Re.prototype.featuresFullscreenResize=!1;Re.prototype.featuresPlaybackRate=!1;Re.prototype.featuresProgressEvents=!1;Re.prototype.featuresSourceset=!1;Re.prototype.featuresTimeupdateEvents=!1;Re.prototype.featuresNativeTextTracks=!1;Re.prototype.featuresVideoFrameCallback=!1;Re.withSourceHandlers=function(i){i.registerSourceHandler=function(e,t){let r=i.sourceHandlers;r||(r=i.sourceHandlers=[]),t===void 0&&(t=r.length),r.splice(t,0,e)},i.canPlayType=function(e){const t=i.sourceHandlers||[];let r;for(let n=0;n<t.length;n++)if(r=t[n].canPlayType(e),r)return r;return""},i.selectSourceHandler=function(e,t){const r=i.sourceHandlers||[];let n;for(let s=0;s<r.length;s++)if(n=r[s].canHandleSource(e,t),n)return r[s];return null},i.canPlaySource=function(e,t){const r=i.selectSourceHandler(e,t);return r?r.canHandleSource(e,t):""},["seekable","seeking","duration"].forEach(function(e){const t=this[e];typeof t=="function"&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(e){let t=i.selectSourceHandler(e,this.options_);t||(i.nativeSourceHandler?t=i.nativeSourceHandler:Ue.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==i.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},i.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};re.registerComponent("Tech",Re);Re.registerTech("Tech",Re);Re.defaultTechOrder_=[];const ar={},Ms={},Bs={};function o_(i,e){ar[i]=ar[i]||[],ar[i].push(e)}function u_(i,e,t){i.setTimeout(()=>er(e,ar[e.type],t,i),1)}function l_(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function c_(i,e,t){return i.reduceRight(Tu(t),e[t]())}function d_(i,e,t,r){return e[t](i.reduce(Tu(t),r))}function qc(i,e,t,r=null){const n="call"+lt(t),s=i.reduce(Tu(n),r),a=s===Bs,o=a?null:e[t](s);return f_(i,t,o,a),o}const h_={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},p_={setCurrentTime:1,setMuted:1,setVolume:1},jc={play:1,pause:1};function Tu(i){return(e,t)=>e===Bs?Bs:t[i]?t[i](e):e}function f_(i,e,t,r){for(let n=i.length-1;n>=0;n--){const s=i[n];s[e]&&s[e](r,t)}}function g_(i){Ms.hasOwnProperty(i.id())&&delete Ms[i.id()]}function m_(i,e){const t=Ms[i.id()];let r=null;if(t==null)return r=e(i),Ms[i.id()]=[[e,r]],r;for(let n=0;n<t.length;n++){const[s,a]=t[n];s===e&&(r=a)}return r===null&&(r=e(i),t.push([e,r])),r}function er(i={},e=[],t,r,n=[],s=!1){const[a,...o]=e;if(typeof a=="string")er(i,ar[a],t,r,n,s);else if(a){const l=m_(r,a);if(!l.setSource)return n.push(l),er(i,o,t,r,n,s);l.setSource(Object.assign({},i),function(d,f){if(d)return er(i,o,t,r,n,s);n.push(l),er(f,i.type===f.type?o:ar[f.type],t,r,n,s)})}else o.length?er(i,o,t,r,n,s):s?t(i,n):er(i,ar["*"],t,r,n,!0)}const y_={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Us=function(i=""){const e=vu(i);return y_[e.toLowerCase()]||""},__=(i,e)=>{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let n=0;n<r.length;n++){const s=r[n];if(s.type&&s.src&&s.src===e)return s.type}return Us(e)},op=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=op(t),Array.isArray(t)?e=e.concat(t):vi(t)&&e.push(t)}),i=e}else typeof i=="string"&&i.trim()?i=[$c({src:i})]:vi(i)&&typeof i.src=="string"&&i.src&&i.src.trim()?i=[$c(i)]:i=[];return i};function $c(i){if(!i.type){const e=Us(i.src);e&&(i.type=e)}return i}var b_=`<svg xmlns="http://www.w3.org/2000/svg">
52
+ <defs>
53
+ <symbol viewBox="0 0 48 48" id="vjs-icon-play">
54
+ <path d="M16 10v28l22-14z"></path>
55
+ </symbol>
56
+ <symbol viewBox="0 0 48 48" id="vjs-icon-pause">
57
+ <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
58
+ </symbol>
59
+ <symbol viewBox="0 0 48 48" id="vjs-icon-audio">
60
+ <path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
61
+ </symbol>
62
+ <symbol viewBox="0 0 48 48" id="vjs-icon-captions">
63
+ <path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
64
+ </symbol>
65
+ <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
66
+ <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
67
+ </symbol>
68
+ <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
69
+ <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
70
+ </symbol>
71
+ <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
72
+ <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
73
+ </symbol>
74
+ <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
75
+ <path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
76
+ </symbol>
77
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
78
+ <path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
79
+ </symbol>
80
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
81
+ <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
82
+ </symbol>
83
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
84
+ <path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
85
+ </symbol>
86
+ <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
87
+ <path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
88
+ </symbol>
89
+ <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
90
+ <path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
91
+ </symbol>
92
+ <symbol viewBox="0 0 24 24" id="vjs-icon-hd">
93
+ <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
94
+ </symbol>
95
+ <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
96
+ <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
97
+ </symbol>
98
+ <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
99
+ <path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
100
+ </symbol>
101
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
102
+ <path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
103
+ </symbol>
104
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
105
+ <path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
106
+ </symbol>
107
+ <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
108
+ <path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
109
+ </symbol>
110
+ <symbol viewBox="0 0 48 48" id="vjs-icon-share">
111
+ <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
112
+ </symbol>
113
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cog">
114
+ <path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
115
+ </symbol>
116
+ <symbol viewBox="0 0 48 48" id="vjs-icon-square">
117
+ <path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
118
+ </symbol>
119
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle">
120
+ <circle cx="24" cy="24" r="20"></circle>
121
+ </symbol>
122
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
123
+ <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
124
+ </symbol>
125
+ <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
126
+ <path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
127
+ </symbol>
128
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
129
+ <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
130
+ </symbol>
131
+ <symbol viewBox="0 0 48 48" id="vjs-icon-replay">
132
+ <path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
133
+ </symbol>
134
+ <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
135
+ <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
136
+ </symbol>
137
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
138
+ <path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
139
+ </symbol>
140
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
141
+ <path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
142
+ </symbol>
143
+ <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
144
+ <path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
145
+ </symbol>
146
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
147
+ <path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
148
+ </symbol>
149
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
150
+ <path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
151
+ </symbol>
152
+ <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
153
+ <path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
154
+ </symbol>
155
+ <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
156
+ <g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
157
+ </symbol>
158
+ <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
159
+ <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
160
+ </symbol>
161
+ <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
162
+ <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
163
+ </symbol>
164
+ <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
165
+ <path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
166
+ </symbol>
167
+ <symbol viewBox="0 0 48 48" id="vjs-icon-cast">
168
+ <path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
169
+ </symbol>
170
+ <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
171
+ <path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
172
+ </symbol>
173
+ <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
174
+ <path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
175
+ <path fill="none" d="M-1-3h24v24H-1z"></path>
176
+ </symbol>
177
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
178
+ <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
179
+ </symbol>
180
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
181
+ <path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
182
+ </symbol>
183
+ <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
184
+ <path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
185
+ </symbol>
186
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
187
+ <path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
188
+ </symbol>
189
+ <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
190
+ <path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
191
+ </symbol>
192
+ </defs>
193
+ </svg>`;const Hc=Ls?10009:Os?461:8,yr={codes:{play:415,pause:19,ff:417,rw:412,back:Hc},names:{415:"play",19:"pause",417:"ff",412:"rw",[Hc]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},Vc=5;class v_ extends qt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const r=t.key.substring(5).toLowerCase();this.move(r)}else if(yr.isEventKey(t,"play")||yr.isEventKey(t,"pause")||yr.isEventKey(t,"ff")||yr.isEventKey(t,"rw")){t.preventDefault();const r=yr.getEventName(t);this.performMediaAction_(r)}else yr.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Vc);break;case"rw":this.userSeek_(this.player_.currentTime()-Vc);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let r=null;const n=this.getCurrentComponent(e.target);t&&(r=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!r||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function r(n){for(const s of n)s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())&&t.push(s),s.hasOwnProperty("children_")&&s.children_.length>0&&r(s.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?r(n.children_):n.hasOwnProperty("items")&&n.items.length>0?r(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const s=n.el_.querySelector(".vjs-errors-ok-button-container");s&&s.querySelectorAll("button").forEach((a,o)=>{t.push({name:()=>"ModalButton"+(o+1),el:()=>a,getPositions:()=>{const l=a.getBoundingClientRect(),d={x:l.x,y:l.y,width:l.width,height:l.height,top:l.top,right:l.right,bottom:l.bottom,left:l.left},f={x:l.left+l.width/2,y:l.top+l.height/2,width:0,height:0,top:l.top+l.height/2,right:l.left+l.width/2,bottom:l.top+l.height/2,left:l.left+l.width/2};return{boundingClientRect:d,center:f}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:l=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(r){if(e.getIsFocusable(r)&&e.getIsAvailableToBeFocused(r))return r;for(let n=0;n<r.children.length;n++){const s=r.children[n],a=t(s);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const r of this.focusableComponents)if(r.el()===t)return r}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const r=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(r.boundingClientRect,a.getPositions().boundingClientRect,e)),s=this.findBestCandidate_(r.center,n,e);s?this.focus(s):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,r){let n=1/0,s=null;for(const a of t){const o=a.getPositions().center,l=this.calculateDistance_(e,o,r);l<n&&(n=l,s=a)}return s}isInDirection_(e,t,r){switch(r){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,r){const n=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);let a;switch(r){case"right":case"left":a=n+s*100;break;case"up":a=s*2+n*.5;break;case"down":a=s*5+n;break;default:a=n+s}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class T_ extends re{constructor(e,t,r){const n=Qe({createEl:!1},t);if(super(e,n,r),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let s=0,a=t.playerOptions.techOrder;s<a.length;s++){const o=lt(a[s]);let l=Re.getTech(o);if(o||(l=re.getComponent(o)),l&&l.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}re.registerComponent("MediaLoader",T_);class _a extends re{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=r=>this.handleMouseOver(r),this.handleMouseOut_=r=>this.handleMouseOut(r),this.handleClick_=r=>this.handleClick(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.emitTapEvents(),this.enable()}createEl(e="div",t={},r={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Ue.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),r=Object.assign({role:"button"},r),this.tabIndex_=t.tabIndex;const n=Le(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(Le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=Le("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const r=this.localize(e);this.controlText_=e,Vi(this.controlTextEl_,r),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",r)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}re.registerComponent("ClickableComponent",_a);class Uo extends _a{constructor(e,t){super(e,t),this.update(),this.update_=r=>this.update(r),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return Le("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(Le("picture",{className:"vjs-poster",tabIndex:-1},{},Le("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?pi(this.player_.play()):this.player_.pause())}}Uo.prototype.crossorigin=Uo.prototype.crossOrigin;re.registerComponent("PosterImage",Uo);const zt="#222",zc="#ccc",S_={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function lo(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function li(i,e,t){try{i.style[e]=t}catch{return}}function Wc(i){return i?`${i}px`:""}class C_ extends re{constructor(e,t,r){super(e,t,r);const n=a=>this.updateDisplay(a),s=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",n),e.on("userinactive",n),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(et(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);const a=B.screen.orientation||B,o=B.screen.orientation?"change":"orientationchange";a.addEventListener(o,s),e.on("dispose",()=>a.removeEventListener(o,s));const l=this.options_.playerOptions.tracks||[];for(let d=0;d<l.length;d++)this.player_.addRemoteTextTrack(l[d],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),r=this.player_.cache_.selectedLanguage;let n,s,a;for(let o=0;o<t.length;o++){const l=t[o];r&&r.enabled&&r.language&&r.language===l.language&&l.kind in e?l.kind===r.kind?a=l:a||(a=l):r&&!r.enabled?(a=null,n=null,s=null):l.default&&(l.kind==="descriptions"&&!n?n=l:l.kind in e&&!s&&(s=l))}a?a.mode="showing":s?s.mode="showing":n&&(n.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof B.WebVTT=="function"&&B.WebVTT.processCues(B,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const l=e[o];l.mode==="showing"&&a.push(l)}this.updateForTrack(a);return}let r=null,n=null,s=e.length;for(;s--;){const a=e[s];a.mode==="showing"&&(a.kind==="descriptions"?r=a:n=a)}if(n?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):r&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(r)),!B.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),l=this.player_.controlBar.el_.getBoundingClientRect().height,d=this.player_.el_.getBoundingClientRect().height;a.style="",li(a,"position","relative"),li(a,"height",d-l+"px"),li(a,"top","unset"),Ns?li(a,"bottom",d+"px"):li(a,"bottom","0px"),o.length>0&&o.forEach(f=>{if(f.style.inset){const _=f.style.inset.split(" ");_.length===3&&Object.assign(f.style,{top:_[0],right:_[1],bottom:_[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!B.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),r=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let s=0,a=0;Math.abs(r-n)>.1&&(r>n?s=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),li(this.el_,"insetInline",Wc(s)),li(this.el_,"insetBlock",Wc(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),r=e.activeCues;let n=r.length;for(;n--;){const s=r[n];if(!s)continue;const a=s.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&li(a.firstChild,"color",lo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&li(a.firstChild,"backgroundColor",lo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?li(a,"backgroundColor",lo(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${zt}, 2px 2px 4px ${zt}, 2px 2px 5px ${zt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${zt}, 2px 2px ${zt}, 3px 3px ${zt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${zc}, 0 1px ${zc}, -1px -1px ${zt}, 0 -1px ${zt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${zt}, 0 0 4px ${zt}, 0 0 4px ${zt}, 0 0 4px ${zt}`)),t.fontPercent&&t.fontPercent!==1){const o=B.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=S_[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof B.WebVTT!="function"||e.every(r=>!r.activeCues))return;const t=[];for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s)t.push(n.activeCues[s])}B.WebVTT.processCues(B,t,this.el_);for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s){const a=n.activeCues[s].displayState;sr(a,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language?n.language:r)),n.language&&Rr(a,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}re.registerComponent("TextTrackDisplay",C_);class E_ extends re{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),r=Le("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),n=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(r),n}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}re.registerComponent("LoadingSpinner",E_);class St extends _a{createEl(e,t={},r={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),r=Object.assign({type:"button"},r);const n=Le(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(Le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}addChild(e,t={}){const r=this.constructor.name;return Ue.warn(`Adding an actionable (user controllable) child to a Button (${r}) is not supported; use a ClickableComponent instead.`),re.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}re.registerComponent("Button",St);class up extends St{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",r=>this.handleMouseDown(r))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){pi(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const r=this.player_.getChild("controlBar"),n=r&&r.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const s=()=>n.focus();Cn(t)?t.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}up.prototype.controlText_="Play Video";re.registerComponent("BigPlayButton",up);class w_ extends St{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}re.registerComponent("CloseButton",w_);class lp extends St{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",r=>this.handlePlay(r)),this.on(e,"pause",r=>this.handlePause(r)),t.replay&&this.on(e,"ended",r=>this.handleEnded(r))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?pi(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}lp.prototype.controlText_="Play";re.registerComponent("PlayToggle",lp);class Vr extends re{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],r=>this.update(r)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),r=Le("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\xA0`},{role:"presentation"});return t.appendChild(r),this.contentEl_=Le("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=lr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Ue.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=ce.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Vr.prototype.labelText_="Time";Vr.prototype.controlText_="Time";re.registerComponent("TimeDisplay",Vr);class Su extends Vr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Su.prototype.labelText_="Current Time";Su.prototype.controlText_="Current Time";re.registerComponent("CurrentTimeDisplay",Su);class Cu extends Vr{constructor(e,t){super(e,t);const r=n=>this.updateContent(n);this.on(e,"durationchange",r),this.on(e,"loadstart",r),this.on(e,"loadedmetadata",r)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Cu.prototype.labelText_="Duration";Cu.prototype.controlText_="Duration";re.registerComponent("DurationDisplay",Cu);class x_ extends re{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),r=super.createEl("span",{textContent:"/"});return t.appendChild(r),e.appendChild(t),e}}re.registerComponent("TimeDivider",x_);class Eu extends Vr{constructor(e,t){super(e,t),this.on(e,"durationchange",r=>this.updateContent(r))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(Le("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Eu.prototype.labelText_="Remaining Time";Eu.prototype.controlText_="Remaining Time";re.registerComponent("RemainingTimeDisplay",Eu);class k_ extends re{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",r=>this.updateShowing(r))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Le("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Le("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\xA0`})),this.contentEl_.appendChild(ce.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}re.registerComponent("LiveDisplay",k_);class cp extends St{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=r=>this.updateLiveEdgeStatus(r),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=Le("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}cp.prototype.controlText_="Seek to live, currently playing live";re.registerComponent("SeekToLive",cp);function Rn(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var A_=Object.freeze({__proto__:null,clamp:Rn});class wu extends re{constructor(e,t){super(e,t),this.handleMouseDown_=r=>this.handleMouseDown(r),this.handleMouseUp_=r=>this.handleMouseUp(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.handleClick_=r=>this.handleClick(r),this.handleMouseMove_=r=>this.handleMouseMove(r),this.update_=r=>this.update(r),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},r={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),super.createEl(e,t,r)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Ti&&e.preventDefault(),Rh(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Mh(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Rn(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=ha(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,r=t&&t.enabled,n=t&&t.horizontalSeek;r?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}re.registerComponent("Slider",wu);const co=(i,e)=>Rn(i/e*100,0,100).toFixed(2)+"%";class D_ extends re{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",r=>this.update(r))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=Le("span",{className:"vjs-control-text"}),r=Le("span",{textContent:this.localize("Loaded")}),n=ce.createTextNode(": ");return this.percentageEl_=Le("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(r),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,r=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),a=this.partEls_,o=co(s,n);this.percent_!==o&&(this.el_.style.width=o,Vi(this.percentageEl_,o),this.percent_=o);for(let l=0;l<r.length;l++){const d=r.start(l),f=r.end(l);let _=a[l];_||(_=this.el_.appendChild(Le()),a[l]=_),!(_.dataset.start===d&&_.dataset.end===f)&&(_.dataset.start=d,_.dataset.end=f,_.style.left=co(d,s),_.style.width=co(f-d,s))}for(let l=a.length;l>r.length;l--)this.el_.removeChild(a[l-1]);a.length=r.length})}}re.registerComponent("LoadProgressBar",D_);class I_ extends re{constructor(e,t){super(e,t),this.update=Si(et(this,this.update),Xt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,r){const n=In(this.el_),s=Mr(this.player_.el()),a=e.width*t;if(!s||!n)return;let o=e.left-s.left+a,l=e.width-a+(s.right-e.right);l||(l=e.width-a,o=a);let d=n.width/2;o<d?d+=d-o:l<d&&(d=l),d<0?d=0:d>n.width&&(d=n.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(r)}write(e){Vi(this.el_,e)}updateTime(e,t,r,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),l=o-t*o;s=(l<1?"":"-")+lr(l,o)}else s=lr(r,a);this.update(e,t,s),n&&n()})}}re.registerComponent("TimeTooltip",I_);class xu extends re{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Si(et(this,this.update),Xt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,r){const n=this.getChild("timeTooltip");if(!n)return;const s=r&&r.target&&typeof r.target.pendingSeekTime=="function"?r.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,s)}}xu.prototype.options_={children:[]};!vt&&!ri&&xu.prototype.options_.children.push("timeTooltip");re.registerComponent("PlayProgressBar",xu);class dp extends re{constructor(e,t){super(e,t),this.update=Si(et(this,this.update),Xt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,()=>{this.el_.style.left=`${e.width*t}px`})}}dp.prototype.options_={children:["timeTooltip"]};re.registerComponent("MouseTimeDisplay",dp);class ba extends wu{constructor(e,t){t=Qe(ba.prototype.options_,t),t.children=[...t.children];const r=e.options_.disableSeekWhileScrubbingOnMobile&&(vt||ri)||e.options_.disableSeekWhileScrubbingOnSTV;(!vt&&!ri||r)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=r,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=et(this,this.update),this.update=Si(this.update_,Xt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in ce&&"visibilityState"in ce&&this.on(ce,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){ce.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Xt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(ce.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const r=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let s=this.player_.duration();n&&n.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==r||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[lr(r,s),lr(s,s)],"{1} of {2}")),this.currentTime_=r,this.duration_=s),this.bar&&this.bar.update(Mr(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const r=this.player_.liveTracker;return r&&r.isLive()?(t=(e-r.seekableStart())/r.liveWindow(),r.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Pn(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Pn(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let r;const n=this.calculateDistance(e),s=this.player_.liveTracker;if(!s||!s.isLive())r=n*this.player_.duration(),r===this.player_.duration()&&(r=r-.1);else{if(n>=.99){s.seekToLiveEdge();return}const a=s.seekableStart(),o=s.liveCurrentTime();if(r=a+n*s.liveWindow(),r>=o&&(r=o),r<=a&&(r=a+.1),r===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(r):this.userSeek_(r),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?pi(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const r=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in ce&&"visibilityState"in ce&&this.off(ce,"visibilitychange",this.toggleVisibility_),super.dispose()}}ba.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};re.registerComponent("SeekBar",ba);class hp extends re{constructor(e,t){super(e,t),this.handleMouseMove=Si(et(this,this.handleMouseMove),Xt),this.throttledHandleMouseSeek=Si(et(this,this.handleMouseSeek),Xt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.handleMouseDownHandler_=r=>this.handleMouseDown(r),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const r=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!r&&!n)return;const s=t.el(),a=In(s);let o=ha(s,e).x;o=Rn(o,0,1),n&&n.update(a,o),r&&r.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&pi(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}hp.prototype.options_={children:["seekBar"]};re.registerComponent("ProgressControl",hp);class pp extends St{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],r=>this.handlePictureInPictureChange(r)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],r=>this.handlePictureInPictureEnabledChange(r)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){ce.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in B?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof ce.exitPictureInPicture=="function"&&super.show()}}pp.prototype.controlText_="Picture-in-Picture";re.registerComponent("PictureInPictureToggle",pp);class fp extends St{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",r=>this.handleFullscreenChange(r)),ce[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}fp.prototype.controlText_="Fullscreen";re.registerComponent("FullscreenToggle",fp);const P_=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class L_ extends re{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}re.registerComponent("VolumeLevel",L_);class O_ extends re{constructor(e,t){super(e,t),this.update=Si(et(this,this.update),Xt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,r,n){if(!r){const s=Mr(this.el_),a=Mr(this.player_.el()),o=e.width*t;if(!a||!s)return;const l=e.left-a.left+o,d=e.width-o+(a.right-e.right);let f=s.width/2;l<f?f+=f-l:d<f&&(f=d),f<0?f=0:f>s.width&&(f=s.width),this.el_.style.right=`-${f}px`}this.write(`${n}%`)}write(e){Vi(this.el_,e)}updateVolume(e,t,r,n,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,r,n.toFixed(0)),s&&s()})}}re.registerComponent("VolumeLevelTooltip",O_);class gp extends re{constructor(e,t){super(e,t),this.update=Si(et(this,this.update),Xt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,r){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,r,n,()=>{r?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}gp.prototype.options_={children:["volumeLevelTooltip"]};re.registerComponent("MouseVolumeLevelDisplay",gp);class va extends wu{constructor(e,t){super(e,t),this.on("slideractive",r=>this.updateLastVolume_(r)),this.on(e,"volumechange",r=>this.updateARIAAttributes(r)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Pn(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const r=this.el(),n=Mr(r),s=this.vertical();let a=ha(r,e);a=s?a.y:a.x,a=Rn(a,0,1),t.update(n,a,s)}Pn(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}va.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!vt&&!ri&&va.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");va.prototype.playerEvent="volumechange";re.registerComponent("VolumeBar",va);class mp extends re{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Fr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),P_(this,e),this.throttledHandleMouseMove=Si(et(this,this.handleMouseMove),Xt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.on("mousedown",r=>this.handleMouseDown(r)),this.on("touchstart",r=>this.handleMouseDown(r)),this.on("mousemove",r=>this.handleMouseMove(r)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}mp.prototype.options_={children:["volumeBar"]};re.registerComponent("VolumeControl",mp);const N_=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class yp extends St{constructor(e,t){super(e,t),N_(this,e),this.on(e,["loadstart","volumechange"],r=>this.update(r))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),r=this.player_.lastVolume_();if(t===0){const n=r<.1?.1:r;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),vt&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),ca(this.el_,[0,1,2,3].reduce((r,n)=>r+`${n?" ":""}vjs-vol-${n}`,"")),sr(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}yp.prototype.controlText_="Mute";re.registerComponent("MuteToggle",yp);class _p extends re{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Fr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=r=>this.handleKeyPress(r),this.on(e,["loadstart"],r=>this.volumePanelState_(r)),this.on(this.muteToggle,"keyup",r=>this.handleKeyPress(r)),this.on(this.volumeControl,"keyup",r=>this.handleVolumeControlKeyUp(r)),this.on("keydown",r=>this.handleKeyPress(r)),this.on("mouseover",r=>this.handleMouseOver(r)),this.on("mouseout",r=>this.handleMouseOut(r)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Ut(ce,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Tt(ce,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}_p.prototype.options_={children:["muteToggle","volumeControl"]};re.registerComponent("VolumePanel",_p);class bp extends St{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()?r.seekableEnd():this.player_.duration();let s;t+this.skipTime<=n?s=t+this.skipTime:s=n,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}bp.prototype.controlText_="Skip Forward";re.registerComponent("SkipForward",bp);class vp extends St{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()&&r.seekableStart();let s;n&&t-this.skipTime<=n?s=n:t>=this.skipTime?s=t-this.skipTime:s=0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}vp.prototype.controlText_="Skip Backward";re.registerComponent("SkipBackward",vp);class Tp extends re{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",r=>this.handleKeyDown(r)),this.boundHandleBlur_=r=>this.handleBlur(r),this.boundHandleTapClick_=r=>this.handleTapClick(r)}addEventListenerForItem(e){e instanceof re&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof re&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=Le(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),Ut(t,"click",function(r){r.preventDefault(),r.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||ce.activeElement;if(!this.children().some(r=>r.el()===t)){const r=this.menuButton_;r&&r.buttonPressed_&&t!==r.el().firstChild&&r.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const r=t.filter(n=>n.el()===e.target)[0];if(!r)return;r.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}re.registerComponent("Menu",Tp);class ku extends re{constructor(e,t={}){super(e,t),this.menuButton_=new St(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const r=St.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+r,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=s=>this.handleClick(s);this.handleMenuKeyUp_=s=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",s=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Ut(ce,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",s=>this.handleMouseLeave(s)),this.on("keydown",s=>this.handleSubmenuKeyDown(s))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Tp(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=Le("li",{className:"vjs-menu-title",textContent:lt(this.options_.title),tabIndex:-1}),r=new re(this.player_,{el:t});e.addItem(r)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=St.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),Tt(ce,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),vt&&Ph())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}re.registerComponent("MenuButton",ku);class Au extends ku{constructor(e,t){const r=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!r)return;const n=et(this,this.update);r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),r.addEventListener("labelchange",n),this.player_.on("ready",n),this.player_.on("dispose",function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n),r.removeEventListener("labelchange",n)})}}re.registerComponent("TrackButton",Au);class Mn extends _a{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,r){this.nonIconControl=!0;const n=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),r),s=Le("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?n.appendChild(s):n.replaceChild(s,n.querySelector(".vjs-icon-placeholder")),n}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}re.registerComponent("MenuItem",Mn);class Bn extends Mn{constructor(e,t){const r=t.track,n=e.textTracks();t.label=r.label||r.language||"Unknown",t.selected=r.mode==="showing",super(e,t),this.track=r,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const s=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],s),n.addEventListener("change",s),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),n.removeEventListener("change",s),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof B.Event!="object")try{o=new B.Event("change")}catch{}o||(o=ce.createEvent("Event"),o.initEvent("change",!0,!0)),n.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,r=this.player_.textTracks();if(super.handleClick(e),!!r)for(let n=0;n<r.length;n++){const s=r[n];this.kinds.indexOf(s.kind)!==-1&&(s===t?s.mode!=="showing"&&(s.mode="showing"):s.mode!=="disabled"&&(s.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}re.registerComponent("TextTrackMenuItem",Bn);class Sp extends Bn{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r!==this.isSelected_&&this.selected(r)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}re.registerComponent("OffTextTrackMenuItem",Sp);class zr extends Au{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Bn){let r;this.label_&&(r=`${this.label_} off`),e.push(new Sp(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let s=0;s<n.length;s++){const a=n[s];if(this.kinds_.indexOf(a.kind)>-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}re.registerComponent("TextTrackButton",zr);class Cp extends Mn{constructor(e,t){const r=t.track,n=t.cue,s=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=s&&s<n.endTime,super(e,t),this.track=r,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}re.registerComponent("ChaptersTrackMenuItem",Cp);class Du extends zr{constructor(e,t,r){super(e,t,r),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const r=e[t];if(r.kind===this.kind_)return r}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(lt(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let r=0,n=t.length;r<n;r++){const s=t[r],a=new Cp(this.player_,{track:this.track_,cue:s});e.push(a)}return e}}Du.prototype.kind_="chapters";Du.prototype.controlText_="Chapters";re.registerComponent("ChaptersButton",Du);class Iu extends zr{constructor(e,t,r){super(e,t,r),this.setIcon("audio-description");const n=e.textTracks(),s=et(this,this.handleTracksChange);n.addEventListener("change",s),this.on("dispose",function(){n.removeEventListener("change",s)})}handleTracksChange(e){const t=this.player().textTracks();let r=!1;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(a.kind!==this.kind_&&a.mode==="showing"){r=!0;break}}r?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Iu.prototype.kind_="descriptions";Iu.prototype.controlText_="Descriptions";re.registerComponent("DescriptionsButton",Iu);class Pu extends zr{constructor(e,t,r){super(e,t,r),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Pu.prototype.kind_="subtitles";Pu.prototype.controlText_="Subtitles";re.registerComponent("SubtitlesButton",Pu);class Lu extends Bn{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}re.registerComponent("CaptionSettingsMenuItem",Lu);class Ou extends zr{constructor(e,t,r){super(e,t,r),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Lu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Ou.prototype.kind_="captions";Ou.prototype.controlText_="Captions";re.registerComponent("CaptionsButton",Ou);class Ep extends Bn{createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",n):s.appendChild(Le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(Le("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),n}}re.registerComponent("SubsCapsMenuItem",Ep);class Nu extends zr{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(lt(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Lu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Ep),e}}Nu.prototype.kinds_=["captions","subtitles"];Nu.prototype.controlText_="Subtitles";re.registerComponent("SubsCapsButton",Nu);class wp extends Mn{constructor(e,t){const r=t.track,n=e.audioTracks();t.label=r.label||r.language||"Unknown",t.selected=r.enabled,super(e,t),this.track=r,this.addClass(`vjs-${r.kind}-menu-item`);const s=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",s),this.on("dispose",()=>{n.removeEventListener("change",s)})}createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(Le("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(Le("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];n!==this.track&&(n.enabled=n===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}re.registerComponent("AudioTrackMenuItem",wp);class xp extends Au{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];e.push(new wp(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}xp.prototype.controlText_="Audio Track";re.registerComponent("AudioTrackButton",xp);class Fu extends Mn{constructor(e,t){const r=t.rate,n=parseFloat(r,10);t.label=r,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=r,this.rate=n,this.on(e,"ratechange",s=>this.update(s))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Fu.prototype.contentElType="button";re.registerComponent("PlaybackRateMenuItem",Fu);class kp extends ku{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",r=>this.updateVisibility(r)),this.on(e,"ratechange",r=>this.updateLabel(r)),this.on(e,"playbackrateschange",r=>this.handlePlaybackRateschange(r))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=Le("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let r=e.length-1;r>=0;r--)t.push(new Fu(this.player(),{rate:e[r]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}kp.prototype.controlText_="Playback Rate";re.registerComponent("PlaybackRateMenuButton",kp);class Ap extends re{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},r={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,r)}}re.registerComponent("Spacer",Ap);class F_ extends Ap{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:"\xA0"})}}re.registerComponent("CustomControlSpacer",F_);class Dp extends re{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Dp.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};re.registerComponent("ControlBar",Dp);class Ip extends Hr{constructor(e,t){super(e,t),this.on(e,"error",r=>{this.open(r)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Ip.prototype.options_=Object.assign({},Hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});re.registerComponent("ErrorDisplay",Ip);class Pp extends re{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),Le("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Gt()}`)+"-"+e[1].replace(/\W+/g,""),r=Le("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),r}))}}re.registerComponent("TextTrackSelect",Pp);class or extends re{constructor(e,t={}){super(e,t);const r=Le("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(r);const n=this.options_.selects;for(const s of n){const a=this.options_.selectConfigs[s],o=a.className,l=a.id.replace("%s",this.options_.id_);let d=null;const f=`vjs_select_${Gt()}`;if(this.options_.type==="colors"){d=Le("span",{className:o});const w=Le("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});w.setAttribute("for",f),d.appendChild(w)}const _=new Pp(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:f,labelId:l});this.addChild(_),this.options_.type==="colors"&&(d.appendChild(_.el()),this.el().appendChild(d))}}createEl(){return Le("fieldset",{className:this.options_.className})}}re.registerComponent("TextTrackFieldset",or);class Lp extends re{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new or(e,{id_:r,legendId:`captions-text-legend-${r}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const s=new or(e,{id_:r,legendId:`captions-background-${r}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const a=new or(e,{id_:r,legendId:`captions-window-${r}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return Le("div",{className:"vjs-track-settings-colors"})}}re.registerComponent("TextTrackSettingsColors",Lp);class Op extends re{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new or(e,{id_:r,legendId:`captions-font-size-${r}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const s=new or(e,{id_:r,legendId:`captions-edge-style-${r}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const a=new or(e,{id_:r,legendId:`captions-font-family-${r}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return Le("div",{className:"vjs-track-settings-font"})}}re.registerComponent("TextTrackSettingsFont",Op);class Np extends re{constructor(e,t={}){super(e,t);const r=new St(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Reset"),this.addChild(r);const n=this.localize("Done"),s=new St(e,{controlText:n,className:"vjs-done-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=n,this.addChild(s)}createEl(){return Le("div",{className:"vjs-track-settings-controls"})}}re.registerComponent("TrackSettingsControls",Np);const ho="vjs-text-track-settings",Gc=["#000","Black"],Xc=["#00F","Blue"],Kc=["#0FF","Cyan"],Yc=["#0F0","Green"],Qc=["#F0F","Magenta"],Jc=["#F00","Red"],Zc=["#FFF","White"],ed=["#FF0","Yellow"],po=["1","Opaque"],fo=["0.5","Semi-Transparent"],td=["0","Transparent"],ji={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Gc,Zc,Jc,Yc,Xc,ed,Qc,Kc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[po,fo,td],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Zc,Gc,Jc,Yc,Xc,ed,Qc,Kc],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[po,fo],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[td,fo,po],className:"vjs-window-opacity vjs-opacity"}};ji.windowColor.options=ji.backgroundColor.options;function Fp(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function R_(i,e){const t=i.options[i.options.selectedIndex].value;return Fp(t,e)}function M_(i,e,t){if(e){for(let r=0;r<i.options.length;r++)if(Fp(i.options[r].value,t)===e){i.selectedIndex=r;break}}}class B_ extends Hr{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=Le("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new Lp(e,{textTrackComponentid:this.id_,selectConfigs:ji,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const r=new Op(e,{textTrackComponentid:this.id_,selectConfigs:ji,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(r);const n=new Np(e);this.addChild(n)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Sr(ji,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Eh(ji,(e,t,r)=>{const n=R_(this.$(t.selector),t.parser);return n!==void 0&&(e[r]=n),e},{})}setValues(e){Sr(ji,(t,r)=>{M_(this.$(t.selector),e[r],t.parser)})}setDefaults(){Sr(ji,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(B.localStorage.getItem(ho))}catch(t){Ue.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?B.localStorage.setItem(ho,JSON.stringify(e)):B.localStorage.removeItem(ho)}catch(t){Ue.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}re.registerComponent("TextTrackSettings",B_);class U_ extends re{constructor(e,t){let r=t.ResizeObserver||B.ResizeObserver;t.ResizeObserver===null&&(r=!1);const n=Qe({createEl:!r,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||B.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Gh(()=>{this.resizeHandler()},100,!1,this),r?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const s=this.debouncedHandler_;let a=this.unloadListener_=function(){Tt(this,"resize",s),Tt(this,"unload",a),a=null};Ut(this.el_.contentWindow,"unload",a),Ut(this.el_.contentWindow,"resize",s)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}re.registerComponent("ResizeManager",U_);const q_={trackingThreshold:20,liveTolerance:15};class j_ extends re{constructor(e,t){const r=Qe(q_,t,{createEl:!1});super(e,r),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(B.performance.now().toFixed(4)),r=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+r;const n=this.liveCurrentTime(),s=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-s)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Xt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.end(r));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.start(r));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}re.registerComponent("LiveTracker",j_);class $_ extends re{constructor(e,t){super(e,t),this.on("statechanged",r=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:Le("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Gt()}`}),description:Le("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Gt()}`})},Le("div",{className:"vjs-title-bar"},{},wh(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const s=this.state[n],a=this.els[n],o=r[n];pa(a),s&&Vi(a,s),t&&(t.removeAttribute(o),s&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}re.registerComponent("TitleBar",$_);const H_={initialDisplay:4e3,position:[],takeFocus:!1};class V_ extends St{constructor(e,t){t=Qe(H_,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],r=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=Le("button",{},{type:"button",class:this.buildCSSClass()},Le("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}re.registerComponent("TransientButton",V_);const qo=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),r=[];let n="";if(!t.length)return!1;for(let s=0;s<t.length;s++){const a=t[s].src;a&&r.indexOf(a)===-1&&r.push(a)}return r.length?(r.length===1&&(n=r[0]),i.triggerSourceset(n),!0):!1},z_=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(i){const e=ce.createElement(this.nodeName.toLowerCase());e.innerHTML=i;const t=ce.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",B.Element.prototype.appendChild.call(this,t),this.innerHTML}}),Rp=(i,e)=>{let t={};for(let r=0;r<i.length&&(t=Object.getOwnPropertyDescriptor(i[r],e),!(t&&t.set&&t.get));r++);return t.enumerable=!0,t.configurable=!0,t},W_=i=>Rp([i.el(),B.HTMLMediaElement.prototype,B.Element.prototype,z_],"innerHTML"),id=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=W_(i),n=s=>(...a)=>{const o=s.apply(e,a);return qo(i),o};["append","appendChild","insertAdjacentHTML"].forEach(s=>{e[s]&&(t[s]=e[s],e[s]=n(t[s]))}),Object.defineProperty(e,"innerHTML",Qe(r,{set:n(r.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(s=>{e[s]=t[s]}),Object.defineProperty(e,"innerHTML",r)},i.one("sourceset",e.resetSourceWatch_)},G_=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?np(B.Element.prototype.getAttribute.call(this,"src")):""},set(i){return B.Element.prototype.setAttribute.call(this,"src",i),i}}),X_=i=>Rp([i.el(),B.HTMLMediaElement.prototype,G_],"src"),K_=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=X_(i),r=e.setAttribute,n=e.load;Object.defineProperty(e,"src",Qe(t,{set:s=>{const a=t.set.call(e,s);return i.triggerSourceset(e.src),a}})),e.setAttribute=(s,a)=>{const o=r.call(e,s,a);return/src/i.test(s)&&i.triggerSourceset(e.src),o},e.load=()=>{const s=n.call(e);return qo(i)||(i.triggerSourceset(""),id(i)),s},e.currentSrc?i.triggerSourceset(e.currentSrc):qo(i)||id(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=r,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class ve extends Re{constructor(e,t){super(e,t);const r=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",r&&(this.el_.currentSrc!==r.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(r):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const s=this.el_.childNodes;let a=s.length;const o=[];for(;a--;){const l=s[a];l.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(l),this.remoteTextTracks().addTrack(l.track),this.textTracks().addTrack(l.track),!n&&!this.el_.hasAttribute("crossorigin")&&ya(l.src)&&(n=!0)):o.push(l))}for(let l=0;l<o.length;l++)this.el_.removeChild(o[l])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&Ue.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
194
+ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(Dn||ua)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),ve.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){K_(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const r=()=>{t=[];for(let s=0;s<e.length;s++){const a=e[s];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};r(),e.addEventListener("change",r),this.on("dispose",()=>e.removeEventListener("change",r));const n=()=>{for(let s=0;s<t.length;s++){const a=t[s];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",n)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",r),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",r),e.addEventListener("change",r),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const r=e.toLowerCase();this[`${r}TracksListeners_`]&&Object.keys(this[`${r}TracksListeners_`]).forEach(n=>{this.el()[`${r}Tracks`].removeEventListener(n,this[`${r}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${r}TracksListeners_`]=null,this.proxyNativeTracksForType_(r)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Wt[e],r=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!r||!r.addEventListener)return;const s={change:o=>{const l={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(l),e==="text"&&this[Ur.remoteText.getterName]().trigger(l)},addtrack(o){n.addTrack(o.track)},removetrack(o){n.removeTrack(o.track)}},a=function(){const o=[];for(let l=0;l<n.length;l++){let d=!1;for(let f=0;f<r.length;f++)if(r[f]===n[l]){d=!0;break}d||o.push(n[l])}for(;o.length;)n.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=s,Object.keys(s).forEach(o=>{const l=s[o];r.addEventListener(o,l),this.on("dispose",d=>r.removeEventListener(o,l))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Wt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const r=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(r,e),ve.disposeMediaElement(e),e=r}else{e=ce.createElement("video");const r=this.options_.tag&&qi(this.options_.tag),n=Qe({},r);(!Dn||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,Nh(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Rr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let r=0;r<t.length;r++){const n=t[r],s=this.options_[n];typeof s<"u"&&(s?Rr(e,n,n):da(e,n),e[n]=s)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let r=!1;const n=function(){r=!0};this.on("loadstart",n);const s=function(){r||this.trigger("loadstart")};this.on("loadedmetadata",s),this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",s),r||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(r){this.trigger(r)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&la?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Ue(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ri&&Ti&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)pi(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Ue.error("Invalid source URL."),!1;const r={src:e};t&&(r.type=t);const n=Le("source",{},r);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return Ue.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const r of t)if(r.src===e)return this.el_.removeChild(r),!0;return Ue.warn(`No matching source element found with src: ${e}`),!1}reset(){ve.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):super.addTextTrack(e,t,r)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=ce.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const r=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let r=t.length;for(;r--;)(e===t[r]||e===t[r].track)&&this.el().removeChild(t[r])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),B.performance&&(e.creationTime=B.performance.now()),e}}sa(ve,"TEST_VID",function(){if(!qr())return;const i=ce.createElement("video"),e=ce.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});ve.isSupported=function(){try{ve.TEST_VID.volume=.5}catch{return!1}return!!(ve.TEST_VID&&ve.TEST_VID.canPlayType)};ve.canPlayType=function(i){return ve.TEST_VID.canPlayType(i)};ve.canPlaySource=function(i,e){return ve.canPlayType(i.type)};ve.canControlVolume=function(){try{const i=ve.TEST_VID.volume;ve.TEST_VID.volume=i/2+.1;const e=i!==ve.TEST_VID.volume;return e&&vt?(B.setTimeout(()=>{ve&&ve.prototype&&(ve.prototype.featuresVolumeControl=i!==ve.TEST_VID.volume)}),!1):e}catch{return!1}};ve.canMuteVolume=function(){try{const i=ve.TEST_VID.muted;return ve.TEST_VID.muted=!i,ve.TEST_VID.muted?Rr(ve.TEST_VID,"muted","muted"):da(ve.TEST_VID,"muted","muted"),i!==ve.TEST_VID.muted}catch{return!1}};ve.canControlPlaybackRate=function(){if(ri&&Ti&&aa<58)return!1;try{const i=ve.TEST_VID.playbackRate;return ve.TEST_VID.playbackRate=i/2+.1,i!==ve.TEST_VID.playbackRate}catch{return!1}};ve.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(ce.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(ce.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(ce.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(ce.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0};ve.supportsNativeTextTracks=function(){return la||vt&&Ti};ve.supportsNativeVideoTracks=function(){return!!(ve.TEST_VID&&ve.TEST_VID.videoTracks)};ve.supportsNativeAudioTracks=function(){return!!(ve.TEST_VID&&ve.TEST_VID.audioTracks)};ve.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){sa(ve.prototype,i,()=>ve[e](),!0)});ve.prototype.featuresVolumeControl=ve.canControlVolume();ve.prototype.movingMediaElementInDOM=!vt;ve.prototype.featuresFullscreenResize=!0;ve.prototype.featuresProgressEvents=!0;ve.prototype.featuresTimeupdateEvents=!0;ve.prototype.featuresVideoFrameCallback=!!(ve.TEST_VID&&ve.TEST_VID.requestVideoFrameCallback);ve.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&(function(){try{i.load()}catch{}})()}};ve.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&(function(){try{i.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){ve.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){ve.prototype["set"+lt(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){ve.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){ve.prototype["set"+lt(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){ve.prototype[i]=function(){return this.el_[i]()}});Re.withSourceHandlers(ve);ve.nativeSourceHandler={};ve.nativeSourceHandler.canPlayType=function(i){try{return ve.TEST_VID.canPlayType(i)}catch{return""}};ve.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return ve.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=vu(i.src);return ve.nativeSourceHandler.canPlayType(`video/${t}`)}return""};ve.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};ve.nativeSourceHandler.dispose=function(){};ve.registerSourceHandler(ve.nativeSourceHandler);Re.registerTech("Html5",ve);const Mp=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],go={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},jo=["tiny","xsmall","small","medium","large","xlarge","huge"],ws={};jo.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;ws[i]=`vjs-layout-${e}`});const Y_={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class ze extends re{constructor(e,t,r){if(e.id=e.id||t.id||`vjs_video_${Gt()}`,t=Object.assign(ze.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,r),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Sh(this.id_),this.fsApi_=Ds,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&qi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=ze.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),gu(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Ut(ce,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=Qe(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new B.DOMParser().parseFromString(b_,"image/svg+xml");if(a.querySelector("parsererror"))Ue.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const o=a.documentElement;o.style.display="none",this.el_.appendChild(o),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new v_(this),this.addClass("vjs-spatial-navigation-enabled")),Dn&&this.addClass("vjs-touch-enabled"),vt||this.addClass("vjs-workinghover"),ze.players[this.id_]=this;const s=Io.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),Tt(ce,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Tt(ce,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),ze.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),g_(this),It.names.forEach(e=>{const t=It[e],r=this[t.getterName]();r&&r.off&&r.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";r?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const s=qi(e);if(n){for(t=this.el_=e,e=this.tag=ce.createElement("video");t.children.length;)e.appendChild(t.firstChild);Tn(t,"video-js")||sr(t,"video-js"),t.appendChild(e),r=this.playerElIngest_=t,Object.keys(t).forEach(l=>{try{e[l]=t[l]}catch{}})}e.setAttribute("tabindex","-1"),s.tabindex="-1",Ti&&oa&&(e.setAttribute("role","application"),s.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(l){n&&l==="class"||t.setAttribute(l,s[l]),n&&e.setAttribute(l,s[l])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(l=>Ih[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),B.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=zh("vjs-styles-dimensions");const l=Hi(".vjs-styles-defaults"),d=Hi("head");d.insertBefore(this.styleEl_,l?l.nextSibling:d.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const o=e.getElementsByTagName("a");for(let l=0;l<o.length;l++){const d=o.item(l);sr(d,"vjs-hidden"),d.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(t,e),Lo(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Ue.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const r=e+"_";if(t===void 0)return this[r]||0;if(t===""||t==="auto"){this[r]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){Ue.error(`Improper value "${t}" supplied for for ${e}`);return}this[r]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ai(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),G2(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(B.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(o>=0&&(d.width=o),l>=0&&(d.height=l));return}let e,t,r,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?r=this.aspectRatio_:this.videoWidth()>0?r=this.videoWidth()+":"+this.videoHeight():r="16:9";const s=r.split(":"),a=s[1]/s[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),Wh(this.styleEl_,`
195
+ .${n} {
196
+ width: ${e}px;
197
+ height: ${t}px;
198
+ }
199
+
200
+ .${n}.vjs-fluid:not(.vjs-audio-only-mode) {
201
+ padding-top: ${a*100}%;
202
+ }
203
+ `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=lt(e),n=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(Re.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let s=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(s=!1);const a={source:t,autoplay:s,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};It.names.forEach(l=>{const d=It[l];a[d.getterName]=this[d.privateName]}),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=Re.getTech(e);if(!o)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(et(this,this.handleTechReady_),!0),Bo.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Mp.forEach(l=>{this.on(this.tech_,l,d=>this[`handleTech${lt(l)}_`](d))}),Object.keys(go).forEach(l=>{this.on(this.tech_,l,d=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${go[l]}_`].bind(this),event:d});return}this[`handleTech${go[l]}_`](d)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,d)=>this.handleTechFullscreenChange_(l,d)),this.on(this.tech_,"fullscreenerror",(l,d)=>this.handleTechFullscreenError_(l,d)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&Lo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){It.names.forEach(e=>{const t=It[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Bo.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Ue.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
204
+ See https://github.com/videojs/video.js/issues/2617 for more info.
205
+ `),this.tech_}version(){return{"video.js":Io}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const s=()=>{this.muted(n)};this.playTerminatedQueue_.push(s);const a=this.play();if(Cn(a))return a.catch(o=>{throw s(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),Cn(r)&&(r=r.catch(t))):e==="muted"&&!this.muted()?r=t():r=this.play(),!!Cn(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,r="";typeof t!="string"&&(t=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!r&&(r=__(this,t)),this.cache_.source=Qe({},e,{src:t,type:r});const n=this.cache_.sources.filter(l=>l.src&&l.src===t),s=[],a=this.$$("source"),o=[];for(let l=0;l<a.length;l++){const d=qi(a[l]);s.push(d),d.src&&d.src===t&&o.push(d.src)}o.length&&!n.length?this.cache_.sources=s:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=s=>this.updateSourceCaches_(s);const r=this.currentSource().src,n=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==r)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],s=>{if(s.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?pi(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!ce.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const r=this.el();let n=ce[this.fsApi_.fullscreenElement]===r;!n&&r.matches&&(n=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in p_)return d_(this.middleware_,this.tech_,e,t);if(e in jc)return qc(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(r){throw Ue(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in h_)return c_(this.middleware_,this.tech_,e);if(e in jc)return qc(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Ue(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Ue(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Ue(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=pi){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(la||vt);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=s=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&r&&this.load();return}const n=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||ii(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=ii(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=ii(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return tp(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let r=e.end(e.length-1);return r>t&&(r=t),r}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((r,n)=>{function s(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){s(),r()}function o(d,f){s(),n(f)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const l=t.requestFullscreenHelper_(e);l&&(l.then(s,s),l.then(r,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,r)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",s)}function s(){n(),t()}function a(l,d){n(),r(d)}e.one("fullscreenchange",s),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(n,n),o.then(t,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=ce[this.fsApi_.exitFullscreen]();return e&&pi(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=ce.documentElement.style.overflow,Ut(ce,"keydown",this.boundFullWindowOnEscKey_),ce.documentElement.style.overflow="hidden",sr(ce.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Tt(ce,"keydown",this.boundFullWindowOnEscKey_),ce.documentElement.style.overflow=this.docOrigOverflow,ca(ce.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&B.documentPictureInPicture){const e=ce.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(Le("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),B.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>($h(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",r=>{const n=r.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in ce&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(B.documentPictureInPicture&&B.documentPictureInPicture.window)return B.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in ce)return ce.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();return r.isContentEditable?!0:n==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(r.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:s=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const a=re.getComponent("FullscreenToggle");ce[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),re.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),re.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let r=0,n=this.options_.techOrder;r<n.length;r++){const s=n[r];let a=Re.getTech(s);if(a||(a=re.getComponent(s)),!a){Ue.error(`The "${s}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(o=>[o,Re.getTech(o)]).filter(([o,l])=>l?l.isSupported():(Ue.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(o,l,d){let f;return o.some(_=>l.some(w=>{if(f=d(_,w),f)return!0})),f};let n;const s=o=>(l,d)=>o(d,l),a=([o,l],d)=>{if(l.canPlaySource(d,this.options_[o.toLowerCase()]))return{source:d,tech:o}};return this.options_.sourceOrder?n=r(e,t,s(a)):n=r(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=op(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),u_(this,r[0],(n,s)=>{if(this.middleware_=s,t||(this.cache_.sources=r),this.updateSourceCaches_(n),this.src_(n)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}l_(s,this.tech_)}),r.length>1){const n=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",n)};this.one("error",n),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",s)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Qh(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();pi(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Ai(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:r,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:s}=r||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if($i("beforeerror").forEach(t=>{const r=t(this,e);if(!(vi(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new ot(e),this.addClass("vjs-error"),Ue.error(`(CODE:${this.error_.code} ${ot.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),$i("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,r;const n=et(this,this.reportUserActivity),s=function(_){(_.screenX!==t||_.screenY!==r)&&(t=_.screenX,r=_.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},o=function(_){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",s),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");l&&!vt&&!ri&&(l.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let d;const f=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(d);const _=this.options_.inactivityTimeout;_<=0||(d=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},_))};this.setInterval(f,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),r=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,r){if(this.tech_)return this.tech_.addTextTrack(e,t,r)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Ai(this)&&this.trigger("languagechange"))}languages(){return Qe(ze.prototype.options_.languages,this.languages_)}toJSON(){const e=Qe(this.options_),t=e.tracks;e.tracks=[];for(let r=0;r<t.length;r++){let n=t[r];n=Qe(n),n.player=void 0,e.tracks[r]=n}return e}createModal(e,t){t=t||{},t.content=e||"";const r=new Hr(this,t);return this.addChild(r),r.on("dispose",()=>{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let r=0;r<jo.length;r++){const n=jo[r],s=this.breakpoints_[n];if(t<=s){if(e===n)return;e&&this.removeClass(ws[e]),this.addClass(ws[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},Y_,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return ws[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const r=this.crossOrigin();this.reset(),this.cache_.media=Qe(e);const{artist:n,artwork:s,description:a,poster:o,src:l,textTracks:d,title:f}=this.cache_.media;!s&&o&&(this.cache_.media.artwork=[{src:o,type:Us(o)}]),r&&this.crossOrigin(r),l&&this.src(l),o&&this.poster(o),Array.isArray(d)&&d.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:f,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),s=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),n={src:t,textTracks:r};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:Us(n.poster)}]),n}return Qe(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},r=qi(e),n=r["data-setup"];if(Tn(e,"vjs-fill")&&(r.fill=!0),Tn(e,"vjs-fluid")&&(r.fluid=!0),n!==null)try{Object.assign(r,JSON.parse(n||"{}"))}catch(s){Ue.error("data-setup",s)}if(Object.assign(t,r),e.hasChildNodes()){const s=e.childNodes;for(let a=0,o=s.length;a<o;a++){const l=s[a],d=l.nodeName.toLowerCase();d==="source"?t.sources.push(qi(l)):d==="track"&&t.tracks.push(qi(l))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ze.prototype.videoTracks=()=>{};ze.prototype.audioTracks=()=>{};ze.prototype.textTracks=()=>{};ze.prototype.remoteTextTracks=()=>{};ze.prototype.remoteTextTrackEls=()=>{};It.names.forEach(function(i){const e=It[i];ze.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});ze.prototype.crossorigin=ze.prototype.crossOrigin;ze.players={};const fn=B.navigator;ze.prototype.options_={techOrder:Re.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:fn&&(fn.languages&&fn.languages[0]||fn.userLanguage||fn.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};Mp.forEach(function(i){ze.prototype[`handleTech${lt(i)}_`]=function(){return this.trigger(i)}});re.registerComponent("Player",ze);const qs="plugin",wr="activePlugins_",br={},js=i=>br.hasOwnProperty(i),xs=i=>js(i)?br[i]:void 0,Bp=(i,e)=>{i[wr]=i[wr]||{},i[wr][e]=!0},$s=(i,e,t)=>{const r=(t?"before":"")+"pluginsetup";i.trigger(r,e),i.trigger(r+":"+e.name,e)},Q_=function(i,e){const t=function(){$s(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return Bp(this,i),$s(this,{name:i,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},rd=(i,e)=>(e.prototype.name=i,function(...t){$s(this,{name:i,plugin:e,instance:null},!0);const r=new e(this,...t);return this[i]=()=>r,$s(this,r.getEventHash()),r});class Ft{constructor(e){if(this.constructor===Ft)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),gu(this),delete this.trigger,Yh(this,this.constructor.defaultState),Bp(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return $r(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[wr][e]=!1,this.player=this.state=null,t[e]=rd(e,br[e])}static isBasic(e){const t=typeof e=="string"?xs(e):e;return typeof t=="function"&&!Ft.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(js(e))Ue.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ze.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return br[e]=t,e!==qs&&(Ft.isBasic(t)?ze.prototype[e]=Q_(e,t):ze.prototype[e]=rd(e,t)),t}static deregisterPlugin(e){if(e===qs)throw new Error("Cannot de-register base plugin.");js(e)&&(delete br[e],delete ze.prototype[e])}static getPlugins(e=Object.keys(br)){let t;return e.forEach(r=>{const n=xs(r);n&&(t=t||{},t[r]=n)}),t}static getPluginVersion(e){const t=xs(e);return t&&t.VERSION||""}}Ft.getPlugin=xs;Ft.BASE_PLUGIN_NAME=qs;Ft.registerPlugin(qs,Ft);ze.prototype.usingPlugin=function(i){return!!this[wr]&&this[wr][i]===!0};ze.prototype.hasPlugin=function(i){return!!js(i)};function J_(i,e){let t=!1;return function(...r){return t||Ue.warn(i),t=!0,e.apply(this,r)}}function ni(i,e,t,r){return J_(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}var Z_={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const Up=i=>i.indexOf("#")===0?i.slice(1):i;function K(i,e,t){let r=K.getPlayer(i);if(r)return e&&Ue.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&r.ready(t),r;const n=typeof i=="string"?Hi("#"+Up(i)):i;if(!jr(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const s="getRootNode"in n&&n.getRootNode()instanceof B.ShadowRoot?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!s.contains(n))&&Ue.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),$i("beforesetup").forEach(o=>{const l=o(n,Qe(e));if(!vi(l)||Array.isArray(l)){Ue.error("please return an object in beforesetup hooks");return}e=Qe(e,l)});const a=re.getComponent("Player");return r=new a(n,e,t),$i("setup").forEach(o=>o(r)),r}K.hooks_=xi;K.hooks=$i;K.hook=O2;K.hookOnce=N2;K.removeHook=Th;if(B.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&qr()){let i=Hi(".vjs-styles-defaults");if(!i){i=zh("vjs-styles-defaults");const e=Hi("head");e&&e.insertBefore(i,e.firstChild),Wh(i,`
206
+ .video-js {
207
+ width: 300px;
208
+ height: 150px;
209
+ }
210
+
211
+ .vjs-fluid:not(.vjs-audio-only-mode) {
212
+ padding-top: 56.25%
213
+ }
214
+ `)}}No(1,K);K.VERSION=Io;K.options=ze.prototype.options_;K.getPlayers=()=>ze.players;K.getPlayer=i=>{const e=ze.players;let t;if(typeof i=="string"){const r=Up(i),n=e[r];if(n)return n;t=Hi("#"+r)}else t=i;if(jr(t)){const{player:r,playerId:n}=t;if(r||e[n])return r||e[n]}};K.getAllPlayers=()=>Object.keys(ze.players).map(i=>ze.players[i]).filter(Boolean);K.players=ze.players;K.getComponent=re.getComponent;K.registerComponent=(i,e)=>(Re.isTech(e)&&Ue.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),re.registerComponent.call(re,i,e));K.getTech=Re.getTech;K.registerTech=Re.registerTech;K.use=o_;Object.defineProperty(K,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(K.middleware,"TERMINATOR",{value:Bs,writeable:!1,enumerable:!0});K.browser=Ih;K.obj=M2;K.mergeOptions=ni(9,"videojs.mergeOptions","videojs.obj.merge",Qe);K.defineLazyProperty=ni(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",sa);K.bind=ni(9,"videojs.bind","native Function.prototype.bind",et);K.registerPlugin=Ft.registerPlugin;K.deregisterPlugin=Ft.deregisterPlugin;K.plugin=(i,e)=>(Ue.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Ft.registerPlugin(i,e));K.getPlugins=Ft.getPlugins;K.getPlugin=Ft.getPlugin;K.getPluginVersion=Ft.getPluginVersion;K.addLanguage=function(i,e){return i=(""+i).toLowerCase(),K.options.languages=Qe(K.options.languages,{[i]:e}),K.options.languages[i]};K.log=Ue;K.createLogger=Sh;K.time=J2;K.createTimeRange=ni(9,"videojs.createTimeRange","videojs.time.createTimeRanges",ii);K.createTimeRanges=ni(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",ii);K.formatTime=ni(9,"videojs.formatTime","videojs.time.formatTime",lr);K.setFormatTime=ni(9,"videojs.setFormatTime","videojs.time.setFormatTime",Zh);K.resetFormatTime=ni(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",ep);K.parseUrl=ni(9,"videojs.parseUrl","videojs.url.parseUrl",bu);K.isCrossOrigin=ni(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",ya);K.EventTarget=qt;K.any=fu;K.on=Ut;K.one=ga;K.off=Tt;K.trigger=$r;K.xhr=ah;K.TrackList=cr;K.TextTrack=Fn;K.TextTrackList=yu;K.AudioTrack=sp;K.AudioTrackList=ip;K.VideoTrack=ap;K.VideoTrackList=rp;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{K[i]=function(){return Ue.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),Hh[i].apply(null,arguments)}});K.computedStyle=ni(9,"videojs.computedStyle","videojs.dom.computedStyle",Br);K.dom=Hh;K.fn=W2;K.num=A_;K.str=Y2;K.url=s_;K.Error=Z_;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class e1{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(r){t.enabled_(r)}}),t}}class Hs extends K.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const r=this.levels_.length;return t=new e1(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let r=0,n=this.length;r<n;r++)if(this[r]===e){t=this.levels_.splice(r,1)[0],this.selectedIndex_===r?this.selectedIndex_=-1:this.selectedIndex_>r&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,r=this.length;t<r;t++){const n=this[t];if(n.id===e)return n}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Hs.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const i in Hs.prototype.allowedEvents_)Hs.prototype["on"+i]=null;var qp="4.1.0";const t1=function(i,e){const t=i.qualityLevels,r=new Hs,n=function(){r.dispose(),i.qualityLevels=t,i.off("dispose",n)};return i.on("dispose",n),i.qualityLevels=()=>r,i.qualityLevels.VERSION=qp,r},jp=function(i){return t1(this,K.obj.merge({},i))};K.registerPlugin("qualityLevels",jp);jp.VERSION=qp;/*! @name @videojs/http-streaming @version 3.17.2 @license Apache-2.0 */const Ot=ta,Vs=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,Kt=i=>K.log.debug?K.log.debug.bind(K,"VHS:",`${i} >`):function(){};function We(...i){const e=K.obj||K;return(e.merge||e.mergeOptions).apply(e,i)}function Ct(...i){const e=K.time||K;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function i1(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
215
+ `;for(let t=0;t<i.length;t++){const r=i.start(t),n=i.end(t);e+=`${r} --> ${n}. Duration (${n-r})
216
+ `}return e}const fi=1/30,gi=fi*3,$p=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r<i.length;r++)e(i.start(r),i.end(r))&&t.push([i.start(r),i.end(r)]);return Ct(t)},vr=function(i,e){return $p(i,function(t,r){return t-gi<=e&&r+gi>=e})},Ts=function(i,e){return $p(i,function(t){return t-fi>=e})},r1=function(i){if(i.length<2)return Ct();const e=[];for(let t=1;t<i.length;t++){const r=i.end(t-1),n=i.start(t);e.push([r,n])}return Ct(e)},n1=function(i,e){let t=null,r=null,n=0;const s=[],a=[];if(!i||!i.length||!e||!e.length)return Ct();let o=i.length;for(;o--;)s.push({time:i.start(o),type:"start"}),s.push({time:i.end(o),type:"end"});for(o=e.length;o--;)s.push({time:e.start(o),type:"start"}),s.push({time:e.end(o),type:"end"});for(s.sort(function(l,d){return l.time-d.time}),o=0;o<s.length;o++)s[o].type==="start"?(n++,n===2&&(t=s[o].time)):s[o].type==="end"&&(n--,n===1&&(r=s[o].time)),t!==null&&r!==null&&(a.push([t,r]),t=null,r=null);return Ct(a)},Hp=i=>{const e=[];if(!i||!i.length)return"";for(let t=0;t<i.length;t++)e.push(i.start(t)+" => "+i.end(t));return e.join(", ")},s1=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},rr=i=>{const e=[];for(let t=0;t<i.length;t++)e.push({start:i.start(t),end:i.end(t)});return e},a1=function(i,e){if(i===e)return!1;if(!i&&e||!e&&i||i.length!==e.length)return!0;for(let t=0;t<i.length;t++)if(i.start(t)!==e.start(t)||i.end(t)!==e.end(t))return!0;return!1},mo=function(i){if(!(!i||!i.length||!i.end))return i.end(i.length-1)},Ru=function(i,e){let t=0;if(!i||!i.length)return t;for(let r=0;r<i.length;r++){const n=i.start(r),s=i.end(r);if(!(e>s)){if(e>n&&e<=s){t+=s-e;continue}t+=s-n}}return t},Mu=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},$o=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(n,s){e.push({duration:n.duration,segmentIndex:r,partIndex:s,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),Vp=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},zp=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((n,s)=>n+(s.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},Wp=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=Vp(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},o1=function(i,e){let t=0,r=e-i.mediaSequence,n=i.segments[r];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;r--;){if(n=i.segments[r],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Mu(i,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},u1=function(i,e){let t=0,r,n=e-i.mediaSequence;for(;n<i.segments.length;n++){if(r=i.segments[n],typeof r.start<"u")return{result:r.start-t,precise:!0};if(t+=Mu(i,r),typeof r.end<"u")return{result:r.end-t,precise:!0}}return{result:-1,precise:!1}},Gp=function(i,e,t){if(typeof e>"u"&&(e=i.mediaSequence+i.segments.length),e<i.mediaSequence)return 0;const r=o1(i,e);if(r.precise)return r.result;const n=u1(i,e);return n.precise?n.result:r.result+t},Xp=function(i,e,t){if(!i)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return B.Infinity}return Gp(i,e,t)},En=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:r}){let n=0;if(t>r&&([t,r]=[r,t]),t<0){for(let s=t;s<Math.min(0,r);s++)n+=i;t=0}for(let s=t;s<r;s++)n+=e[s].duration;return n},Kp=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return Xp(i);if(e===null)return null;e=e||0;let n=Gp(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:Wp(null,i),n-=r),Math.max(0,n)},l1=function(i,e,t){const r=e||0;let n=Kp(i,e,!0,t);return n===null?Ct():(n<r&&(n=r),Ct(r,n))},c1=function({playlist:i,currentTime:e,startingSegmentIndex:t,startingPartIndex:r,startTime:n,exactManifestTimings:s}){let a=e-n;const o=$o(i);let l=0;for(let d=0;d<o.length;d++){const f=o[d];if(t===f.segmentIndex&&!(typeof r=="number"&&typeof f.partIndex=="number"&&r!==f.partIndex)){l=d;break}}if(a<0){if(l>0)for(let d=l-1;d>=0;d--){const f=o[d];if(a+=f.duration,s){if(a<0)continue}else if(a+fi<=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n-En({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:d})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(l<0){for(let d=l;d<0;d++)if(a-=i.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};l=0}for(let d=l;d<o.length;d++){const f=o[d];a-=f.duration;const _=f.duration>fi,w=a===0,T=_&&a+fi>=0;if(!((w||T)&&d!==o.length-1)){if(s){if(a>0)continue}else if(a-fi>=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n+En({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:d})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Yp=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Bu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Ta=function(i){const e=Yp(i);return!i.disabled&&!e},d1=function(i){return i.disabled},h1=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},Qp=function(i,e){return e.attributes&&e.attributes[i]},p1=function(i,e,t,r=0){return Qp("BANDWIDTH",t)?(i*t.attributes.BANDWIDTH-r*8)/e:NaN},Ho=(i,e)=>{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>Ta(r)?(r.attributes.BANDWIDTH||0)<t:!1).length===0},Uu=(i,e)=>!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),nd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const n in t){for(const s in t[n])if(r=e(t[n][s]),r)break;if(r)break}return!!r},Un=i=>{if(!i||!i.playlists||!i.playlists.length)return nd(i,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<i.playlists.length;e++){const t=i.playlists[e],r=t.attributes&&t.attributes.CODECS;if(!(r&&r.split(",").every(n=>lh(n))||nd(i,n=>Uu(t,n))))return!1}return!0};var Nt={liveEdgeDelay:Wp,duration:Xp,seekable:l1,getMediaInfoForTime:c1,isEnabled:Ta,isDisabled:d1,isExcluded:Yp,isIncompatible:Bu,playlistEnd:Kp,isAes:h1,hasAttribute:Qp,estimateSegmentRequestTime:p1,isLowestEnabledRendition:Ho,isAudioOnly:Un,playlistMatch:Uu,segmentDurationWithParts:Mu};const{log:Jp}=K,xr=(i,e)=>`${i}-${e}`,Zp=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,f1=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:n=[],llhls:s})=>{const a=new t0;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(d=>a.addParser(d)),n.forEach(d=>a.addTagMapper(d)),a.push(t),a.end();const o=a.manifest;if(s||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(d){o.hasOwnProperty(d)&&delete o[d]}),o.segments&&o.segments.forEach(function(d){["parts","preloadHints"].forEach(function(f){d.hasOwnProperty(f)&&delete d[f]})})),!o.targetDuration){let d=10;o.segments&&o.segments.length&&(d=o.segments.reduce((f,_)=>Math.max(f,_.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${d}`}),o.targetDuration=d}const l=Vp(o);if(l.length&&!o.partTargetDuration){const d=l.reduce((f,_)=>Math.max(f,_.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${d}`}),Jp.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=d}return o},Wr=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const n in i.mediaGroups[t][r]){const s=i.mediaGroups[t][r][n];e(s,t,r,n)}})},ef=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},g1=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];ef({playlist:t,id:xr(e,t.uri)}),t.resolvedUri=Ot(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||Jp.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},m1=i=>{Wr(i,e=>{e.uri&&(e.resolvedUri=Ot(i.uri,e.uri))})},y1=(i,e)=>{const t=xr(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:B.location.href,resolvedUri:B.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},tf=(i,e,t=Zp)=>{i.uri=e;for(let n=0;n<i.playlists.length;n++)if(!i.playlists[n].uri){const s=`placeholder-uri-${n}`;i.playlists[n].uri=s}const r=Un(i);Wr(i,(n,s,a,o)=>{if(!n.playlists||!n.playlists.length){if(r&&s==="AUDIO"&&!n.uri)for(let l=0;l<i.playlists.length;l++){const d=i.playlists[l];if(d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===a)return}n.playlists=[dt({},n)]}n.playlists.forEach(function(l,d){const f=t(s,a,o,l),_=xr(d,f);l.uri?l.resolvedUri=l.resolvedUri||Ot(i.uri,l.uri):(l.uri=d===0?f:_,l.resolvedUri=l.uri),l.id=l.id||_,l.attributes=l.attributes||{},i.playlists[l.id]=l,i.playlists[l.uri]=l})}),g1(i),m1(i)};class sd{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,r=t.startDate.getTime();this.trimProcessedDateRanges_(r),this.pendingDateRanges_=e.reduce((n,s)=>(n.set(s.id,s),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,n)=>{if(!this.processedDateRanges_.has(n)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const s=e[r.class].push(r);r.classListIndex=s-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const n=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&n[r.classListIndex+1]?r.endTime=n[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,r)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(r)})}}const rf=22,ur=({requestType:i,request:e,error:t,parseFailure:r})=>{const n=e.status<200||e.status>299,s=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},o=n&&!s||r;if(t&&s)a.error=dt({},t),a.errorType=K.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=K.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=K.Error.NetworkRequestTimeout;else if(o){const l=r?K.Error.NetworkBodyParserFailed:K.Error.NetworkBadStatus;a.errorType=l,a.status=e.status,a.headers=e.headers}return a},_1=Kt("CodecUtils"),nf=function(i){const e=i.attributes||{};if(e.CODECS)return ci(e.CODECS)},sf=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},b1=(i,e)=>{if(!sf(i,e))return!0;const t=e.attributes||{},r=i.mediaGroups.AUDIO[t.AUDIO];for(const n in r)if(!r[n].uri&&!r[n].playlists)return!0;return!1},Ln=function(i){const e={};return i.forEach(({mediaType:t,type:r,details:n})=>{e[t]=e[t]||[],e[t].push(uh(`${r}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){_1(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},ad=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},wn=function(i,e){const t=e.attributes||{},r=Ln(nf(e)||[]);if(sf(i,e)&&!r.audio&&!b1(i,e)){const n=Ln(r0(i,t.AUDIO)||[]);n.audio&&(r.audio=n.audio)}return r},{EventTarget:v1}=K,T1=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let n=e.mediaSequence+e.segments.length;if(r){const s=r.parts||[],a=zp(e)-1;a>-1&&a!==s.length-1&&(t._HLS_part=a),(a>-1||s.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new B.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&r.searchParams.set(n,t[n])}),i=r.toString()}return i},S1=(i,e)=>{if(!i)return e;const t=We(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r<e.parts.length;r++)i.parts&&i.parts[r]&&(t.parts[r]=We(i.parts[r],e.parts[r]));return!i.skipped&&e.skipped&&(t.skipped=!1),i.preload&&!e.preload&&(t.preload=!1),t},C1=(i,e,t)=>{const r=i.slice(),n=e.slice();t=t||0;const s=[];let a;for(let o=0;o<n.length;o++){const l=r[o+t],d=n[o];l?(a=l.map||a,s.push(S1(l,d))):(a&&!d.map&&(d.map=a),s.push(d))}return s},af=(i,e)=>{!i.resolvedUri&&i.uri&&(i.resolvedUri=Ot(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=Ot(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=Ot(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=Ot(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))})},of=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;r<t.preloadHints.length;r++)if(t.preloadHints[r].type==="MAP")return e}t.duration=i.targetDuration,t.preload=!0,e.push(t)}return e},uf=(i,e)=>i===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,Vo=(i,e,t=uf)=>{const r=We(i,{}),n=r.playlists[e.id];if(!n||t(n,e))return null;e.segments=of(e);const s=We(n,e);if(s.preloadSegment&&!e.preloadSegment&&delete s.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}s.segments=C1(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}s.segments.forEach(a=>{af(a,s.resolvedUri)});for(let a=0;a<r.playlists.length;a++)r.playlists[a].id===e.id&&(r.playlists[a]=s);return r.playlists[e.id]=s,r.playlists[e.uri]=s,Wr(i,(a,o,l,d)=>{if(a.playlists)for(let f=0;f<a.playlists.length;f++)e.id===a.playlists[f].id&&(a.playlists[f]=s)}),r},zo=(i,e)=>{const t=i.segments||[],r=t[t.length-1],n=r&&r.parts&&r.parts[r.parts.length-1],s=n&&n.duration||r&&r.duration;return e&&s?s*1e3:(i.partTargetDuration||i.targetDuration||10)*500},od=(i,e,t)=>{if(!i)return;const r=[];return i.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:s,RESOLUTION:a,CODECS:o}=n.attributes;r.push({id:n.id,bandwidth:s,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:r}};class Tr extends v1{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Kt("PlaylistLoader");const{withCredentials:n=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new sd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Ot(this.main.uri,e.uri);this.llhls&&(t=T1(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,n)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:n,id:s}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ur({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const r=f1({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!r.playlists||!r.playlists.length||this.excludeAudioOnlyVariants(r.playlists),r}catch(r){this.error=r,this.error.metadata={errorType:K.Error.StreamingHlsPlaylistParserError,error:r}}}excludeAudioOnlyVariants(e){const t=r=>{const n=r.attributes||{},{width:s,height:a}=n.RESOLUTION||{};if(s&&a)return!0;const o=nf(r)||[];return!!Ln(o).video};e.some(t)&&e.forEach(r=>{t(r)||(r.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:r,id:n}){this.request=null,this.state="HAVE_METADATA";const s={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:s});const a=t||this.parseManifest_({url:r,manifestString:e});a.lastRequest=Date.now(),ef({playlist:a,uri:r,id:n});const o=Vo(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(zo(this.media(),!!o)),s.parsedPlaylist=od(this.main.playlists,s.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:s}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),B.clearTimeout(this.mediaUpdateTimeout),B.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new sd,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(B.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=B.setTimeout(this.media.bind(this,e,!1),o);return}const r=this.state,n=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(zo(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(o,l)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Vs(e.resolvedUri,l),o)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:l.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=B.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=B.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=B.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,r)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:ur({requestType:r.requestType,request:r,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Vs(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=od(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,tf(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=of(r),r.segments.forEach(n=>{af(n,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||B.location.href;this.main=y1(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const r=this.main,n=e.ID;let s=r.playlists.length;for(;s--;){const a=r.playlists[s];if(a.attributes["PATHWAY-ID"]===n){const o=a.resolvedUri,l=a.id;if(t){const d=this.createCloneURI_(a.resolvedUri,e),f=xr(n,d),_=this.createCloneAttributes_(n,a.attributes),w=this.createClonePlaylist_(a,f,e,_);r.playlists[s]=w,r.playlists[f]=w,r.playlists[d]=w}else r.playlists.splice(s,1);delete r.playlists[l],delete r.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const r=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!r.mediaGroups[s]||!r.mediaGroups[s][n])){for(const a in r.mediaGroups[s])if(a===n){for(const o in r.mediaGroups[s][a])r.mediaGroups[s][a][o].playlists.forEach((l,d)=>{const f=r.playlists[l.id],_=f.id,w=f.resolvedUri;delete r.playlists[_],delete r.playlists[w]});delete r.mediaGroups[s][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const r=this.main,n=r.playlists.length,s=this.createCloneURI_(t.resolvedUri,e),a=xr(e.ID,s),o=this.createCloneAttributes_(e.ID,t.attributes),l=this.createClonePlaylist_(t,a,e,o);r.playlists[n]=l,r.playlists[a]=l,r.playlists[s]=l,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,r=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!n.mediaGroups[s]||n.mediaGroups[s][t]))for(const a in n.mediaGroups[s]){if(a===r)n.mediaGroups[s][t]={};else continue;for(const o in n.mediaGroups[s][a]){const l=n.mediaGroups[s][a][o];n.mediaGroups[s][t][o]=dt({},l);const d=n.mediaGroups[s][t][o],f=this.createCloneURI_(l.resolvedUri,e);d.resolvedUri=f,d.uri=f,d.playlists=[],l.playlists.forEach((_,w)=>{const T=n.playlists[_.id],k=Zp(s,t,o),b=xr(t,k);if(T&&!n.playlists[b]){const x=this.createClonePlaylist_(T,b,e),O=x.resolvedUri;n.playlists[b]=x,n.playlists[O]=x}d.playlists[w]=this.createClonePlaylist_(_,b,e)})}}})}createClonePlaylist_(e,t,r,n){const s=this.createCloneURI_(e.resolvedUri,r),a={resolvedUri:s,uri:s,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),We(e,a)}createCloneURI_(e,t){const r=new URL(e);r.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const s of Object.keys(n))r.searchParams.set(s,n[s]);return r.href}createCloneAttributes_(e,t){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(r[n]=e)}),r}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const r in e.contentProtection)if(e.contentProtection[r]&&e.contentProtection[r].attributes&&e.contentProtection[r].attributes.keyId){const n=e.contentProtection[r].attributes.keyId;t.add(n.toLowerCase())}return t}}const Wo=function(i,e,t,r){const n=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&n&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=n.byteLength||n.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(n||i.responseText)))),r(e,i)},E1=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},w1=(i,e,t,r)=>{!i||!i.size||i.forEach(n=>{n(e,t,r)})},lf=function(){const i=function e(t,r){t=We({timeout:45e3},t);const n=e.beforeRequest||K.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||K.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||K.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(K.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(n));const o=K.Vhs.xhr.original===!0?K.xhr:K.Vhs.xhr,l=E1(s,t);s.delete(n);const d=o(l||t,function(_,w){return w1(a,d,_,w),Wo(d,_,w,r)}),f=d.abort;return d.abort=function(){return d.aborted=!0,f.apply(d,arguments)},d.uri=t.uri,d.requestType=t.requestType,d.requestTime=Date.now(),d};return i.original=!0,i},x1=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=B.BigInt(i.offset)+B.BigInt(i.length)-B.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},Go=function(i){const e={};return i.byterange&&(e.Range=x1(i.byterange)),e},k1=function(i,e){return i.start(e)+"-"+i.end(e)},A1=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},D1=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},cf=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];dh(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},zs=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},df=function(i){return i.resolvedUri},hf=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",n,s;for(let a=0;a<e.length/t;a++)n=e.slice(a*t,a*t+t).map(A1).join(""),s=e.slice(a*t,a*t+t).map(D1).join(""),r+=n+" "+s+`
217
+ `;return r},I1=({bytes:i})=>hf(i),P1=i=>{let e="",t;for(t=0;t<i.length;t++)e+=k1(i,t)+" ";return e};var L1=Object.freeze({__proto__:null,createTransferableMessage:cf,initSegmentId:zs,segmentKeyId:df,hexDump:hf,tagDump:I1,textRanges:P1});const pf=.25,O1=(i,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},N1=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,F1=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(t<new Date(r.dateTimeObject))return null;for(let l=0;l<e.segments.length-1;l++){r=e.segments[l];const d=new Date(e.segments[l+1].dateTimeObject);if(t<d)break}const n=e.segments[e.segments.length-1],s=n.dateTimeObject,a=n.videoTimingInfo?N1(n.videoTimingInfo):n.duration+n.duration*pf,o=new Date(s.getTime()+a*1e3);return t>o?null:(t>new Date(s)&&(r=n),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Nt.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},R1=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let s=0;s<e.segments.length&&(r=e.segments[s],t=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:t+r.duration,!(i<=t));s++);const n=e.segments[e.segments.length-1];if(n.videoTimingInfo&&n.videoTimingInfo.transmuxedPresentationEnd<i)return null;if(i>t){if(i>t+n.duration*pf)return null;r=n}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},M1=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const n=t.getTime();return(r.getTime()-n)/1e3},B1=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e<i.segments.length;e++)if(!i.segments[e].dateTimeObject)return!1;return!0},U1=({playlist:i,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=R1(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const n={mediaSeconds:e},s=O1(e,r.segment);return s&&(n.programDateTime=s.toISOString()),t(null,n)},ff=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:n=!0,tech:s,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!s.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!B1(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=F1(i,e);if(!o)return a({message:`${i} was not found in the stream`});const l=o.segment,d=M1(l.dateTimeObject,i);if(o.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(o.estimatedStart+d),s.one("seeked",()=>{ff({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:n,tech:s,callback:a})});return}const f=l.start+d,_=()=>a(null,s.currentTime());s.one("seeked",_),n&&s.pause(),r(f)},yo=(i,e)=>{if(i.readyState===4)return e()},q1=(i,e,t,r)=>{let n=[],s,a=!1;const o=function(f,_,w,T){return _.abort(),a=!0,t(f,_,w,T)},l=function(f,_){if(a)return;if(f)return f.metadata=ur({requestType:r,request:_,error:f}),o(f,_,"",n);const w=_.responseText.substring(n&&n.byteLength||0,_.responseText.length);if(n=p0(n,hh(w,!0)),s=s||mn(n),n.length<10||s&&n.length<s+2)return yo(_,()=>o(f,_,"",n));const T=lu(n);return T==="ts"&&n.length<188?yo(_,()=>o(f,_,"",n)):!T&&n.length<376?yo(_,()=>o(f,_,"",n)):o(null,_,T,n)},d=e({uri:i,beforeSend(f){f.overrideMimeType("text/plain; charset=x-user-defined"),f.addEventListener("progress",function({total:_,loaded:w}){return Wo(f,null,{statusCode:f.status},l)})}},function(f,_){return Wo(d,f,_,l)});return d},{EventTarget:j1}=K,ud=function(i,e){if(!uf(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length)||!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t<i.segments.length;t++){const r=i.segments[t],n=e.segments[t];if(r.uri!==n.uri)return!1;if(!r.byterange&&!n.byterange)continue;const s=r.byterange,a=n.byterange;if(s&&!a||!s&&a||s.offset!==a.offset||s.length!==a.length)return!1}return!0},$1=(i,e,t,r)=>{const n=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${n}`},H1=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:n})=>{const s=d2(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:n});return tf(s,e,$1),s},V1=(i,e)=>{Wr(i,(t,r,n,s)=>{(!e.mediaGroups[r][n]||!(s in e.mediaGroups[r][n]))&&delete i.mediaGroups[r][n][s]})},z1=(i,e,t)=>{let r=!0,n=We(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let s=0;s<e.playlists.length;s++){const a=e.playlists[s];if(a.sidx){const l=ra(a.sidx);t&&t[l]&&t[l].sidx&&au(a,t[l].sidx,a.sidx.resolvedUri)}const o=Vo(n,a,ud);o&&(n=o,r=!1)}return Wr(e,(s,a,o,l)=>{if(s.playlists&&s.playlists.length){const d=s.playlists[0].id,f=Vo(n,s.playlists[0],ud);f&&(n=f,l in n.mediaGroups[a][o]||(n.mediaGroups[a][o][l]=s),n.mediaGroups[a][o][l].playlists[0]=n.playlists[d],r=!1)}}),V1(n,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:n},W1=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,ld=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const s=ra(n);if(!e[s])break;const a=e[s].sidxInfo;W1(a,n)&&(t[s]=e[s])}}return t},G1=(i,e)=>{let t=ld(i.playlists,e);return Wr(i,(r,n,s,a)=>{if(r.playlists&&r.playlists.length){const o=r.playlists;t=We(t,ld(o,e))}}),t};class Xo extends j1{constructor(e,t,r={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:s=!1}=r;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Kt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const n=e.sidx&&ra(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){B.clearTimeout(this.mediaRequest_),this.mediaRequest_=B.setTimeout(()=>r(!1),0);return}const s=Vs(e.sidx.resolvedUri),a=(l,d)=>{if(this.requestErrored_(l,d,t))return;const f=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=d;let w;try{w=m2(Ie(d.response).subarray(8))}catch(T){T.metadata=ur({requestType:_,request:d,parseFailure:!0}),this.requestErrored_(T,d,t);return}return f[n]={sidxInfo:e.sidx,sidx:w},au(e,w,e.sidx.resolvedUri),r(!0)},o="dash-sidx";this.request=q1(s,this.vhs_.xhr,(l,d,f,_)=>{if(l)return a(l,d);if(!f||f!=="mp4"){const k=f||"unknown";return a({status:d.status,message:`Unsupported ${k} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},d)}const{offset:w,length:T}=e.sidx.byterange;if(_.length>=T+w)return a(l,{response:_.subarray(w,w+T),status:d.status,uri:d.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",requestType:"dash-sidx",headers:Go({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},B.clearTimeout(this.minimumUpdatePeriodTimeout_),B.clearTimeout(this.mediaRequest_),B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,B.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(B.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,B.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=B.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){B.clearTimeout(this.mediaRequest_),this.mediaRequest_=B.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,n)=>{if(r){const{requestType:a}=n;r.metadata=ur({requestType:a,request:n,error:r})}if(this.requestErrored_(r,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const s=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Vs(this.mainPlaylistLoader_.srcUrl,n),s){this.handleMain_(),this.syncClientServerClock_(()=>e(n,s));return}return e(n,s)})}syncClientServerClock_(e){const t=h2(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Ot(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,n)=>{if(!this.request)return;if(r){const{requestType:a}=n;return this.error.metadata=ur({requestType:a,request:n,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let s;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?s=this.mainLoaded_:s=Date.parse(n.responseHeaders.date):s=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){B.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let r;try{r=H1({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(s){this.error=s,this.error.metadata={errorType:K.Error.StreamingDashManifestParserError,error:s},this.trigger("error")}e&&(r=z1(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:s,endList:a}=r,o=[];r.playlists.forEach(d=>{o.push({id:d.id,bandwidth:d.attributes.BANDWIDTH,resolution:d.attributes.RESOLUTION,codecs:d.attributes.CODECS})});const l={duration:s,isLive:!a,renditions:o};t.parsedManifest=l,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(B.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=B.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=G1(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=B.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},zo(this.media(),!!r)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const n=e.contentProtection[r].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var mt={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const X1=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer},gf=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},K1=function(i){try{return URL.createObjectURL(new Blob([i],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(i),URL.createObjectURL(e.getBlob())}},mf=function(i){return function(){const e=K1(i),t=gf(new Worker(e));t.objURL=e;const r=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),r.call(this)},t}},yf=function(i){return`var browserWorkerPolyFill = ${gf.toString()};
218
+ browserWorkerPolyFill(self);
219
+ `+i},_f=function(i){return i.toString().replace(/^function.+?{/,"").slice(0,-1)},Y1=yf(_f(function(){var i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var u={};this.on=function(c,p){u[c]||(u[c]=[]),u[c]=u[c].concat(p)},this.off=function(c,p){var h;return u[c]?(h=u[c].indexOf(p),u[c]=u[c].slice(),u[c].splice(h,1),h>-1):!1},this.trigger=function(c){var p,h,g,m;if(p=u[c],!!p)if(arguments.length===2)for(g=p.length,h=0;h<g;++h)p[h].call(this,arguments[1]);else{for(m=[],h=arguments.length,h=1;h<arguments.length;++h)m.push(arguments[h]);for(g=p.length,h=0;h<g;++h)p[h].apply(this,m)}},this.dispose=function(){u={}}}};e.prototype.pipe=function(u){return this.on("data",function(c){u.push(c)}),this.on("done",function(c){u.flush(c)}),this.on("partialdone",function(c){u.partialFlush(c)}),this.on("endedtimeline",function(c){u.endTimeline(c)}),this.on("reset",function(c){u.reset(c)}),u},e.prototype.push=function(u){this.trigger("data",u)},e.prototype.flush=function(u){this.trigger("done",u)},e.prototype.partialFlush=function(u){this.trigger("partialdone",u)},e.prototype.endTimeline=function(u){this.trigger("endedtimeline",u)},e.prototype.reset=function(u){this.trigger("reset",u)};var t=e,r=Math.pow(2,32),n=function(u){var c=new DataView(u.buffer,u.byteOffset,u.byteLength),p;return c.getBigUint64?(p=c.getBigUint64(0),p<Number.MAX_SAFE_INTEGER?Number(p):p):c.getUint32(0)*r+c.getUint32(4)},s={getUint64:n,MAX_UINT32:r},a=s.MAX_UINT32,o,l,d,f,_,w,T,k,b,x,O,C,A,z,V,U,I,L,v,y,M,F,H,X,G,te,N,j,Y,Q,ee,ue,le,he,fe,Fe;(function(){var u;if(H={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(u in H)H.hasOwnProperty(u)&&(H[u]=[u.charCodeAt(0),u.charCodeAt(1),u.charCodeAt(2),u.charCodeAt(3)]);X=new Uint8Array([105,115,111,109]),te=new Uint8Array([97,118,99,49]),G=new Uint8Array([0,0,0,1]),N=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]),j=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]),Y={video:N,audio:j},ue=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ee=new Uint8Array([0,0,0,0,0,0,0,0]),le=new Uint8Array([0,0,0,0,0,0,0,0]),he=le,fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Fe=le,Q=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(u){var c=[],p=0,h,g,m;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)p+=c[h].byteLength;for(g=new Uint8Array(p+8),m=new DataView(g.buffer,g.byteOffset,g.byteLength),m.setUint32(0,g.byteLength),g.set(u,4),h=0,p=8;h<c.length;h++)g.set(c[h],p),p+=c[h].byteLength;return g},l=function(){return o(H.dinf,o(H.dref,ue))},d=function(u){return o(H.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,u.audioobjecttype<<3|u.samplingfrequencyindex>>>1,u.samplingfrequencyindex<<7|u.channelcount<<3,6,1,2]))},f=function(){return o(H.ftyp,X,G,X,te)},U=function(u){return o(H.hdlr,Y[u])},_=function(u){return o(H.mdat,u)},V=function(u){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,u.duration>>>24&255,u.duration>>>16&255,u.duration>>>8&255,u.duration&255,85,196,0,0]);return u.samplerate&&(c[12]=u.samplerate>>>24&255,c[13]=u.samplerate>>>16&255,c[14]=u.samplerate>>>8&255,c[15]=u.samplerate&255),o(H.mdhd,c)},z=function(u){return o(H.mdia,V(u),U(u.type),T(u))},w=function(u){return o(H.mfhd,new Uint8Array([0,0,0,0,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255]))},T=function(u){return o(H.minf,u.type==="video"?o(H.vmhd,Q):o(H.smhd,ee),l(),L(u))},k=function(u,c){for(var p=[],h=c.length;h--;)p[h]=y(c[h]);return o.apply(null,[H.moof,w(u)].concat(p))},b=function(u){for(var c=u.length,p=[];c--;)p[c]=C(u[c]);return o.apply(null,[H.moov,O(4294967295)].concat(p).concat(x(u)))},x=function(u){for(var c=u.length,p=[];c--;)p[c]=M(u[c]);return o.apply(null,[H.mvex].concat(p))},O=function(u){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255,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]);return o(H.mvhd,c)},I=function(u){var c=u.samples||[],p=new Uint8Array(4+c.length),h,g;for(g=0;g<c.length;g++)h=c[g].flags,p[g+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return o(H.sdtp,p)},L=function(u){return o(H.stbl,v(u),o(H.stts,Fe),o(H.stsc,he),o(H.stsz,fe),o(H.stco,le))},(function(){var u,c;v=function(p){return o(H.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),p.type==="video"?u(p):c(p))},u=function(p){var h=p.sps||[],g=p.pps||[],m=[],D=[],P,R;for(P=0;P<h.length;P++)m.push((h[P].byteLength&65280)>>>8),m.push(h[P].byteLength&255),m=m.concat(Array.prototype.slice.call(h[P]));for(P=0;P<g.length;P++)D.push((g[P].byteLength&65280)>>>8),D.push(g[P].byteLength&255),D=D.concat(Array.prototype.slice.call(g[P]));if(R=[H.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,(p.width&65280)>>8,p.width&255,(p.height&65280)>>8,p.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(H.avcC,new Uint8Array([1,p.profileIdc,p.profileCompatibility,p.levelIdc,255].concat([h.length],m,[g.length],D))),o(H.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],p.sarRatio){var q=p.sarRatio[0],W=p.sarRatio[1];R.push(o(H.pasp,new Uint8Array([(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255,(W&4278190080)>>24,(W&16711680)>>16,(W&65280)>>8,W&255])))}return o.apply(null,R)},c=function(p){return o(H.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(p.channelcount&65280)>>8,p.channelcount&255,(p.samplesize&65280)>>8,p.samplesize&255,0,0,0,0,(p.samplerate&65280)>>8,p.samplerate&255,0,0]),d(p))}})(),A=function(u){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,0,(u.duration&4278190080)>>24,(u.duration&16711680)>>16,(u.duration&65280)>>8,u.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(u.width&65280)>>8,u.width&255,0,0,(u.height&65280)>>8,u.height&255,0,0]);return o(H.tkhd,c)},y=function(u){var c,p,h,g,m,D,P;return c=o(H.tfhd,new Uint8Array([0,0,0,58,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),D=Math.floor(u.baseMediaDecodeTime/a),P=Math.floor(u.baseMediaDecodeTime%a),p=o(H.tfdt,new Uint8Array([1,0,0,0,D>>>24&255,D>>>16&255,D>>>8&255,D&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255])),m=92,u.type==="audio"?(h=F(u,m),o(H.traf,c,p,h)):(g=I(u),h=F(u,g.length+m),o(H.traf,c,p,h,g))},C=function(u){return u.duration=u.duration||4294967295,o(H.trak,A(u),z(u))},M=function(u){var c=new Uint8Array([0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return u.type!=="video"&&(c[c.length-1]=0),o(H.trex,c)},(function(){var u,c,p;p=function(h,g){var m=0,D=0,P=0,R=0;return h.length&&(h[0].duration!==void 0&&(m=1),h[0].size!==void 0&&(D=2),h[0].flags!==void 0&&(P=4),h[0].compositionTimeOffset!==void 0&&(R=8)),[0,0,m|D|P|R,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(g&4278190080)>>>24,(g&16711680)>>>16,(g&65280)>>>8,g&255]},c=function(h,g){var m,D,P,R,q,W;for(R=h.samples||[],g+=20+16*R.length,P=p(R,g),D=new Uint8Array(P.length+R.length*16),D.set(P),m=P.length,W=0;W<R.length;W++)q=R[W],D[m++]=(q.duration&4278190080)>>>24,D[m++]=(q.duration&16711680)>>>16,D[m++]=(q.duration&65280)>>>8,D[m++]=q.duration&255,D[m++]=(q.size&4278190080)>>>24,D[m++]=(q.size&16711680)>>>16,D[m++]=(q.size&65280)>>>8,D[m++]=q.size&255,D[m++]=q.flags.isLeading<<2|q.flags.dependsOn,D[m++]=q.flags.isDependedOn<<6|q.flags.hasRedundancy<<4|q.flags.paddingValue<<1|q.flags.isNonSyncSample,D[m++]=q.flags.degradationPriority&61440,D[m++]=q.flags.degradationPriority&15,D[m++]=(q.compositionTimeOffset&4278190080)>>>24,D[m++]=(q.compositionTimeOffset&16711680)>>>16,D[m++]=(q.compositionTimeOffset&65280)>>>8,D[m++]=q.compositionTimeOffset&255;return o(H.trun,D)},u=function(h,g){var m,D,P,R,q,W;for(R=h.samples||[],g+=20+8*R.length,P=p(R,g),m=new Uint8Array(P.length+R.length*8),m.set(P),D=P.length,W=0;W<R.length;W++)q=R[W],m[D++]=(q.duration&4278190080)>>>24,m[D++]=(q.duration&16711680)>>>16,m[D++]=(q.duration&65280)>>>8,m[D++]=q.duration&255,m[D++]=(q.size&4278190080)>>>24,m[D++]=(q.size&16711680)>>>16,m[D++]=(q.size&65280)>>>8,m[D++]=q.size&255;return o(H.trun,m)},F=function(h,g){return h.type==="audio"?u(h,g):c(h,g)}})();var xe={ftyp:f,mdat:_,moof:k,moov:b,initSegment:function(u){var c=f(),p=b(u),h;return h=new Uint8Array(c.byteLength+p.byteLength),h.set(c),h.set(p,c.byteLength),h}},oe=function(u){var c,p,h=[],g=[];for(g.byteLength=0,g.nalCount=0,g.duration=0,h.byteLength=0,c=0;c<u.length;c++)p=u[c],p.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=p.dts-h.dts,g.byteLength+=h.byteLength,g.nalCount+=h.length,g.duration+=h.duration,g.push(h)),h=[p],h.byteLength=p.data.byteLength,h.pts=p.pts,h.dts=p.dts):(p.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=p.dts-h.dts,h.byteLength+=p.data.byteLength,h.push(p));return g.length&&(!h.duration||h.duration<=0)&&(h.duration=g[g.length-1].duration),g.byteLength+=h.byteLength,g.nalCount+=h.length,g.duration+=h.duration,g.push(h),g},ge=function(u){var c,p,h=[],g=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=u[0].pts,h.dts=u[0].dts,g.byteLength=0,g.nalCount=0,g.duration=0,g.pts=u[0].pts,g.dts=u[0].dts,c=0;c<u.length;c++)p=u[c],p.keyFrame?(h.length&&(g.push(h),g.byteLength+=h.byteLength,g.nalCount+=h.nalCount,g.duration+=h.duration),h=[p],h.nalCount=p.length,h.byteLength=p.byteLength,h.pts=p.pts,h.dts=p.dts,h.duration=p.duration):(h.duration+=p.duration,h.nalCount+=p.length,h.byteLength+=p.byteLength,h.push(p));return g.length&&h.duration<=0&&(h.duration=g[g.length-1].duration),g.byteLength+=h.byteLength,g.nalCount+=h.nalCount,g.duration+=h.duration,g.push(h),g},Ee=function(u){var c;return!u[0][0].keyFrame&&u.length>1&&(c=u.shift(),u.byteLength-=c.byteLength,u.nalCount-=c.nalCount,u[0][0].dts=c.dts,u[0][0].pts=c.pts,u[0][0].duration+=c.duration),u},Ce=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Me=function(u,c){var p=Ce();return p.dataOffset=c,p.compositionTimeOffset=u.pts-u.dts,p.duration=u.duration,p.size=4*u.length,p.size+=u.byteLength,u.keyFrame&&(p.flags.dependsOn=2,p.flags.isNonSyncSample=0),p},Ge=function(u,c){var p,h,g,m,D,P=c||0,R=[];for(p=0;p<u.length;p++)for(m=u[p],h=0;h<m.length;h++)D=m[h],g=Me(D,P),P+=g.size,R.push(g);return R},ye=function(u){var c,p,h,g,m,D,P=0,R=u.byteLength,q=u.nalCount,W=R+4*q,ie=new Uint8Array(W),me=new DataView(ie.buffer);for(c=0;c<u.length;c++)for(g=u[c],p=0;p<g.length;p++)for(m=g[p],h=0;h<m.length;h++)D=m[h],me.setUint32(P,D.data.byteLength),P+=4,ie.set(D.data,P),P+=D.data.byteLength;return ie},be=function(u,c){var p,h=c||0,g=[];return p=Me(u,h),g.push(p),g},Te=function(u){var c,p,h=0,g=u.byteLength,m=u.length,D=g+4*m,P=new Uint8Array(D),R=new DataView(P.buffer);for(c=0;c<u.length;c++)p=u[c],R.setUint32(h,p.data.byteLength),h+=4,P.set(p.data,h),h+=p.data.byteLength;return P},_e={groupNalsIntoFrames:oe,groupFramesIntoGops:ge,extendFirstKeyFrame:Ee,generateSampleTable:Ge,concatenateNalData:ye,generateSampleTableForFrame:be,concatenateNalDataForFrame:Te},se=[33,16,5,32,164,27],Se=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ne=function(u){for(var c=[];u--;)c.push(0);return c},de=function(u){return Object.keys(u).reduce(function(c,p){return c[p]=new Uint8Array(u[p].reduce(function(h,g){return h.concat(g)},[])),c},{})},we,qe=function(){if(!we){var u={96e3:[se,[227,64],ne(154),[56]],88200:[se,[231],ne(170),[56]],64e3:[se,[248,192],ne(240),[56]],48e3:[se,[255,192],ne(268),[55,148,128],ne(54),[112]],44100:[se,[255,192],ne(268),[55,163,128],ne(84),[112]],32e3:[se,[255,192],ne(268),[55,234],ne(226),[112]],24e3:[se,[255,192],ne(268),[55,255,128],ne(268),[111,112],ne(126),[224]],16e3:[se,[255,192],ne(268),[55,255,128],ne(268),[111,255],ne(269),[223,108],ne(195),[1,192]],12e3:[Se,ne(268),[3,127,248],ne(268),[6,255,240],ne(268),[13,255,224],ne(268),[27,253,128],ne(259),[56]],11025:[Se,ne(268),[3,127,248],ne(268),[6,255,240],ne(268),[13,255,224],ne(268),[27,255,192],ne(268),[55,175,128],ne(108),[112]],8e3:[Se,ne(268),[3,121,16],ne(47),[7]]};we=de(u)}return we},He=9e4,bt,je,ft,Yt,si,dr,hr;bt=function(u){return u*He},je=function(u,c){return u*c},ft=function(u){return u/He},Yt=function(u,c){return u/c},si=function(u,c){return bt(Yt(u,c))},dr=function(u,c){return je(ft(u),c)},hr=function(u,c,p){return ft(p?u:u-c)};var Ve={ONE_SECOND_IN_TS:He,secondsToVideoTs:bt,secondsToAudioTs:je,videoTsToSeconds:ft,audioTsToSeconds:Yt,audioTsToVideoTs:si,videoTsToAudioTs:dr,metadataTsToSeconds:hr},Gr=qe,zi=Ve,jn=function(u){var c,p,h=0;for(c=0;c<u.length;c++)p=u[c],h+=p.data.byteLength;return h},$n=function(u,c,p,h){var g,m=0,D=0,P=0,R=0,q,W,ie;if(c.length&&(g=zi.audioTsToVideoTs(u.baseMediaDecodeTime,u.samplerate),m=Math.ceil(zi.ONE_SECOND_IN_TS/(u.samplerate/1024)),p&&h&&(D=g-Math.max(p,h),P=Math.floor(D/m),R=P*m),!(P<1||R>zi.ONE_SECOND_IN_TS/2))){for(q=Gr()[u.samplerate],q||(q=c[0].data),W=0;W<P;W++)ie=c[0],c.splice(0,0,{data:q,dts:ie.dts-m,pts:ie.pts-m});return u.baseMediaDecodeTime-=Math.floor(zi.videoTsToAudioTs(R,u.samplerate)),R}},Xr=function(u,c,p){return c.minSegmentDts>=p?u:(c.minSegmentDts=1/0,u.filter(function(h){return h.dts>=p?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},Pi=function(u){var c,p,h=[];for(c=0;c<u.length;c++)p=u[c],h.push({size:p.data.byteLength,duration:1024});return h},Hn=function(u){var c,p,h=0,g=new Uint8Array(jn(u));for(c=0;c<u.length;c++)p=u[c],g.set(p.data,h),h+=p.data.byteLength;return g},Kr={prefixWithSilence:$n,trimAdtsFramesByEarliestDts:Xr,generateSampleTable:Pi,concatenateFrameData:Hn},Vn=Ve.ONE_SECOND_IN_TS,S=function(u,c){typeof c.pts=="number"&&(u.timelineStartInfo.pts===void 0&&(u.timelineStartInfo.pts=c.pts),u.minSegmentPts===void 0?u.minSegmentPts=c.pts:u.minSegmentPts=Math.min(u.minSegmentPts,c.pts),u.maxSegmentPts===void 0?u.maxSegmentPts=c.pts:u.maxSegmentPts=Math.max(u.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(u.timelineStartInfo.dts===void 0&&(u.timelineStartInfo.dts=c.dts),u.minSegmentDts===void 0?u.minSegmentDts=c.dts:u.minSegmentDts=Math.min(u.minSegmentDts,c.dts),u.maxSegmentDts===void 0?u.maxSegmentDts=c.dts:u.maxSegmentDts=Math.max(u.maxSegmentDts,c.dts))},E=function(u){delete u.minSegmentDts,delete u.maxSegmentDts,delete u.minSegmentPts,delete u.maxSegmentPts},$=function(u,c){var p,h,g=u.minSegmentDts;return c||(g-=u.timelineStartInfo.dts),p=u.timelineStartInfo.baseMediaDecodeTime,p+=g,p=Math.max(0,p),u.type==="audio"&&(h=u.samplerate/Vn,p*=h,p=Math.floor(p)),p},Z={clearDtsInfo:E,calculateTrackBaseMediaDecodeTime:$,collectDtsInfo:S},pe=4,Oe=128,Je=function(u){for(var c=0,p={payloadType:-1,payloadSize:0},h=0,g=0;c<u.byteLength&&u[c]!==Oe;){for(;u[c]===255;)h+=255,c++;for(h+=u[c++];u[c]===255;)g+=255,c++;if(g+=u[c++],!p.payload&&h===pe){var m=String.fromCharCode(u[c+3],u[c+4],u[c+5],u[c+6]);if(m==="GA94"){p.payloadType=h,p.payloadSize=g,p.payload=u.subarray(c,c+g);break}else p.payload=void 0}c+=g,h=0,g=0}return p},Xe=function(u){return u.payload[0]!==181||(u.payload[1]<<8|u.payload[2])!==49||String.fromCharCode(u.payload[3],u.payload[4],u.payload[5],u.payload[6])!=="GA94"||u.payload[7]!==3?null:u.payload.subarray(8,u.payload.length-1)},Qt=function(u,c){var p=[],h,g,m,D;if(!(c[0]&64))return p;for(g=c[0]&31,h=0;h<g;h++)m=h*3,D={type:c[m+2]&3,pts:u},c[m+2]&4&&(D.ccData=c[m+3]<<8|c[m+4],p.push(D));return p},ai=function(u){for(var c=u.byteLength,p=[],h=1,g,m;h<c-2;)u[h]===0&&u[h+1]===0&&u[h+2]===3?(p.push(h+2),h+=2):h++;if(p.length===0)return u;g=c-p.length,m=new Uint8Array(g);var D=0;for(h=0;h<g;D++,h++)D===p[0]&&(D++,p.shift()),m[h]=u[D];return m},jt={parseSei:Je,parseUserData:Xe,parseCaptionPackets:Qt,discardEmulationPreventionBytes:ai,USER_DATA_REGISTERED_ITU_T_T35:pe},Li=t,$t=jt,ut=function(u){u=u||{},ut.prototype.init.call(this),this.parse708captions_=typeof u.parse708captions=="boolean"?u.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new it(0,0),new it(0,1),new it(1,0),new it(1,1)],this.parse708captions_&&(this.cc708Stream_=new $e({captionServices:u.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};ut.prototype=new Li,ut.prototype.push=function(u){var c,p,h;if(u.nalUnitType==="sei_rbsp"&&(c=$t.parseSei(u.escapedRBSP),!!c.payload&&c.payloadType===$t.USER_DATA_REGISTERED_ITU_T_T35&&(p=$t.parseUserData(c),!!p))){if(u.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(u.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=$t.parseCaptionPackets(u.pts,p),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==u.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=u.dts}},ut.prototype.flushCCStreams=function(u){this.ccStreams_.forEach(function(c){return u==="flush"?c.flush():c.partialFlush()},this)},ut.prototype.flushStream=function(u){if(!this.captionPackets_.length){this.flushCCStreams(u);return}this.captionPackets_.forEach(function(c,p){c.presortIndex=p}),this.captionPackets_.sort(function(c,p){return c.pts===p.pts?c.presortIndex-p.presortIndex:c.pts-p.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(u)},ut.prototype.flush=function(){return this.flushStream("flush")},ut.prototype.partialFlush=function(){return this.flushStream("partialFlush")},ut.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(u){u.reset()})},ut.prototype.dispatchCea608Packet=function(u){this.setsTextOrXDSActive(u)?this.activeCea608Channel_[u.type]=null:this.setsChannel1Active(u)?this.activeCea608Channel_[u.type]=0:this.setsChannel2Active(u)&&(this.activeCea608Channel_[u.type]=1),this.activeCea608Channel_[u.type]!==null&&this.ccStreams_[(u.type<<1)+this.activeCea608Channel_[u.type]].push(u)},ut.prototype.setsChannel1Active=function(u){return(u.ccData&30720)===4096},ut.prototype.setsChannel2Active=function(u){return(u.ccData&30720)===6144},ut.prototype.setsTextOrXDSActive=function(u){return(u.ccData&28928)===256||(u.ccData&30974)===4138||(u.ccData&30974)===6186},ut.prototype.dispatchCea708Packet=function(u){this.parse708captions_&&this.cc708Stream_.push(u)};var Ci={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},Ht=function(u){var c=Ci[u]||u;return u&4096&&u===c?"":String.fromCharCode(c)},Vt=function(u){return 32<=u&&u<=127||160<=u&&u<=255},Et=function(u){this.windowNum=u,this.reset()};Et.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Et.prototype.getText=function(){return this.rows.join(`
220
+ `)},Et.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Et.prototype.newLine=function(u){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(u),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Et.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Et.prototype.addText=function(u){this.rows[this.rowIdx]+=u},Et.prototype.backspace=function(){if(!this.isEmpty()){var u=this.rows[this.rowIdx];this.rows[this.rowIdx]=u.substr(0,u.length-1)}};var Wi=function(u,c,p){this.serviceNum=u,this.text="",this.currentWindow=new Et(-1),this.windows=[],this.stream=p,typeof c=="string"&&this.createTextDecoder(c)};Wi.prototype.init=function(u,c){this.startPts=u;for(var p=0;p<8;p++)this.windows[p]=new Et(p),typeof c=="function"&&(this.windows[p].beforeRowOverflow=c)},Wi.prototype.setCurrentWindow=function(u){this.currentWindow=this.windows[u]},Wi.prototype.createTextDecoder=function(u){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(u)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+u+" encoding. "+c})}};var $e=function(u){u=u||{},$e.prototype.init.call(this);var c=this,p=u.captionServices||{},h={},g;Object.keys(p).forEach(m=>{g=p[m],/^SERVICE/.test(m)&&(h[m]=g.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(m){m.type===3?(c.new708Packet(),c.add708Bytes(m)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(m))}};$e.prototype=new Li,$e.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},$e.prototype.add708Bytes=function(u){var c=u.ccData,p=c>>>8,h=c&255;this.current708Packet.ptsVals.push(u.pts),this.current708Packet.data.push(p),this.current708Packet.data.push(h)},$e.prototype.push708Packet=function(){var u=this.current708Packet,c=u.data,p=null,h=null,g=0,m=c[g++];for(u.seq=m>>6,u.sizeCode=m&63;g<c.length;g++)m=c[g++],p=m>>5,h=m&31,p===7&&h>0&&(m=c[g++],p=m),this.pushServiceBlock(p,g,h),h>0&&(g+=h-1)},$e.prototype.pushServiceBlock=function(u,c,p){var h,g=c,m=this.current708Packet.data,D=this.services[u];for(D||(D=this.initService(u,g));g<c+p&&g<m.length;g++)h=m[g],Vt(h)?g=this.handleText(g,D):h===24?g=this.multiByteCharacter(g,D):h===16?g=this.extendedCommands(g,D):128<=h&&h<=135?g=this.setCurrentWindow(g,D):152<=h&&h<=159?g=this.defineWindow(g,D):h===136?g=this.clearWindows(g,D):h===140?g=this.deleteWindows(g,D):h===137?g=this.displayWindows(g,D):h===138?g=this.hideWindows(g,D):h===139?g=this.toggleWindows(g,D):h===151?g=this.setWindowAttributes(g,D):h===144?g=this.setPenAttributes(g,D):h===145?g=this.setPenColor(g,D):h===146?g=this.setPenLocation(g,D):h===143?D=this.reset(g,D):h===8?D.currentWindow.backspace():h===12?D.currentWindow.clearText():h===13?D.currentWindow.pendingNewLine=!0:h===14?D.currentWindow.clearText():h===141&&g++},$e.prototype.extendedCommands=function(u,c){var p=this.current708Packet.data,h=p[++u];return Vt(h)&&(u=this.handleText(u,c,{isExtended:!0})),u},$e.prototype.getPts=function(u){return this.current708Packet.ptsVals[Math.floor(u/2)]},$e.prototype.initService=function(u,c){var h="SERVICE"+u,p=this,h,g;return h in this.serviceEncodings&&(g=this.serviceEncodings[h]),this.services[u]=new Wi(u,g,p),this.services[u].init(this.getPts(c),function(m){p.flushDisplayed(m,p.services[u])}),this.services[u]},$e.prototype.handleText=function(u,c,p){var h=p&&p.isExtended,g=p&&p.isMultiByte,m=this.current708Packet.data,D=h?4096:0,P=m[u],R=m[u+1],q=c.currentWindow,W,ie;function me(ae){return ae.map(Ae=>("0"+(Ae&255).toString(16)).slice(-2)).join("")}if(g?(ie=[P,R],u++):ie=[P],c.textDecoder_&&!h)W=c.textDecoder_.decode(new Uint8Array(ie));else if(g){const ae=me(ie);W=String.fromCharCode(parseInt(ae,16))}else W=Ht(D|P);return q.pendingNewLine&&!q.isEmpty()&&q.newLine(this.getPts(u)),q.pendingNewLine=!1,q.addText(W),u},$e.prototype.multiByteCharacter=function(u,c){var p=this.current708Packet.data,h=p[u+1],g=p[u+2];return Vt(h)&&Vt(g)&&(u=this.handleText(++u,c,{isMultiByte:!0})),u},$e.prototype.setCurrentWindow=function(u,c){var p=this.current708Packet.data,h=p[u],g=h&7;return c.setCurrentWindow(g),u},$e.prototype.defineWindow=function(u,c){var p=this.current708Packet.data,h=p[u],g=h&7;c.setCurrentWindow(g);var m=c.currentWindow;return h=p[++u],m.visible=(h&32)>>5,m.rowLock=(h&16)>>4,m.columnLock=(h&8)>>3,m.priority=h&7,h=p[++u],m.relativePositioning=(h&128)>>7,m.anchorVertical=h&127,h=p[++u],m.anchorHorizontal=h,h=p[++u],m.anchorPoint=(h&240)>>4,m.rowCount=h&15,h=p[++u],m.columnCount=h&63,h=p[++u],m.windowStyle=(h&56)>>3,m.penStyle=h&7,m.virtualRowCount=m.rowCount+1,u},$e.prototype.setWindowAttributes=function(u,c){var p=this.current708Packet.data,h=p[u],g=c.currentWindow.winAttr;return h=p[++u],g.fillOpacity=(h&192)>>6,g.fillRed=(h&48)>>4,g.fillGreen=(h&12)>>2,g.fillBlue=h&3,h=p[++u],g.borderType=(h&192)>>6,g.borderRed=(h&48)>>4,g.borderGreen=(h&12)>>2,g.borderBlue=h&3,h=p[++u],g.borderType+=(h&128)>>5,g.wordWrap=(h&64)>>6,g.printDirection=(h&48)>>4,g.scrollDirection=(h&12)>>2,g.justify=h&3,h=p[++u],g.effectSpeed=(h&240)>>4,g.effectDirection=(h&12)>>2,g.displayEffect=h&3,u},$e.prototype.flushDisplayed=function(u,c){for(var p=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&p.push(c.windows[h].getText());c.endPts=u,c.text=p.join(`
221
+
222
+ `),this.pushCaption(c),c.startPts=u},$e.prototype.pushCaption=function(u){u.text!==""&&(this.trigger("data",{startPts:u.startPts,endPts:u.endPts,text:u.text,stream:"cc708_"+u.serviceNum}),u.text="",u.startPts=u.endPts)},$e.prototype.displayWindows=function(u,c){var p=this.current708Packet.data,h=p[++u],g=this.getPts(u);this.flushDisplayed(g,c);for(var m=0;m<8;m++)h&1<<m&&(c.windows[m].visible=1);return u},$e.prototype.hideWindows=function(u,c){var p=this.current708Packet.data,h=p[++u],g=this.getPts(u);this.flushDisplayed(g,c);for(var m=0;m<8;m++)h&1<<m&&(c.windows[m].visible=0);return u},$e.prototype.toggleWindows=function(u,c){var p=this.current708Packet.data,h=p[++u],g=this.getPts(u);this.flushDisplayed(g,c);for(var m=0;m<8;m++)h&1<<m&&(c.windows[m].visible^=1);return u},$e.prototype.clearWindows=function(u,c){var p=this.current708Packet.data,h=p[++u],g=this.getPts(u);this.flushDisplayed(g,c);for(var m=0;m<8;m++)h&1<<m&&c.windows[m].clearText();return u},$e.prototype.deleteWindows=function(u,c){var p=this.current708Packet.data,h=p[++u],g=this.getPts(u);this.flushDisplayed(g,c);for(var m=0;m<8;m++)h&1<<m&&c.windows[m].reset();return u},$e.prototype.setPenAttributes=function(u,c){var p=this.current708Packet.data,h=p[u],g=c.currentWindow.penAttr;return h=p[++u],g.textTag=(h&240)>>4,g.offset=(h&12)>>2,g.penSize=h&3,h=p[++u],g.italics=(h&128)>>7,g.underline=(h&64)>>6,g.edgeType=(h&56)>>3,g.fontStyle=h&7,u},$e.prototype.setPenColor=function(u,c){var p=this.current708Packet.data,h=p[u],g=c.currentWindow.penColor;return h=p[++u],g.fgOpacity=(h&192)>>6,g.fgRed=(h&48)>>4,g.fgGreen=(h&12)>>2,g.fgBlue=h&3,h=p[++u],g.bgOpacity=(h&192)>>6,g.bgRed=(h&48)>>4,g.bgGreen=(h&12)>>2,g.bgBlue=h&3,h=p[++u],g.edgeRed=(h&48)>>4,g.edgeGreen=(h&12)>>2,g.edgeBlue=h&3,u},$e.prototype.setPenLocation=function(u,c){var p=this.current708Packet.data,h=p[u],g=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=p[++u],g.row=h&15,h=p[++u],g.column=h&63,u},$e.prototype.reset=function(u,c){var p=this.getPts(u);return this.flushDisplayed(p,c),this.initService(c.serviceNum,u)};var zn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Wn=function(u){return u===null?"":(u=zn[u]||u,String.fromCharCode(u))},Gn=14,dg=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Gi=function(){for(var u=[],c=Gn+1;c--;)u.push({text:"",indent:0,offset:0});return u},it=function(u,c){it.prototype.init.call(this),this.field_=u||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(p){var h,g,m,D,P;if(h=p.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),m=h>>>8,D=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(p.pts),this.flushDisplayed(p.pts),g=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=g,this.startPts_=p.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(p.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(p.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(p.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(p.pts),this.flushDisplayed(p.pts),this.shiftRowsUp_(),this.startPts_=p.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(p.pts),this.displayed_=Gi();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Gi();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(p.pts),this.displayed_=Gi()),this.mode_="paintOn",this.startPts_=p.pts;else if(this.isSpecialCharacter(m,D))m=(m&3)<<8,P=Wn(m|D),this[this.mode_](p.pts,P),this.column_++;else if(this.isExtCharacter(m,D))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),m=(m&3)<<8,P=Wn(m|D),this[this.mode_](p.pts,P),this.column_++;else if(this.isMidRowCode(m,D))this.clearFormatting(p.pts),this[this.mode_](p.pts," "),this.column_++,(D&14)===14&&this.addFormatting(p.pts,["i"]),(D&1)===1&&this.addFormatting(p.pts,["u"]);else if(this.isOffsetControlCode(m,D)){const q=D&3;this.nonDisplayed_[this.row_].offset=q,this.column_+=q}else if(this.isPAC(m,D)){var R=dg.indexOf(h&7968);if(this.mode_==="rollUp"&&(R-this.rollUpRows_+1<0&&(R=this.rollUpRows_-1),this.setRollUp(p.pts,R)),R!==this.row_&&R>=0&&R<=14&&(this.clearFormatting(p.pts),this.row_=R),D&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(p.pts,["u"]),(h&16)===16){const q=(h&14)>>1;this.column_=q*4,this.nonDisplayed_[this.row_].indent+=q}this.isColorPAC(D)&&(D&14)===14&&this.addFormatting(p.pts,["i"])}else this.isNormalChar(m)&&(D===0&&(D=null),P=Wn(m),P+=Wn(D),this[this.mode_](p.pts,P),this.column_+=P.length)}};it.prototype=new Li,it.prototype.flushDisplayed=function(u){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},p=[];this.displayed_.forEach((h,g)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(g)}h.text.length&&p.push({text:h.text,line:g+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(g)}),p.length&&this.trigger("data",{startPts:this.startPts_,endPts:u,content:p,stream:this.name_})},it.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Gi(),this.nonDisplayed_=Gi(),this.lastControlCode_=null,this.column_=0,this.row_=Gn,this.rollUpRows_=2,this.formatting_=[]},it.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},it.prototype.isSpecialCharacter=function(u,c){return u===this.EXT_&&c>=48&&c<=63},it.prototype.isExtCharacter=function(u,c){return(u===this.EXT_+1||u===this.EXT_+2)&&c>=32&&c<=63},it.prototype.isMidRowCode=function(u,c){return u===this.EXT_&&c>=32&&c<=47},it.prototype.isOffsetControlCode=function(u,c){return u===this.OFFSET_&&c>=33&&c<=35},it.prototype.isPAC=function(u,c){return u>=this.BASE_&&u<this.BASE_+8&&c>=64&&c<=127},it.prototype.isColorPAC=function(u){return u>=64&&u<=79||u>=96&&u<=127},it.prototype.isNormalChar=function(u){return u>=32&&u<=127},it.prototype.setRollUp=function(u,c){if(this.mode_!=="rollUp"&&(this.row_=Gn,this.mode_="rollUp",this.flushDisplayed(u),this.nonDisplayed_=Gi(),this.displayed_=Gi()),c!==void 0&&c!==this.row_)for(var p=0;p<this.rollUpRows_;p++)this.displayed_[c-p]=this.displayed_[this.row_-p],this.displayed_[this.row_-p]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},it.prototype.addFormatting=function(u,c){this.formatting_=this.formatting_.concat(c);var p=c.reduce(function(h,g){return h+"<"+g+">"},"");this[this.mode_](u,p)},it.prototype.clearFormatting=function(u){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(p,h){return p+"</"+h+">"},"");this.formatting_=[],this[this.mode_](u,c)}},it.prototype.popOn=function(u,c){var p=this.nonDisplayed_[this.row_].text;p+=c,this.nonDisplayed_[this.row_].text=p},it.prototype.rollUp=function(u,c){var p=this.displayed_[this.row_].text;p+=c,this.displayed_[this.row_].text=p},it.prototype.shiftRowsUp_=function(){var u;for(u=0;u<this.topRow_;u++)this.displayed_[u]={text:"",indent:0,offset:0};for(u=this.row_+1;u<Gn+1;u++)this.displayed_[u]={text:"",indent:0,offset:0};for(u=this.topRow_;u<this.row_;u++)this.displayed_[u]=this.displayed_[u+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},it.prototype.paintOn=function(u,c){var p=this.displayed_[this.row_].text;p+=c,this.displayed_[this.row_].text=p};var Ju={CaptionStream:ut,Cea608Stream:it,Cea708Stream:$e},Xn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},hg=t,pg=8589934592,fg=4294967296,Zu="shared",wa=function(u,c){var p=1;for(u>c&&(p=-1);Math.abs(c-u)>fg;)u+=p*pg;return u},xa=function(u){var c,p;xa.prototype.init.call(this),this.type_=u||Zu,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Zu&&h.type!==this.type_||(p===void 0&&(p=h.dts),h.dts=wa(h.dts,p),h.pts=wa(h.pts,p),c=h.dts,this.trigger("data",h))},this.flush=function(){p=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){p=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};xa.prototype=new hg;var el={TimestampRolloverStream:xa,handleRollover:wa},gg=(u,c,p)=>{if(!u)return-1;for(var h=p;h<u.length;h++)if(u[h]===c)return h;return-1},mg={typedArrayIndexOf:gg},Kn=mg.typedArrayIndexOf,Yn={Utf8:3},tl=function(u,c,p){var h,g="";for(h=c;h<p;h++)g+="%"+("00"+u[h].toString(16)).slice(-2);return g},Yr=function(u,c,p){return decodeURIComponent(tl(u,c,p))},Qr=function(u,c,p){return unescape(tl(u,c,p))},Jr=function(u){return u[0]<<21|u[1]<<14|u[2]<<7|u[3]},Zr={APIC:function(u){var c=1,p,h,g="-->";u.data[0]===Yn.Utf8&&(p=Kn(u.data,0,c),!(p<0)&&(u.mimeType=Qr(u.data,c,p),c=p+1,u.pictureType=u.data[c],c++,h=Kn(u.data,0,c),!(h<0)&&(u.description=Yr(u.data,c,h),c=h+1,u.mimeType===g?u.url=Qr(u.data,c,u.data.length):u.pictureData=u.data.subarray(c,u.data.length))))},"T*":function(u){u.data[0]===Yn.Utf8&&(u.value=Yr(u.data,1,u.data.length).replace(/\0*$/,""),u.values=u.value.split("\0"))},TXXX:function(u){var c;u.data[0]===Yn.Utf8&&(c=Kn(u.data,0,1),c!==-1&&(u.description=Yr(u.data,1,c),u.value=Yr(u.data,c+1,u.data.length).replace(/\0*$/,""),u.data=u.value))},"W*":function(u){u.url=Qr(u.data,0,u.data.length).replace(/\0.*$/,"")},WXXX:function(u){var c;u.data[0]===Yn.Utf8&&(c=Kn(u.data,0,1),c!==-1&&(u.description=Yr(u.data,1,c),u.url=Qr(u.data,c+1,u.data.length).replace(/\0.*$/,"")))},PRIV:function(u){var c;for(c=0;c<u.data.length;c++)if(u.data[c]===0){u.owner=Qr(u.data,0,c);break}u.privateData=u.data.subarray(c+1),u.data=u.privateData}},yg=function(u){var c,p,h=10,g=0,m=[];if(!(u.length<10||u[0]!==73||u[1]!==68||u[2]!==51)){g=Jr(u.subarray(6,10)),g+=10;var D=u[5]&64;D&&(h+=4,h+=Jr(u.subarray(10,14)),g-=Jr(u.subarray(16,20)));do{if(c=Jr(u.subarray(h+4,h+8)),c<1)break;p=String.fromCharCode(u[h],u[h+1],u[h+2],u[h+3]);var P={id:p,data:u.subarray(h+10,h+c+10)};P.key=P.id,Zr[P.id]?Zr[P.id](P):P.id[0]==="T"?Zr["T*"](P):P.id[0]==="W"&&Zr["W*"](P),m.push(P),h+=10,h+=c}while(h<g);return m}},il={parseId3Frames:yg,parseSyncSafeInteger:Jr,frameParsers:Zr},_g=t,bg=Xn,Oi=il,Qn;Qn=function(u){var c={descriptor:u&&u.descriptor},p=0,h=[],g=0,m;if(Qn.prototype.init.call(this),this.dispatchType=bg.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(m=0;m<c.descriptor.length;m++)this.dispatchType+=("00"+c.descriptor[m].toString(16)).slice(-2);this.push=function(D){var P,R,q,W,ie,me;if(D.type==="timed-metadata"){if(D.dataAlignmentIndicator&&(g=0,h.length=0),h.length===0&&(D.data.length<10||D.data[0]!==73||D.data[1]!==68||D.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(D),g+=D.data.byteLength,h.length===1&&(p=Oi.parseSyncSafeInteger(D.data.subarray(6,10)),p+=10),!(g<p)){for(P={data:new Uint8Array(p),frames:[],pts:h[0].pts,dts:h[0].dts},ie=0;ie<p;)P.data.set(h[0].data.subarray(0,p-ie),ie),ie+=h[0].data.byteLength,g-=h[0].data.byteLength,h.shift();R=10,P.data[5]&64&&(R+=4,R+=Oi.parseSyncSafeInteger(P.data.subarray(10,14)),p-=Oi.parseSyncSafeInteger(P.data.subarray(16,20)));do{if(q=Oi.parseSyncSafeInteger(P.data.subarray(R+4,R+8)),q<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(me=String.fromCharCode(P.data[R],P.data[R+1],P.data[R+2],P.data[R+3]),W={id:me,data:P.data.subarray(R+10,R+q+10)},W.key=W.id,Oi.frameParsers[W.id]?Oi.frameParsers[W.id](W):W.id[0]==="T"?Oi.frameParsers["T*"](W):W.id[0]==="W"&&Oi.frameParsers["W*"](W),W.owner==="com.apple.streaming.transportStreamTimestamp"){var ae=W.data,Ae=(ae[3]&1)<<30|ae[4]<<22|ae[5]<<14|ae[6]<<6|ae[7]>>>2;Ae*=4,Ae+=ae[7]&3,W.timeStamp=Ae,P.pts===void 0&&P.dts===void 0&&(P.pts=W.timeStamp,P.dts=W.timeStamp),this.trigger("timestamp",W)}P.frames.push(W),R+=10,R+=q}while(R<p);this.trigger("data",P)}}}},Qn.prototype=new _g;var vg=Qn,ka=t,Aa=Ju,Jt=Xn,Tg=el.TimestampRolloverStream,Jn,en,Zn,pr=188,Da=71;Jn=function(){var u=new Uint8Array(pr),c=0;Jn.prototype.init.call(this),this.push=function(p){var h=0,g=pr,m;for(c?(m=new Uint8Array(p.byteLength+c),m.set(u.subarray(0,c)),m.set(p,c),c=0):m=p;g<m.byteLength;){if(m[h]===Da&&m[g]===Da){this.trigger("data",m.subarray(h,g)),h+=pr,g+=pr;continue}h++,g++}h<m.byteLength&&(u.set(m.subarray(h),0),c=m.byteLength-h)},this.flush=function(){c===pr&&u[0]===Da&&(this.trigger("data",u),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},Jn.prototype=new ka,en=function(){var u,c,p,h;en.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,u=function(g,m){var D=0;m.payloadUnitStartIndicator&&(D+=g[D]+1),m.type==="pat"?c(g.subarray(D),m):p(g.subarray(D),m)},c=function(g,m){m.section_number=g[7],m.last_section_number=g[8],h.pmtPid=(g[10]&31)<<8|g[11],m.pmtPid=h.pmtPid},p=function(g,m){var D,P,R,q;if(g[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},D=(g[1]&15)<<8|g[2],P=3+D-4,R=(g[10]&15)<<8|g[11],q=12+R;q<P;){var W=g[q],ie=(g[q+1]&31)<<8|g[q+2];W===Jt.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=ie:W===Jt.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=ie:W===Jt.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][ie]=W),q+=((g[q+3]&15)<<8|g[q+4])+5}m.programMapTable=h.programMapTable}},this.push=function(g){var m={},D=4;if(m.payloadUnitStartIndicator=!!(g[1]&64),m.pid=g[1]&31,m.pid<<=8,m.pid|=g[2],(g[3]&48)>>>4>1&&(D+=g[D]+1),m.pid===0)m.type="pat",u(g.subarray(D),m),this.trigger("data",m);else if(m.pid===this.pmtPid)for(m.type="pmt",u(g.subarray(D),m),this.trigger("data",m);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([g,D,m]):this.processPes_(g,D,m)},this.processPes_=function(g,m,D){D.pid===this.programMapTable.video?D.streamType=Jt.H264_STREAM_TYPE:D.pid===this.programMapTable.audio?D.streamType=Jt.ADTS_STREAM_TYPE:D.streamType=this.programMapTable["timed-metadata"][D.pid],D.type="pes",D.data=g.subarray(m),this.trigger("data",D)}},en.prototype=new ka,en.STREAM_TYPES={h264:27,adts:15},Zn=function(){var u=this,c=!1,p={data:[],size:0},h={data:[],size:0},g={data:[],size:0},m,D=function(R,q){var W;const ie=R[0]<<16|R[1]<<8|R[2];q.data=new Uint8Array,ie===1&&(q.packetLength=6+(R[4]<<8|R[5]),q.dataAlignmentIndicator=(R[6]&4)!==0,W=R[7],W&192&&(q.pts=(R[9]&14)<<27|(R[10]&255)<<20|(R[11]&254)<<12|(R[12]&255)<<5|(R[13]&254)>>>3,q.pts*=4,q.pts+=(R[13]&6)>>>1,q.dts=q.pts,W&64&&(q.dts=(R[14]&14)<<27|(R[15]&255)<<20|(R[16]&254)<<12|(R[17]&255)<<5|(R[18]&254)>>>3,q.dts*=4,q.dts+=(R[18]&6)>>>1)),q.data=R.subarray(9+R[8]))},P=function(R,q,W){var ie=new Uint8Array(R.size),me={type:q},ae=0,Ae=0,Be=!1,gt;if(!(!R.data.length||R.size<9)){for(me.trackId=R.data[0].pid,ae=0;ae<R.data.length;ae++)gt=R.data[ae],ie.set(gt.data,Ae),Ae+=gt.data.byteLength;D(ie,me),Be=q==="video"||me.packetLength<=R.size,(W||Be)&&(R.size=0,R.data.length=0),Be&&u.trigger("data",me)}};Zn.prototype.init.call(this),this.push=function(R){({pat:function(){},pes:function(){var q,W;switch(R.streamType){case Jt.H264_STREAM_TYPE:q=p,W="video";break;case Jt.ADTS_STREAM_TYPE:q=h,W="audio";break;case Jt.METADATA_STREAM_TYPE:q=g,W="timed-metadata";break;default:return}R.payloadUnitStartIndicator&&P(q,W,!0),q.data.push(R),q.size+=R.data.byteLength},pmt:function(){var q={type:"metadata",tracks:[]};m=R.programMapTable,m.video!==null&&q.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&q.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),c=!0,u.trigger("data",q)}})[R.type]()},this.reset=function(){p.size=0,p.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){P(p,"video"),P(h,"audio"),P(g,"timed-metadata")},this.flush=function(){if(!c&&m){var R={type:"metadata",tracks:[]};m.video!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),u.trigger("data",R)}c=!1,this.flushStreams_(),this.trigger("done")}},Zn.prototype=new ka;var rl={PAT_PID:0,MP2T_PACKET_LENGTH:pr,TransportPacketStream:Jn,TransportParseStream:en,ElementaryStream:Zn,TimestampRolloverStream:Tg,CaptionStream:Aa.CaptionStream,Cea608Stream:Aa.Cea608Stream,Cea708Stream:Aa.Cea708Stream,MetadataStream:vg};for(var Ia in Jt)Jt.hasOwnProperty(Ia)&&(rl[Ia]=Jt[Ia]);var Sg=rl,Cg=t,Eg=Ve.ONE_SECOND_IN_TS,es,nl=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];es=function(u){var c,p=0;es.prototype.init.call(this),this.skipWarn_=function(h,g){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${g} in frame ${p} outside syncword`})},this.push=function(h){var g=0,m,D,P,R,q;if(u||(p=0),h.type==="audio"){c&&c.length?(P=c,c=new Uint8Array(P.byteLength+h.data.byteLength),c.set(P),c.set(h.data,P.byteLength)):c=h.data;for(var W;g+7<c.length;){if(c[g]!==255||(c[g+1]&246)!==240){typeof W!="number"&&(W=g),g++;continue}if(typeof W=="number"&&(this.skipWarn_(W,g),W=null),D=(~c[g+1]&1)*2,m=(c[g+3]&3)<<11|c[g+4]<<3|(c[g+5]&224)>>5,R=((c[g+6]&3)+1)*1024,q=R*Eg/nl[(c[g+2]&60)>>>2],c.byteLength-g<m)break;this.trigger("data",{pts:h.pts+p*q,dts:h.dts+p*q,sampleCount:R,audioobjecttype:(c[g+2]>>>6&3)+1,channelcount:(c[g+2]&1)<<2|(c[g+3]&192)>>>6,samplerate:nl[(c[g+2]&60)>>>2],samplingfrequencyindex:(c[g+2]&60)>>>2,samplesize:16,data:c.subarray(g+7+D,g+m)}),p++,g+=m}typeof W=="number"&&(this.skipWarn_(W,g),W=null),c=c.subarray(g)}},this.flush=function(){p=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},es.prototype=new Cg;var wg=es,sl;sl=function(u){var c=u.byteLength,p=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var g=u.byteLength-c,m=new Uint8Array(4),D=Math.min(4,c);if(D===0)throw new Error("no bytes available");m.set(u.subarray(g,g+D)),p=new DataView(m.buffer).getUint32(0),h=D*8,c-=D},this.skipBits=function(g){var m;h>g?(p<<=g,h-=g):(g-=h,m=Math.floor(g/8),g-=m*8,c-=m,this.loadWord(),p<<=g,h-=g)},this.readBits=function(g){var m=Math.min(h,g),D=p>>>32-m;return h-=m,h>0?p<<=m:c>0&&this.loadWord(),m=g-m,m>0?D<<m|this.readBits(m):D},this.skipLeadingZeros=function(){var g;for(g=0;g<h;++g)if((p&2147483648>>>g)!==0)return p<<=g,h-=g,g;return this.loadWord(),g+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var g=this.skipLeadingZeros();return this.readBits(g+1)-1},this.readExpGolomb=function(){var g=this.readUnsignedExpGolomb();return 1&g?1+g>>>1:-1*(g>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var xg=sl,al=t,kg=xg,ts,is,ol;is=function(){var u=0,c,p;is.prototype.init.call(this),this.push=function(h){var g;p?(g=new Uint8Array(p.byteLength+h.data.byteLength),g.set(p),g.set(h.data,p.byteLength),p=g):p=h.data;for(var m=p.byteLength;u<m-3;u++)if(p[u+2]===1){c=u+5;break}for(;c<m;)switch(p[c]){case 0:if(p[c-1]!==0){c+=2;break}else if(p[c-2]!==0){c++;break}u+3!==c-2&&this.trigger("data",p.subarray(u+3,c-2));do c++;while(p[c]!==1&&c<m);u=c-2,c+=3;break;case 1:if(p[c-1]!==0||p[c-2]!==0){c+=3;break}this.trigger("data",p.subarray(u+3,c-2)),u=c-2,c+=3;break;default:c+=3;break}p=p.subarray(u),c-=u,u=0},this.reset=function(){p=null,u=0,this.trigger("reset")},this.flush=function(){p&&p.byteLength>3&&this.trigger("data",p.subarray(u+3)),p=null,u=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},is.prototype=new al,ol={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ts=function(){var u=new is,c,p,h,g,m,D,P;ts.prototype.init.call(this),c=this,this.push=function(R){R.type==="video"&&(p=R.trackId,h=R.pts,g=R.dts,u.push(R))},u.on("data",function(R){var q={trackId:p,pts:h,dts:g,data:R,nalUnitTypeCode:R[0]&31};switch(q.nalUnitTypeCode){case 5:q.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:q.nalUnitType="sei_rbsp",q.escapedRBSP=m(R.subarray(1));break;case 7:q.nalUnitType="seq_parameter_set_rbsp",q.escapedRBSP=m(R.subarray(1)),q.config=D(q.escapedRBSP);break;case 8:q.nalUnitType="pic_parameter_set_rbsp";break;case 9:q.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",q)}),u.on("done",function(){c.trigger("done")}),u.on("partialdone",function(){c.trigger("partialdone")}),u.on("reset",function(){c.trigger("reset")}),u.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){u.flush()},this.partialFlush=function(){u.partialFlush()},this.reset=function(){u.reset()},this.endTimeline=function(){u.endTimeline()},P=function(R,q){var W=8,ie=8,me,ae;for(me=0;me<R;me++)ie!==0&&(ae=q.readExpGolomb(),ie=(W+ae+256)%256),W=ie===0?W:ie},m=function(R){for(var q=R.byteLength,W=[],ie=1,me,ae;ie<q-2;)R[ie]===0&&R[ie+1]===0&&R[ie+2]===3?(W.push(ie+2),ie+=2):ie++;if(W.length===0)return R;me=q-W.length,ae=new Uint8Array(me);var Ae=0;for(ie=0;ie<me;Ae++,ie++)Ae===W[0]&&(Ae++,W.shift()),ae[ie]=R[Ae];return ae},D=function(R){var q=0,W=0,ie=0,me=0,ae,Ae,Be,gt,xt,ui,un,fs,gs,Yi,ln,tt=[1,1],jl,Qi;if(ae=new kg(R),Ae=ae.readUnsignedByte(),gt=ae.readUnsignedByte(),Be=ae.readUnsignedByte(),ae.skipUnsignedExpGolomb(),ol[Ae]&&(xt=ae.readUnsignedExpGolomb(),xt===3&&ae.skipBits(1),ae.skipUnsignedExpGolomb(),ae.skipUnsignedExpGolomb(),ae.skipBits(1),ae.readBoolean()))for(ln=xt!==3?8:12,Qi=0;Qi<ln;Qi++)ae.readBoolean()&&(Qi<6?P(16,ae):P(64,ae));if(ae.skipUnsignedExpGolomb(),ui=ae.readUnsignedExpGolomb(),ui===0)ae.readUnsignedExpGolomb();else if(ui===1)for(ae.skipBits(1),ae.skipExpGolomb(),ae.skipExpGolomb(),un=ae.readUnsignedExpGolomb(),Qi=0;Qi<un;Qi++)ae.skipExpGolomb();if(ae.skipUnsignedExpGolomb(),ae.skipBits(1),fs=ae.readUnsignedExpGolomb(),gs=ae.readUnsignedExpGolomb(),Yi=ae.readBits(1),Yi===0&&ae.skipBits(1),ae.skipBits(1),ae.readBoolean()&&(q=ae.readUnsignedExpGolomb(),W=ae.readUnsignedExpGolomb(),ie=ae.readUnsignedExpGolomb(),me=ae.readUnsignedExpGolomb()),ae.readBoolean()&&ae.readBoolean()){switch(jl=ae.readUnsignedByte(),jl){case 1:tt=[1,1];break;case 2:tt=[12,11];break;case 3:tt=[10,11];break;case 4:tt=[16,11];break;case 5:tt=[40,33];break;case 6:tt=[24,11];break;case 7:tt=[20,11];break;case 8:tt=[32,11];break;case 9:tt=[80,33];break;case 10:tt=[18,11];break;case 11:tt=[15,11];break;case 12:tt=[64,33];break;case 13:tt=[160,99];break;case 14:tt=[4,3];break;case 15:tt=[3,2];break;case 16:tt=[2,1];break;case 255:{tt=[ae.readUnsignedByte()<<8|ae.readUnsignedByte(),ae.readUnsignedByte()<<8|ae.readUnsignedByte()];break}}tt&&tt[0]/tt[1]}return{profileIdc:Ae,levelIdc:Be,profileCompatibility:gt,width:(fs+1)*16-q*2-W*2,height:(2-Yi)*(gs+1)*16-ie*2-me*2,sarRatio:tt}}},ts.prototype=new al;var Ag={H264Stream:ts},Dg=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ul=function(u,c){var p=u[c+6]<<21|u[c+7]<<14|u[c+8]<<7|u[c+9],h=u[c+5],g=(h&16)>>4;return p=p>=0?p:0,g?p+20:p+10},ll=function(u,c){return u.length-c<10||u[c]!==73||u[c+1]!==68||u[c+2]!==51?c:(c+=ul(u,c),ll(u,c))},Ig=function(u){var c=ll(u,0);return u.length>=c+2&&(u[c]&255)===255&&(u[c+1]&240)===240&&(u[c+1]&22)===16},cl=function(u){return u[0]<<21|u[1]<<14|u[2]<<7|u[3]},Pg=function(u,c,p){var h,g="";for(h=c;h<p;h++)g+="%"+("00"+u[h].toString(16)).slice(-2);return g},Lg=function(u,c,p){return unescape(Pg(u,c,p))},Og=function(u,c){var p=(u[c+5]&224)>>5,h=u[c+4]<<3,g=u[c+3]&6144;return g|h|p},Ng=function(u,c){return u[c]===73&&u[c+1]===68&&u[c+2]===51?"timed-metadata":u[c]&!0&&(u[c+1]&240)===240?"audio":null},Fg=function(u){for(var c=0;c+5<u.length;){if(u[c]!==255||(u[c+1]&246)!==240){c++;continue}return Dg[(u[c+2]&60)>>>2]}return null},Rg=function(u){var c,p,h,g;c=10,u[5]&64&&(c+=4,c+=cl(u.subarray(10,14)));do{if(p=cl(u.subarray(c+4,c+8)),p<1)return null;if(g=String.fromCharCode(u[c],u[c+1],u[c+2],u[c+3]),g==="PRIV"){h=u.subarray(c+10,c+p+10);for(var m=0;m<h.byteLength;m++)if(h[m]===0){var D=Lg(h,0,m);if(D==="com.apple.streaming.transportStreamTimestamp"){var P=h.subarray(m+1),R=(P[3]&1)<<30|P[4]<<22|P[5]<<14|P[6]<<6|P[7]>>>2;return R*=4,R+=P[7]&3,R}break}}c+=10,c+=p}while(c<u.byteLength);return null},Pa={isLikelyAacData:Ig,parseId3TagSize:ul,parseAdtsSize:Og,parseType:Ng,parseSampleRate:Fg,parseAacTimestamp:Rg},Mg=t,dl=Pa,rs;rs=function(){var u=new Uint8Array,c=0;rs.prototype.init.call(this),this.setTimestamp=function(p){c=p},this.push=function(p){var h=0,g=0,m,D,P,R;for(u.length?(R=u.length,u=new Uint8Array(p.byteLength+R),u.set(u.subarray(0,R)),u.set(p,R)):u=p;u.length-g>=3;){if(u[g]===73&&u[g+1]===68&&u[g+2]===51){if(u.length-g<10||(h=dl.parseId3TagSize(u,g),g+h>u.length))break;D={type:"timed-metadata",data:u.subarray(g,g+h)},this.trigger("data",D),g+=h;continue}else if((u[g]&255)===255&&(u[g+1]&240)===240){if(u.length-g<7||(h=dl.parseAdtsSize(u,g),g+h>u.length))break;P={type:"audio",data:u.subarray(g,g+h),pts:c,dts:c},this.trigger("data",P),g+=h;continue}g++}m=u.length-g,m>0?u=u.subarray(g):u=new Uint8Array},this.reset=function(){u=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){u=new Uint8Array,this.trigger("endedtimeline")}},rs.prototype=new Mg;var Bg=rs,Ug=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],qg=Ug,jg=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],$g=jg,ns=t,tn=xe,rn=_e,ss=Kr,Zt=Z,Ei=Sg,as=Ve,hl=wg,Hg=Ag.H264Stream,Vg=Bg,zg=Pa.isLikelyAacData,Wg=Ve.ONE_SECOND_IN_TS,pl=qg,fl=$g,os,nn,us,Xi,Gg=function(u,c){c.stream=u,this.trigger("log",c)},gl=function(u,c){for(var p=Object.keys(c),h=0;h<p.length;h++){var g=p[h];g==="headOfPipeline"||!c[g].on||c[g].on("log",Gg.bind(u,g))}},ml=function(u,c){var p;if(u.length!==c.length)return!1;for(p=0;p<u.length;p++)if(u[p]!==c[p])return!1;return!0},yl=function(u,c,p,h,g,m){var D=p-c,P=h-c,R=g-p;return{start:{dts:u,pts:u+D},end:{dts:u+P,pts:u+R},prependedContentDuration:m,baseMediaDecodeTime:u}};nn=function(u,c){var p=[],h,g=0,m=0,D=1/0;c=c||{},h=c.firstSequenceNumber||0,nn.prototype.init.call(this),this.push=function(P){Zt.collectDtsInfo(u,P),u&&pl.forEach(function(R){u[R]=P[R]}),p.push(P)},this.setEarliestDts=function(P){g=P},this.setVideoBaseMediaDecodeTime=function(P){D=P},this.setAudioAppendStart=function(P){m=P},this.flush=function(){var P,R,q,W,ie,me,ae;if(p.length===0){this.trigger("done","AudioSegmentStream");return}P=ss.trimAdtsFramesByEarliestDts(p,u,g),u.baseMediaDecodeTime=Zt.calculateTrackBaseMediaDecodeTime(u,c.keepOriginalTimestamps),ae=ss.prefixWithSilence(u,P,m,D),u.samples=ss.generateSampleTable(P),q=tn.mdat(ss.concatenateFrameData(P)),p=[],R=tn.moof(h,[u]),W=new Uint8Array(R.byteLength+q.byteLength),h++,W.set(R),W.set(q,R.byteLength),Zt.clearDtsInfo(u),ie=Math.ceil(Wg*1024/u.samplerate),P.length&&(me=P.length*ie,this.trigger("segmentTimingInfo",yl(as.audioTsToVideoTs(u.baseMediaDecodeTime,u.samplerate),P[0].dts,P[0].pts,P[0].dts+me,P[0].pts+me,ae||0)),this.trigger("timingInfo",{start:P[0].pts,end:P[0].pts+me})),this.trigger("data",{track:u,boxes:W}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Zt.clearDtsInfo(u),p=[],this.trigger("reset")}},nn.prototype=new ns,os=function(u,c){var p,h=[],g=[],m,D;c=c||{},p=c.firstSequenceNumber||0,os.prototype.init.call(this),delete u.minPTS,this.gopCache_=[],this.push=function(P){Zt.collectDtsInfo(u,P),P.nalUnitType==="seq_parameter_set_rbsp"&&!m&&(m=P.config,u.sps=[P.data],fl.forEach(function(R){u[R]=m[R]},this)),P.nalUnitType==="pic_parameter_set_rbsp"&&!D&&(D=P.data,u.pps=[P.data]),h.push(P)},this.flush=function(){for(var P,R,q,W,ie,me,ae=0,Ae,Be;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(P=rn.groupNalsIntoFrames(h),q=rn.groupFramesIntoGops(P),q[0][0].keyFrame||(R=this.getGopForFusion_(h[0],u),R?(ae=R.duration,q.unshift(R),q.byteLength+=R.byteLength,q.nalCount+=R.nalCount,q.pts=R.pts,q.dts=R.dts,q.duration+=R.duration):q=rn.extendFirstKeyFrame(q)),g.length){var gt;if(c.alignGopsAtEnd?gt=this.alignGopsAtEnd_(q):gt=this.alignGopsAtStart_(q),!gt){this.gopCache_.unshift({gop:q.pop(),pps:u.pps,sps:u.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Zt.clearDtsInfo(u),q=gt}Zt.collectDtsInfo(u,q),u.samples=rn.generateSampleTable(q),ie=tn.mdat(rn.concatenateNalData(q)),u.baseMediaDecodeTime=Zt.calculateTrackBaseMediaDecodeTime(u,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",q.map(function(xt){return{pts:xt.pts,dts:xt.dts,byteLength:xt.byteLength}})),Ae=q[0],Be=q[q.length-1],this.trigger("segmentTimingInfo",yl(u.baseMediaDecodeTime,Ae.dts,Ae.pts,Be.dts+Be.duration,Be.pts+Be.duration,ae)),this.trigger("timingInfo",{start:q[0].pts,end:q[q.length-1].pts+q[q.length-1].duration}),this.gopCache_.unshift({gop:q.pop(),pps:u.pps,sps:u.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",u.baseMediaDecodeTime),this.trigger("timelineStartInfo",u.timelineStartInfo),W=tn.moof(p,[u]),me=new Uint8Array(W.byteLength+ie.byteLength),p++,me.set(W),me.set(ie,W.byteLength),this.trigger("data",{track:u,boxes:me}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,g.length=0,this.trigger("reset")},this.resetStream_=function(){Zt.clearDtsInfo(u),m=void 0,D=void 0},this.getGopForFusion_=function(P){var R=45e3,q=1/0,W,ie,me,ae,Ae;for(Ae=0;Ae<this.gopCache_.length;Ae++)ae=this.gopCache_[Ae],me=ae.gop,!(!(u.pps&&ml(u.pps[0],ae.pps[0]))||!(u.sps&&ml(u.sps[0],ae.sps[0])))&&(me.dts<u.timelineStartInfo.dts||(W=P.dts-me.dts-me.duration,W>=-1e4&&W<=R&&(!ie||q>W)&&(ie=ae,q=W)));return ie?ie.gop:null},this.alignGopsAtStart_=function(P){var R,q,W,ie,me,ae,Ae,Be;for(me=P.byteLength,ae=P.nalCount,Ae=P.duration,R=q=0;R<g.length&&q<P.length&&(W=g[R],ie=P[q],W.pts!==ie.pts);){if(ie.pts>W.pts){R++;continue}q++,me-=ie.byteLength,ae-=ie.nalCount,Ae-=ie.duration}return q===0?P:q===P.length?null:(Be=P.slice(q),Be.byteLength=me,Be.duration=Ae,Be.nalCount=ae,Be.pts=Be[0].pts,Be.dts=Be[0].dts,Be)},this.alignGopsAtEnd_=function(P){var R,q,W,ie,me,ae;for(R=g.length-1,q=P.length-1,me=null,ae=!1;R>=0&&q>=0;){if(W=g[R],ie=P[q],W.pts===ie.pts){ae=!0;break}if(W.pts>ie.pts){R--;continue}R===g.length-1&&(me=q),q--}if(!ae&&me===null)return null;var Ae;if(ae?Ae=q:Ae=me,Ae===0)return P;var Be=P.slice(Ae),gt=Be.reduce(function(xt,ui){return xt.byteLength+=ui.byteLength,xt.duration+=ui.duration,xt.nalCount+=ui.nalCount,xt},{byteLength:0,duration:0,nalCount:0});return Be.byteLength=gt.byteLength,Be.duration=gt.duration,Be.nalCount=gt.nalCount,Be.pts=Be[0].pts,Be.dts=Be[0].dts,Be},this.alignGopsWith=function(P){g=P}},os.prototype=new ns,Xi=function(u,c){this.numberOfTracks=0,this.metadataStream=c,u=u||{},typeof u.remux<"u"?this.remuxTracks=!!u.remux:this.remuxTracks=!0,typeof u.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=u.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Xi.prototype.init.call(this),this.push=function(p){if(p.content||p.text)return this.pendingCaptions.push(p);if(p.frames)return this.pendingMetadata.push(p);this.pendingTracks.push(p.track),this.pendingBytes+=p.boxes.byteLength,p.track.type==="video"&&(this.videoTrack=p.track,this.pendingBoxes.push(p.boxes)),p.track.type==="audio"&&(this.audioTrack=p.track,this.pendingBoxes.unshift(p.boxes))}},Xi.prototype=new ns,Xi.prototype.flush=function(u){var c=0,p={captions:[],captionStreams:{},metadata:[],info:{}},h,g,m,D=0,P;if(this.pendingTracks.length<this.numberOfTracks){if(u!=="VideoSegmentStream"&&u!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(D=this.videoTrack.timelineStartInfo.pts,fl.forEach(function(R){p.info[R]=this.videoTrack[R]},this)):this.audioTrack&&(D=this.audioTrack.timelineStartInfo.pts,pl.forEach(function(R){p.info[R]=this.audioTrack[R]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?p.type=this.pendingTracks[0].type:p.type="combined",this.emittedTracks+=this.pendingTracks.length,m=tn.initSegment(this.pendingTracks),p.initSegment=new Uint8Array(m.byteLength),p.initSegment.set(m),p.data=new Uint8Array(this.pendingBytes),P=0;P<this.pendingBoxes.length;P++)p.data.set(this.pendingBoxes[P],c),c+=this.pendingBoxes[P].byteLength;for(P=0;P<this.pendingCaptions.length;P++)h=this.pendingCaptions[P],h.startTime=as.metadataTsToSeconds(h.startPts,D,this.keepOriginalTimestamps),h.endTime=as.metadataTsToSeconds(h.endPts,D,this.keepOriginalTimestamps),p.captionStreams[h.stream]=!0,p.captions.push(h);for(P=0;P<this.pendingMetadata.length;P++)g=this.pendingMetadata[P],g.cueTime=as.metadataTsToSeconds(g.pts,D,this.keepOriginalTimestamps),p.metadata.push(g);for(p.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",p),P=0;P<p.captions.length;P++)h=p.captions[P],this.trigger("caption",h);for(P=0;P<p.metadata.length;P++)g=p.metadata[P],this.trigger("id3Frame",g)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Xi.prototype.setRemux=function(u){this.remuxTracks=u},us=function(u){var c=this,p=!0,h,g;us.prototype.init.call(this),u=u||{},this.baseMediaDecodeTime=u.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="aac",m.metadataStream=new Ei.MetadataStream,m.aacStream=new Vg,m.audioTimestampRolloverStream=new Ei.TimestampRolloverStream("audio"),m.timedMetadataTimestampRolloverStream=new Ei.TimestampRolloverStream("timed-metadata"),m.adtsStream=new hl,m.coalesceStream=new Xi(u,m.metadataStream),m.headOfPipeline=m.aacStream,m.aacStream.pipe(m.audioTimestampRolloverStream).pipe(m.adtsStream),m.aacStream.pipe(m.timedMetadataTimestampRolloverStream).pipe(m.metadataStream).pipe(m.coalesceStream),m.metadataStream.on("timestamp",function(D){m.aacStream.setTimestamp(D.timeStamp)}),m.aacStream.on("data",function(D){D.type!=="timed-metadata"&&D.type!=="audio"||m.audioSegmentStream||(g=g||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new nn(g,u),m.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream),c.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!h}))}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),gl(this,m)},this.setupTsPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="ts",m.metadataStream=new Ei.MetadataStream,m.packetStream=new Ei.TransportPacketStream,m.parseStream=new Ei.TransportParseStream,m.elementaryStream=new Ei.ElementaryStream,m.timestampRolloverStream=new Ei.TimestampRolloverStream,m.adtsStream=new hl,m.h264Stream=new Hg,m.captionStream=new Ei.CaptionStream(u),m.coalesceStream=new Xi(u,m.metadataStream),m.headOfPipeline=m.packetStream,m.packetStream.pipe(m.parseStream).pipe(m.elementaryStream).pipe(m.timestampRolloverStream),m.timestampRolloverStream.pipe(m.h264Stream),m.timestampRolloverStream.pipe(m.adtsStream),m.timestampRolloverStream.pipe(m.metadataStream).pipe(m.coalesceStream),m.h264Stream.pipe(m.captionStream).pipe(m.coalesceStream),m.elementaryStream.on("data",function(D){var P;if(D.type==="metadata"){for(P=D.tracks.length;P--;)!h&&D.tracks[P].type==="video"?(h=D.tracks[P],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!g&&D.tracks[P].type==="audio"&&(g=D.tracks[P],g.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!m.videoSegmentStream&&(m.coalesceStream.numberOfTracks++,m.videoSegmentStream=new os(h,u),m.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),m.videoSegmentStream.on("timelineStartInfo",function(R){g&&!u.keepOriginalTimestamps&&(g.timelineStartInfo=R,m.audioSegmentStream.setEarliestDts(R.dts-c.baseMediaDecodeTime))}),m.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),m.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),m.videoSegmentStream.on("baseMediaDecodeTime",function(R){g&&m.audioSegmentStream.setVideoBaseMediaDecodeTime(R)}),m.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),m.h264Stream.pipe(m.videoSegmentStream).pipe(m.coalesceStream)),g&&!m.audioSegmentStream&&(m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new nn(g,u),m.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),m.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!h})}}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("id3Frame",function(D){D.dispatchType=m.metadataStream.dispatchType,c.trigger("id3Frame",D)}),m.coalesceStream.on("caption",this.trigger.bind(this,"caption")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),gl(this,m)},this.setBaseMediaDecodeTime=function(m){var D=this.transmuxPipeline_;u.keepOriginalTimestamps||(this.baseMediaDecodeTime=m),g&&(g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,Zt.clearDtsInfo(g),D.audioTimestampRolloverStream&&D.audioTimestampRolloverStream.discontinuity()),h&&(D.videoSegmentStream&&(D.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Zt.clearDtsInfo(h),D.captionStream.reset()),D.timestampRolloverStream&&D.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(m){g&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(m)},this.setRemux=function(m){var D=this.transmuxPipeline_;u.remux=m,D&&D.coalesceStream&&D.coalesceStream.setRemux(m)},this.alignGopsWith=function(m){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(m)},this.getLogTrigger_=function(m){var D=this;return function(P){P.stream=m,D.trigger("log",P)}},this.push=function(m){if(p){var D=zg(m);D&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!D&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),p=!1}this.transmuxPipeline_.headOfPipeline.push(m)},this.flush=function(){p=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},us.prototype=new ns;var Xg={Transmuxer:us},Kg=function(u){return u>>>0},Yg=function(u){return("00"+u.toString(16)).slice(-2)},ls={toUnsigned:Kg,toHexString:Yg},Qg=function(u){var c="";return c+=String.fromCharCode(u[0]),c+=String.fromCharCode(u[1]),c+=String.fromCharCode(u[2]),c+=String.fromCharCode(u[3]),c},_l=Qg,Jg=ls.toUnsigned,Zg=_l,bl=function(u,c){var p=[],h,g,m,D,P;if(!c.length)return null;for(h=0;h<u.byteLength;)g=Jg(u[h]<<24|u[h+1]<<16|u[h+2]<<8|u[h+3]),m=Zg(u.subarray(h+4,h+8)),D=g>1?h+g:u.byteLength,m===c[0]&&(c.length===1?p.push(u.subarray(h+8,D)):(P=bl(u.subarray(h+8,D),c.slice(1)),P.length&&(p=p.concat(P)))),h=D;return p},La=bl,em=ls.toUnsigned,tm=s.getUint64,im=function(u){var c={version:u[0],flags:new Uint8Array(u.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=tm(u.subarray(4)):c.baseMediaDecodeTime=em(u[4]<<24|u[5]<<16|u[6]<<8|u[7]),c},Oa=im,rm=function(u){var c=new DataView(u.buffer,u.byteOffset,u.byteLength),p={version:u[0],flags:new Uint8Array(u.subarray(1,4)),trackId:c.getUint32(4)},h=p.flags[2]&1,g=p.flags[2]&2,m=p.flags[2]&8,D=p.flags[2]&16,P=p.flags[2]&32,R=p.flags[0]&65536,q=p.flags[0]&131072,W;return W=8,h&&(W+=4,p.baseDataOffset=c.getUint32(12),W+=4),g&&(p.sampleDescriptionIndex=c.getUint32(W),W+=4),m&&(p.defaultSampleDuration=c.getUint32(W),W+=4),D&&(p.defaultSampleSize=c.getUint32(W),W+=4),P&&(p.defaultSampleFlags=c.getUint32(W)),R&&(p.durationIsEmpty=!0),!h&&q&&(p.baseDataOffsetIsMoof=!0),p},vl=rm,nm=function(u){return{isLeading:(u[0]&12)>>>2,dependsOn:u[0]&3,isDependedOn:(u[1]&192)>>>6,hasRedundancy:(u[1]&48)>>>4,paddingValue:(u[1]&14)>>>1,isNonSyncSample:u[1]&1,degradationPriority:u[2]<<8|u[3]}},sm=nm,Tl=sm,am=function(u){var c={version:u[0],flags:new Uint8Array(u.subarray(1,4)),samples:[]},p=new DataView(u.buffer,u.byteOffset,u.byteLength),h=c.flags[2]&1,g=c.flags[2]&4,m=c.flags[1]&1,D=c.flags[1]&2,P=c.flags[1]&4,R=c.flags[1]&8,q=p.getUint32(4),W=8,ie;for(h&&(c.dataOffset=p.getInt32(W),W+=4),g&&q&&(ie={flags:Tl(u.subarray(W,W+4))},W+=4,m&&(ie.duration=p.getUint32(W),W+=4),D&&(ie.size=p.getUint32(W),W+=4),R&&(c.version===1?ie.compositionTimeOffset=p.getInt32(W):ie.compositionTimeOffset=p.getUint32(W),W+=4),c.samples.push(ie),q--);q--;)ie={},m&&(ie.duration=p.getUint32(W),W+=4),D&&(ie.size=p.getUint32(W),W+=4),P&&(ie.flags=Tl(u.subarray(W,W+4)),W+=4),R&&(c.version===1?ie.compositionTimeOffset=p.getInt32(W):ie.compositionTimeOffset=p.getUint32(W),W+=4),c.samples.push(ie);return c},Sl=am,Cl={tfdt:Oa,trun:Sl},El={parseTfdt:Cl.tfdt,parseTrun:Cl.trun},om=function(u){for(var c=0,p=String.fromCharCode(u[c]),h="";p!=="\0";)h+=p,c++,p=String.fromCharCode(u[c]);return h+=p,h},um={uint8ToCString:om},cs=um.uint8ToCString,lm=s.getUint64,cm=function(u){var c=4,p=u[0],h,g,m,D,P,R,q,W;if(p===0){h=cs(u.subarray(c)),c+=h.length,g=cs(u.subarray(c)),c+=g.length;var ie=new DataView(u.buffer);m=ie.getUint32(c),c+=4,P=ie.getUint32(c),c+=4,R=ie.getUint32(c),c+=4,q=ie.getUint32(c),c+=4}else if(p===1){var ie=new DataView(u.buffer);m=ie.getUint32(c),c+=4,D=lm(u.subarray(c)),c+=8,R=ie.getUint32(c),c+=4,q=ie.getUint32(c),c+=4,h=cs(u.subarray(c)),c+=h.length,g=cs(u.subarray(c)),c+=g.length}W=new Uint8Array(u.subarray(c,u.byteLength));var me={scheme_id_uri:h,value:g,timescale:m||1,presentation_time:D,presentation_time_delta:P,event_duration:R,id:q,message_data:W};return hm(p,me)?me:void 0},dm=function(u,c,p,h){return u||u===0?u/c:h+p/c},hm=function(u,c){var p=c.scheme_id_uri!=="\0",h=u===0&&wl(c.presentation_time_delta)&&p,g=u===1&&wl(c.presentation_time)&&p;return!(u>1)&&h||g},wl=function(u){return u!==void 0||u!==null},pm={parseEmsgBox:cm,scaleTime:dm},sn;typeof window<"u"?sn=window:typeof i<"u"?sn=i:typeof self<"u"?sn=self:sn={};var xl=sn,ds=ls.toUnsigned,an=ls.toHexString,ct=La,fr=_l,Na=pm,fm=vl,gm=Sl,mm=Oa,ym=s.getUint64,kl,Al,Dl,Il,Pl,Fa,Ll,Ra=xl,_m=il.parseId3Frames;kl=function(u){var c={},p=ct(u,["moov","trak"]);return p.reduce(function(h,g){var m,D,P,R,q;return m=ct(g,["tkhd"])[0],!m||(D=m[0],P=D===0?12:20,R=ds(m[P]<<24|m[P+1]<<16|m[P+2]<<8|m[P+3]),q=ct(g,["mdia","mdhd"])[0],!q)?null:(D=q[0],P=D===0?12:20,h[R]=ds(q[P]<<24|q[P+1]<<16|q[P+2]<<8|q[P+3]),h)},c)},Al=function(u,c){var p;p=ct(c,["moof","traf"]);var h=p.reduce(function(g,m){var D=ct(m,["tfhd"])[0],P=ds(D[4]<<24|D[5]<<16|D[6]<<8|D[7]),R=u[P]||9e4,q=ct(m,["tfdt"])[0],W=new DataView(q.buffer,q.byteOffset,q.byteLength),ie;q[0]===1?ie=ym(q.subarray(4,12)):ie=W.getUint32(4);let me;return typeof ie=="bigint"?me=ie/Ra.BigInt(R):typeof ie=="number"&&!isNaN(ie)&&(me=ie/R),me<Number.MAX_SAFE_INTEGER&&(me=Number(me)),me<g&&(g=me),g},1/0);return typeof h=="bigint"||isFinite(h)?h:0},Dl=function(u,c){var p=ct(c,["moof","traf"]),h=0,g=0,m;if(p&&p.length){var D=ct(p[0],["tfhd"])[0],P=ct(p[0],["trun"])[0],R=ct(p[0],["tfdt"])[0];if(D){var q=fm(D);m=q.trackId}if(R){var W=mm(R);h=W.baseMediaDecodeTime}if(P){var ie=gm(P);ie.samples&&ie.samples.length&&(g=ie.samples[0].compositionTimeOffset||0)}}var me=u[m]||9e4;typeof h=="bigint"&&(g=Ra.BigInt(g),me=Ra.BigInt(me));var ae=(h+g)/me;return typeof ae=="bigint"&&ae<Number.MAX_SAFE_INTEGER&&(ae=Number(ae)),ae},Il=function(u){var c=ct(u,["moov","trak"]),p=[];return c.forEach(function(h){var g=ct(h,["mdia","hdlr"]),m=ct(h,["tkhd"]);g.forEach(function(D,P){var R=fr(D.subarray(8,12)),q=m[P],W,ie,me;R==="vide"&&(W=new DataView(q.buffer,q.byteOffset,q.byteLength),ie=W.getUint8(0),me=ie===0?W.getUint32(12):W.getUint32(20),p.push(me))})}),p},Fa=function(u){var c=u[0],p=c===0?12:20;return ds(u[p]<<24|u[p+1]<<16|u[p+2]<<8|u[p+3])},Pl=function(u){var c=ct(u,["moov","trak"]),p=[];return c.forEach(function(h){var g={},m=ct(h,["tkhd"])[0],D,P;m&&(D=new DataView(m.buffer,m.byteOffset,m.byteLength),P=D.getUint8(0),g.id=P===0?D.getUint32(12):D.getUint32(20));var R=ct(h,["mdia","hdlr"])[0];if(R){var q=fr(R.subarray(8,12));q==="vide"?g.type="video":q==="soun"?g.type="audio":g.type=q}var W=ct(h,["mdia","minf","stbl","stsd"])[0];if(W){var ie=W.subarray(8);g.codec=fr(ie.subarray(4,8));var me=ct(ie,[g.codec])[0],ae,Ae;me&&(/^[asm]vc[1-9]$/i.test(g.codec)?(ae=me.subarray(78),Ae=fr(ae.subarray(4,8)),Ae==="avcC"&&ae.length>11?(g.codec+=".",g.codec+=an(ae[9]),g.codec+=an(ae[10]),g.codec+=an(ae[11])):g.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(g.codec)?(ae=me.subarray(28),Ae=fr(ae.subarray(4,8)),Ae==="esds"&&ae.length>20&&ae[19]!==0?(g.codec+="."+an(ae[19]),g.codec+="."+an(ae[20]>>>2&63).replace(/^0/,"")):g.codec="mp4a.40.2"):g.codec=g.codec.toLowerCase())}var Be=ct(h,["mdia","mdhd"])[0];Be&&(g.timescale=Fa(Be)),p.push(g)}),p},Ll=function(u,c=0){var p=ct(u,["emsg"]);return p.map(h=>{var g=Na.parseEmsgBox(new Uint8Array(h)),m=_m(g.message_data);return{cueTime:Na.scaleTime(g.presentation_time,g.timescale,g.presentation_time_delta,c),duration:Na.scaleTime(g.event_duration,g.timescale),frames:m}})};var on={findBox:ct,parseType:fr,timescale:kl,startTime:Al,compositionStartTime:Dl,videoTrackIds:Il,tracks:Pl,getTimescaleFromMediaHeader:Fa,getEmsgID3:Ll};const{parseTrun:bm}=El,{findBox:Ol}=on;var Nl=xl,vm=function(u){var c=Ol(u,["moof","traf"]),p=Ol(u,["mdat"]),h=[];return p.forEach(function(g,m){var D=c[m];h.push({mdat:g,traf:D})}),h},Tm=function(u,c,p){var h=c,g=p.defaultSampleDuration||0,m=p.defaultSampleSize||0,D=p.trackId,P=[];return u.forEach(function(R){var q=bm(R),W=q.samples;W.forEach(function(ie){ie.duration===void 0&&(ie.duration=g),ie.size===void 0&&(ie.size=m),ie.trackId=D,ie.dts=h,ie.compositionTimeOffset===void 0&&(ie.compositionTimeOffset=0),typeof h=="bigint"?(ie.pts=h+Nl.BigInt(ie.compositionTimeOffset),h+=Nl.BigInt(ie.duration)):(ie.pts=h+ie.compositionTimeOffset,h+=ie.duration)}),P=P.concat(W)}),P},Fl={getMdatTrafPairs:vm,parseSamples:Tm},Sm=jt.discardEmulationPreventionBytes,Cm=Ju.CaptionStream,Ma=La,Em=Oa,wm=vl,{getMdatTrafPairs:xm,parseSamples:km}=Fl,Am=function(u,c){for(var p=u,h=0;h<c.length;h++){var g=c[h];if(p<g.size)return g;p-=g.size}return null},Dm=function(u,c,p){var h=new DataView(u.buffer,u.byteOffset,u.byteLength),g={logs:[],seiNals:[]},m,D,P,R;for(D=0;D+4<u.length;D+=P)if(P=h.getUint32(D),D+=4,!(P<=0))switch(u[D]&31){case 6:var q=u.subarray(D+1,D+1+P),W=Am(D,c);if(m={nalUnitType:"sei_rbsp",size:P,data:q,escapedRBSP:Sm(q),trackId:p},W)m.pts=W.pts,m.dts=W.dts,R=W;else if(R)m.pts=R.pts,m.dts=R.dts;else{g.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+D+" for trackId "+p+". See mux.js#223."});break}g.seiNals.push(m);break}return g},Im=function(u,c){var p={},h=xm(u);return h.forEach(function(g){var m=g.mdat,D=g.traf,P=Ma(D,["tfhd"]),R=wm(P[0]),q=R.trackId,W=Ma(D,["tfdt"]),ie=W.length>0?Em(W[0]).baseMediaDecodeTime:0,me=Ma(D,["trun"]),ae,Ae;c===q&&me.length>0&&(ae=km(me,ie,R),Ae=Dm(m,ae,q),p[q]||(p[q]={seiNals:[],logs:[]}),p[q].seiNals=p[q].seiNals.concat(Ae.seiNals),p[q].logs=p[q].logs.concat(Ae.logs))}),p},Pm=function(u,c,p){var h;if(c===null)return null;h=Im(u,c);var g=h[c]||{};return{seiNals:g.seiNals,logs:g.logs,timescale:p}},Lm=function(){var u=!1,c,p,h,g,m,D;this.isInitialized=function(){return u},this.init=function(P){c=new Cm,u=!0,D=P?P.isPartial:!1,c.on("data",function(R){R.startTime=R.startPts/g,R.endTime=R.endPts/g,m.captions.push(R),m.captionStreams[R.stream]=!0}),c.on("log",function(R){m.logs.push(R)})},this.isNewInit=function(P,R){return P&&P.length===0||R&&typeof R=="object"&&Object.keys(R).length===0?!1:h!==P[0]||g!==R[h]},this.parse=function(P,R,q){var W;if(this.isInitialized()){if(!R||!q)return null;if(this.isNewInit(R,q))h=R[0],g=q[h];else if(h===null||!g)return p.push(P),null}else return null;for(;p.length>0;){var ie=p.shift();this.parse(ie,R,q)}return W=Pm(P,h,g),W&&W.logs&&(m.logs=m.logs.concat(W.logs)),W===null||!W.seiNals?m.logs.length?{logs:m.logs,captions:[],captionStreams:[]}:null:(this.pushNals(W.seiNals),this.flushStream(),m)},this.pushNals=function(P){if(!this.isInitialized()||!P||P.length===0)return null;P.forEach(function(R){c.push(R)})},this.flushStream=function(){if(!this.isInitialized())return null;D?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){m.captions=[],m.captionStreams={},m.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){p=[],h=null,g=null,m?this.clearParsedCaptions():m={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Om=Lm;const{parseTfdt:Nm}=El,Ni=La,{getTimescaleFromMediaHeader:Fm}=on,{parseSamples:Rm,getMdatTrafPairs:Mm}=Fl;var Rl=function(){let u=9e4;this.init=function(c){const p=Ni(c,["moov","trak","mdia","mdhd"])[0];p&&(u=Fm(p))},this.parseSegment=function(c){const p=[],h=Mm(c);let g=0;return h.forEach(function(m){const D=m.mdat,P=m.traf,R=Ni(P,["tfdt"])[0],q=Ni(P,["tfhd"])[0],W=Ni(P,["trun"]);if(R&&(g=Nm(R).baseMediaDecodeTime),W.length&&q){const ie=Rm(W,g,q);let me=0;ie.forEach(function(ae){const Ae="utf-8",Be=new TextDecoder(Ae),gt=D.slice(me,me+ae.size);if(Ni(gt,["vtte"])[0]){me+=ae.size;return}Ni(gt,["vttc"]).forEach(function(xt){const ui=Ni(xt,["payl"])[0],un=Ni(xt,["sttg"])[0],fs=ae.pts/u,gs=(ae.pts+ae.duration)/u;let Yi,ln;if(ui)try{Yi=Be.decode(ui)}catch(tt){console.error(tt)}if(un)try{ln=Be.decode(un)}catch(tt){console.error(tt)}ae.duration&&Yi&&p.push({cueText:Yi,start:fs,end:gs,settings:ln})}),me+=ae.size})}}),p}},Ba=Xn,Ml=function(u){var c=u[1]&31;return c<<=8,c|=u[2],c},hs=function(u){return!!(u[1]&64)},ps=function(u){var c=0;return(u[3]&48)>>>4>1&&(c+=u[4]+1),c},Bm=function(u,c){var p=Ml(u);return p===0?"pat":p===c?"pmt":c?"pes":null},Um=function(u){var c=hs(u),p=4+ps(u);return c&&(p+=u[p]+1),(u[p+10]&31)<<8|u[p+11]},qm=function(u){var c={},p=hs(u),h=4+ps(u);if(p&&(h+=u[h]+1),!!(u[h+5]&1)){var g,m,D;g=(u[h+1]&15)<<8|u[h+2],m=3+g-4,D=(u[h+10]&15)<<8|u[h+11];for(var P=12+D;P<m;){var R=h+P;c[(u[R+1]&31)<<8|u[R+2]]=u[R],P+=((u[R+3]&15)<<8|u[R+4])+5}return c}},jm=function(u,c){var p=Ml(u),h=c[p];switch(h){case Ba.H264_STREAM_TYPE:return"video";case Ba.ADTS_STREAM_TYPE:return"audio";case Ba.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},$m=function(u){var c=hs(u);if(!c)return null;var p=4+ps(u);if(p>=u.byteLength)return null;var h=null,g;return g=u[p+7],g&192&&(h={},h.pts=(u[p+9]&14)<<27|(u[p+10]&255)<<20|(u[p+11]&254)<<12|(u[p+12]&255)<<5|(u[p+13]&254)>>>3,h.pts*=4,h.pts+=(u[p+13]&6)>>>1,h.dts=h.pts,g&64&&(h.dts=(u[p+14]&14)<<27|(u[p+15]&255)<<20|(u[p+16]&254)<<12|(u[p+17]&255)<<5|(u[p+18]&254)>>>3,h.dts*=4,h.dts+=(u[p+18]&6)>>>1)),h},Ua=function(u){switch(u){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Hm=function(u){for(var c=4+ps(u),p=u.subarray(c),h=0,g=0,m=!1,D;g<p.byteLength-3;g++)if(p[g+2]===1){h=g+5;break}for(;h<p.byteLength;)switch(p[h]){case 0:if(p[h-1]!==0){h+=2;break}else if(p[h-2]!==0){h++;break}g+3!==h-2&&(D=Ua(p[g+3]&31),D==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0));do h++;while(p[h]!==1&&h<p.length);g=h-2,h+=3;break;case 1:if(p[h-1]!==0||p[h-2]!==0){h+=3;break}D=Ua(p[g+3]&31),D==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0),g=h-2,h+=3;break;default:h+=3;break}return p=p.subarray(g),h-=g,g=0,p&&p.byteLength>3&&(D=Ua(p[g+3]&31),D==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0)),m},Vm={parseType:Bm,parsePat:Um,parsePmt:qm,parsePayloadUnitStartIndicator:hs,parsePesType:jm,parsePesTime:$m,videoPacketContainsKeyFrame:Hm},Bl=Xn,gr=el.handleRollover,Ke={};Ke.ts=Vm,Ke.aac=Pa;var Ki=Ve.ONE_SECOND_IN_TS,wt=188,oi=71,zm=function(u,c){for(var p=0,h=wt,g,m;h<u.byteLength;){if(u[p]===oi&&u[h]===oi){switch(g=u.subarray(p,h),m=Ke.ts.parseType(g,c.pid),m){case"pat":c.pid=Ke.ts.parsePat(g);break;case"pmt":var D=Ke.ts.parsePmt(g);c.table=c.table||{},Object.keys(D).forEach(function(P){c.table[P]=D[P]});break}p+=wt,h+=wt;continue}p++,h++}},Ul=function(u,c,p){for(var h=0,g=wt,m,D,P,R,q,W=!1;g<=u.byteLength;){if(u[h]===oi&&(u[g]===oi||g===u.byteLength)){switch(m=u.subarray(h,g),D=Ke.ts.parseType(m,c.pid),D){case"pes":P=Ke.ts.parsePesType(m,c.table),R=Ke.ts.parsePayloadUnitStartIndicator(m),P==="audio"&&R&&(q=Ke.ts.parsePesTime(m),q&&(q.type="audio",p.audio.push(q),W=!0));break}if(W)break;h+=wt,g+=wt;continue}h++,g++}for(g=u.byteLength,h=g-wt,W=!1;h>=0;){if(u[h]===oi&&(u[g]===oi||g===u.byteLength)){switch(m=u.subarray(h,g),D=Ke.ts.parseType(m,c.pid),D){case"pes":P=Ke.ts.parsePesType(m,c.table),R=Ke.ts.parsePayloadUnitStartIndicator(m),P==="audio"&&R&&(q=Ke.ts.parsePesTime(m),q&&(q.type="audio",p.audio.push(q),W=!0));break}if(W)break;h-=wt,g-=wt;continue}h--,g--}},Wm=function(u,c,p){for(var h=0,g=wt,m,D,P,R,q,W,ie,me,ae=!1,Ae={data:[],size:0};g<u.byteLength;){if(u[h]===oi&&u[g]===oi){switch(m=u.subarray(h,g),D=Ke.ts.parseType(m,c.pid),D){case"pes":if(P=Ke.ts.parsePesType(m,c.table),R=Ke.ts.parsePayloadUnitStartIndicator(m),P==="video"&&(R&&!ae&&(q=Ke.ts.parsePesTime(m),q&&(q.type="video",p.video.push(q),ae=!0)),!p.firstKeyFrame)){if(R&&Ae.size!==0){for(W=new Uint8Array(Ae.size),ie=0;Ae.data.length;)me=Ae.data.shift(),W.set(me,ie),ie+=me.byteLength;if(Ke.ts.videoPacketContainsKeyFrame(W)){var Be=Ke.ts.parsePesTime(W);Be?(p.firstKeyFrame=Be,p.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}Ae.size=0}Ae.data.push(m),Ae.size+=m.byteLength}break}if(ae&&p.firstKeyFrame)break;h+=wt,g+=wt;continue}h++,g++}for(g=u.byteLength,h=g-wt,ae=!1;h>=0;){if(u[h]===oi&&u[g]===oi){switch(m=u.subarray(h,g),D=Ke.ts.parseType(m,c.pid),D){case"pes":P=Ke.ts.parsePesType(m,c.table),R=Ke.ts.parsePayloadUnitStartIndicator(m),P==="video"&&R&&(q=Ke.ts.parsePesTime(m),q&&(q.type="video",p.video.push(q),ae=!0));break}if(ae)break;h-=wt,g-=wt;continue}h--,g--}},Gm=function(u,c){if(u.audio&&u.audio.length){var p=c;(typeof p>"u"||isNaN(p))&&(p=u.audio[0].dts),u.audio.forEach(function(m){m.dts=gr(m.dts,p),m.pts=gr(m.pts,p),m.dtsTime=m.dts/Ki,m.ptsTime=m.pts/Ki})}if(u.video&&u.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=u.video[0].dts),u.video.forEach(function(m){m.dts=gr(m.dts,h),m.pts=gr(m.pts,h),m.dtsTime=m.dts/Ki,m.ptsTime=m.pts/Ki}),u.firstKeyFrame){var g=u.firstKeyFrame;g.dts=gr(g.dts,h),g.pts=gr(g.pts,h),g.dtsTime=g.dts/Ki,g.ptsTime=g.pts/Ki}}},Xm=function(u){for(var c=!1,p=0,h=null,g=null,m=0,D=0,P;u.length-D>=3;){var R=Ke.aac.parseType(u,D);switch(R){case"timed-metadata":if(u.length-D<10){c=!0;break}if(m=Ke.aac.parseId3TagSize(u,D),m>u.length){c=!0;break}g===null&&(P=u.subarray(D,D+m),g=Ke.aac.parseAacTimestamp(P)),D+=m;break;case"audio":if(u.length-D<7){c=!0;break}if(m=Ke.aac.parseAdtsSize(u,D),m>u.length){c=!0;break}h===null&&(P=u.subarray(D,D+m),h=Ke.aac.parseSampleRate(P)),p++,D+=m;break;default:D++;break}if(c)return null}if(h===null||g===null)return null;var q=Ki/h,W={audio:[{type:"audio",dts:g,pts:g},{type:"audio",dts:g+p*1024*q,pts:g+p*1024*q}]};return W},Km=function(u){var c={pid:null,table:null},p={};zm(u,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var g=c.table[h];switch(g){case Bl.H264_STREAM_TYPE:p.video=[],Wm(u,c,p),p.video.length===0&&delete p.video;break;case Bl.ADTS_STREAM_TYPE:p.audio=[],Ul(u,c,p),p.audio.length===0&&delete p.audio;break}}return p},Ym=function(u,c){var p=Ke.aac.isLikelyAacData(u),h;return p?h=Xm(u):h=Km(u),!h||!h.audio&&!h.video?null:(Gm(h,c),h)},Qm={inspect:Ym,parseAudioPes_:Ul};const Jm=function(u,c){c.on("data",function(p){const h=p.initSegment;p.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const g=p.data;p.data=g.buffer,u.postMessage({action:"data",segment:p,byteOffset:g.byteOffset,byteLength:g.byteLength},[p.data])}),c.on("done",function(p){u.postMessage({action:"done"})}),c.on("gopInfo",function(p){u.postMessage({action:"gopInfo",gopInfo:p})}),c.on("videoSegmentTimingInfo",function(p){const h={start:{decode:Ve.videoTsToSeconds(p.start.dts),presentation:Ve.videoTsToSeconds(p.start.pts)},end:{decode:Ve.videoTsToSeconds(p.end.dts),presentation:Ve.videoTsToSeconds(p.end.pts)},baseMediaDecodeTime:Ve.videoTsToSeconds(p.baseMediaDecodeTime)};p.prependedContentDuration&&(h.prependedContentDuration=Ve.videoTsToSeconds(p.prependedContentDuration)),u.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(p){const h={start:{decode:Ve.videoTsToSeconds(p.start.dts),presentation:Ve.videoTsToSeconds(p.start.pts)},end:{decode:Ve.videoTsToSeconds(p.end.dts),presentation:Ve.videoTsToSeconds(p.end.pts)},baseMediaDecodeTime:Ve.videoTsToSeconds(p.baseMediaDecodeTime)};p.prependedContentDuration&&(h.prependedContentDuration=Ve.videoTsToSeconds(p.prependedContentDuration)),u.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(p){u.postMessage({action:"id3Frame",id3Frame:p})}),c.on("caption",function(p){u.postMessage({action:"caption",caption:p})}),c.on("trackinfo",function(p){u.postMessage({action:"trackinfo",trackInfo:p})}),c.on("audioTimingInfo",function(p){u.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Ve.videoTsToSeconds(p.start),end:Ve.videoTsToSeconds(p.end)}})}),c.on("videoTimingInfo",function(p){u.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Ve.videoTsToSeconds(p.start),end:Ve.videoTsToSeconds(p.end)}})}),c.on("log",function(p){u.postMessage({action:"log",log:p})})};class ql{constructor(c,p){this.options=p||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Xg.Transmuxer(this.options),Jm(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new Om,this.captionParser.init());const p=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(p,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:p.buffer},[p.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new Rl);const p=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(p)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new Rl);const p=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(p);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:p.buffer},[p.buffer])}probeMp4StartTime({timescales:c,data:p}){const h=on.startTime(c,p);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:p},[p.buffer])}probeMp4Tracks({data:c}){const p=on.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:p,data:c},[c.buffer])}probeEmsgID3({data:c,offset:p}){const h=on.getEmsgID3(c,p);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:p}){const h=typeof p=="number"&&!isNaN(p)?p*Ve.ONE_SECOND_IN_TS:void 0,g=Qm.inspect(c,h);let m=null;g&&(m={hasVideo:g.video&&g.video.length===2||!1,hasAudio:g.audio&&g.audio.length===2||!1},m.hasVideo&&(m.videoStart=g.video[0].ptsTime),m.hasAudio&&(m.audioStart=g.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:m,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const p=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(p)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const p=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Ve.secondsToVideoTs(p)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(Ve.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(u){if(u.data.action==="init"&&u.data.options){this.messageHandlers=new ql(self,u.data.options);return}this.messageHandlers||(this.messageHandlers=new ql(self)),u.data&&u.data.action&&u.data.action!=="init"&&this.messageHandlers[u.data.action]&&this.messageHandlers[u.data.action](u.data)}}));var Q1=mf(Y1);const J1=(i,e,t)=>{const{type:r,initSegment:n,captions:s,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=i.data.segment;e.buffer.push({captions:s,captionStreams:a,metadata:o});const f=i.data.segment.boxes||{data:i.data.segment.data},_={type:r,data:new Uint8Array(f.data,f.data.byteOffset,f.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof l<"u"&&(_.videoFrameDtsTime=l),typeof d<"u"&&(_.videoFramePtsTime=d),t(_)},Z1=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},eb=(i,e)=>{e.gopInfo=i.data.gopInfo},bf=i=>{const{transmuxer:e,bytes:t,audioAppendStart:r,gopsToAlignWith:n,remux:s,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:f,onAudioSegmentTimingInfo:_,onId3:w,onCaptions:T,onDone:k,onEndedTimeline:b,onTransmuxerLog:x,isEndOfTimeline:O,segment:C,triggerSegmentEventFn:A}=i,z={buffer:[]};let V=O;const U=L=>{e.currentTransmux===i&&(L.data.action==="data"&&J1(L,z,a),L.data.action==="trackinfo"&&o(L.data.trackInfo),L.data.action==="gopInfo"&&eb(L,z),L.data.action==="audioTimingInfo"&&l(L.data.audioTimingInfo),L.data.action==="videoTimingInfo"&&d(L.data.videoTimingInfo),L.data.action==="videoSegmentTimingInfo"&&f(L.data.videoSegmentTimingInfo),L.data.action==="audioSegmentTimingInfo"&&_(L.data.audioSegmentTimingInfo),L.data.action==="id3Frame"&&w([L.data.id3Frame],L.data.id3Frame.dispatchType),L.data.action==="caption"&&T(L.data.caption),L.data.action==="endedtimeline"&&(V=!1,b()),L.data.action==="log"&&x(L.data.log),L.data.type==="transmuxed"&&(V||(e.onmessage=null,Z1({transmuxedData:z,callback:k}),vf(e))))},I=()=>{const L={message:"Received an error message from the transmuxer worker",metadata:{errorType:K.Error.StreamingFailedToTransmuxSegment,segmentInfo:tr({segment:C})}};k(null,L)};if(e.onmessage=U,e.onerror=I,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof s<"u"&&e.postMessage({action:"setRemux",remux:s}),t.byteLength){const L=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;A({type:"segmenttransmuxingstart",segment:C}),e.postMessage({action:"push",data:L,byteOffset:v,byteLength:t.byteLength},[L])}O&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},vf=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():bf(i.currentTransmux))},cd=(i,e)=>{i.postMessage({action:e}),vf(i)},Tf=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,cd(e,i);return}e.transmuxQueue.push(cd.bind(null,e,i))},tb=i=>{Tf("reset",i)},ib=i=>{Tf("endTimeline",i)},Sf=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,bf(i);return}i.transmuxer.transmuxQueue.push(i)},rb=i=>{const e=new Q1;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var _o={reset:tb,endTimeline:ib,transmux:Sf,createTransmuxer:rb};const kr=function(i){const e=i.transmuxer,t=i.endAction||i.action,r=i.callback,n=dt({},i,{endAction:null,transmuxer:null,callback:null}),s=a=>{a.data.action===t&&(e.removeEventListener("message",s),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),r(a.data))};if(e.addEventListener("message",s),i.data){const a=i.data instanceof ArrayBuffer;n.byteOffset=a?0:i.data.byteOffset,n.byteLength=i.data.byteLength;const o=[a?i.data:i.data.buffer];e.postMessage(n,o)}else e.postMessage(n)},mi={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Cf="wvtt",Ko=i=>{i.forEach(e=>{e.abort()})},nb=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),sb=i=>{const e=i.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=i.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},qu=(i,e)=>{const{requestType:t}=e,r=ur({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:mi.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:mi.ABORTED,xhr:e,metadata:r}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:mi.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:mi.FAILURE,xhr:e,metadata:r}:null},dd=(i,e,t,r)=>(n,s)=>{const a=s.response,o=qu(n,s);if(o)return t(o,i);if(a.byteLength!==16)return t({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:mi.FAILURE,xhr:s},i);const l=new DataView(a),d=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=d;const f={uri:s.uri};return r({type:"segmentkeyloadcomplete",segment:i,keyInfo:f}),t(null,i)},ab=(i,e)=>{e===Cf&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},ob=(i,e,t)=>{e===Cf&&kr({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:r,mp4VttCues:n})=>{i.bytes=r,t(null,i,{mp4VttCues:n})}})},Ef=(i,e)=>{const t=lu(i.map.bytes);if(t!=="mp4"){const r=i.map.resolvedUri||i.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${r}`,code:mi.FAILURE,metadata:{mediaType:n}})}kr({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:r,data:n})=>(i.map.bytes=n,r.forEach(function(s){i.map.tracks=i.map.tracks||{},!i.map.tracks[s.type]&&(i.map.tracks[s.type]=s,typeof s.id=="number"&&s.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[s.id]=s.timescale),s.type==="text"&&ab(i,s.codec))}),e(null))})},ub=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(r,n)=>{const s=qu(r,n);if(s)return e(s,i);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,Ef(i,function(o){if(o)return o.xhr=n,o.status=n.status,e(o,i);e(null,i)})},lb=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:r})=>(n,s)=>{const a=qu(n,s);if(a)return e(a,i);r({type:"segmentloaded",segment:i});const o=t==="arraybuffer"||!s.responseText?s.response:X1(s.responseText.substring(i.lastReachedChar||0));return i.stats=nb(s),i.key?i.encryptedBytes=new Uint8Array(o):i.bytes=new Uint8Array(o),e(null,i)},cb=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})=>{const k=i.map&&i.map.tracks||{},b=!!(k.audio&&k.video);let x=r.bind(null,i,"audio","start");const O=r.bind(null,i,"audio","end");let C=r.bind(null,i,"video","start");const A=r.bind(null,i,"video","end"),z=()=>Sf({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:b,onData:V=>{V.type=V.type==="combined"?"video":V.type,f(i,V)},onTrackInfo:V=>{t&&(b&&(V.isMuxed=!0),t(i,V))},onAudioTimingInfo:V=>{x&&typeof V.start<"u"&&(x(V.start),x=null),O&&typeof V.end<"u"&&O(V.end)},onVideoTimingInfo:V=>{C&&typeof V.start<"u"&&(C(V.start),C=null),A&&typeof V.end<"u"&&A(V.end)},onVideoSegmentTimingInfo:V=>{const U={pts:{start:V.start.presentation,end:V.end.presentation},dts:{start:V.start.decode,end:V.end.decode}};T({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:U}),n(V)},onAudioSegmentTimingInfo:V=>{const U={pts:{start:V.start.pts,end:V.end.pts},dts:{start:V.start.dts,end:V.end.dts}};T({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:U}),s(V)},onId3:(V,U)=>{a(i,V,U)},onCaptions:V=>{o(i,[V])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:w,onDone:(V,U)=>{_&&(V.type=V.type==="combined"?"video":V.type,T({type:"segmenttransmuxingcomplete",segment:i}),_(U,i,V))},segment:i,triggerSegmentEventFn:T});kr({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:V=>{i.bytes=e=V.data;const U=V.result;U&&(t(i,{hasAudio:U.hasAudio,hasVideo:U.hasVideo,isMuxed:b}),t=null),z()}})},wf=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})=>{let k=new Uint8Array(e);if(P2(k)){i.isFmp4=!0;const{tracks:b}=i.map;if(b.text&&(!b.audio||!b.video)){f(i,{data:k,type:"text"}),ob(i,b.text.codec,_);return}const x={isFmp4:!0,hasVideo:!!b.video,hasAudio:!!b.audio};b.audio&&b.audio.codec&&b.audio.codec!=="enca"&&(x.audioCodec=b.audio.codec),b.video&&b.video.codec&&b.video.codec!=="encv"&&(x.videoCodec=b.video.codec),b.video&&b.audio&&(x.isMuxed=!0),t(i,x);const O=(C,A)=>{f(i,{data:k,type:x.hasAudio&&!x.isMuxed?"audio":"video"}),A&&A.length&&a(i,A),C&&C.length&&o(i,C),_(null,i,{})};kr({action:"probeMp4StartTime",timescales:i.map.timescales,data:k,transmuxer:i.transmuxer,callback:({data:C,startTime:A})=>{e=C.buffer,i.bytes=k=C,x.hasAudio&&!x.isMuxed&&r(i,"audio","start",A),x.hasVideo&&r(i,"video","start",A),kr({action:"probeEmsgID3",data:k,transmuxer:i.transmuxer,offset:A,callback:({emsgData:z,id3Frames:V})=>{if(e=z.buffer,i.bytes=k=z,!b.video||!z.byteLength||!i.transmuxer){O(void 0,V);return}kr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:k,timescales:i.map.timescales,trackIds:[b.video.id],callback:U=>{e=U.data.buffer,i.bytes=k=U.data,U.logs.forEach(function(I){w(We(I,{stream:"mp4CaptionParser"}))}),O(U.captions,V)}})}})}});return}if(!i.transmuxer){_(null,i,{});return}if(typeof i.container>"u"&&(i.container=lu(k)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),_(null,i,{});return}cb({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})},xf=function({id:i,key:e,encryptedBytes:t,decryptionWorker:r,segment:n,doneFn:s},a){const o=d=>{if(d.data.source===i){r.removeEventListener("message",o);const f=d.data.decrypted;a(new Uint8Array(f.bytes,f.byteOffset,f.byteLength))}};r.onerror=()=>{const d="An error occurred in the decryption worker",f=tr({segment:n}),_={message:d,metadata:{error:new Error(d),errorType:K.Error.StreamingFailedToDecryptSegment,segmentInfo:f,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};s(_,n)},r.addEventListener("message",o);let l;e.bytes.slice?l=e.bytes.slice():l=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(cf({source:i,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},db=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})=>{T({type:"segmentdecryptionstart"}),xf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:_},k=>{e.bytes=k,T({type:"segmentdecryptioncomplete",segment:e}),wf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})})},hb=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})=>{let k=0,b=!1;return(x,O)=>{if(!b){if(x)return b=!0,Ko(i),_(x,O);if(k+=1,k===i.length){const C=function(){if(O.encryptedBytes)return db({decryptionWorker:e,segment:O,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T});wf({segment:O,bytes:O.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:T})};if(O.endOfAllRequests=Date.now(),O.map&&O.map.encryptedBytes&&!O.map.bytes)return T({type:"segmentdecryptionstart",segment:O}),xf({decryptionWorker:e,id:O.requestId+"-init",encryptedBytes:O.map.encryptedBytes,key:O.map.key,segment:O,doneFn:_},A=>{O.map.bytes=A,T({type:"segmentdecryptioncomplete",segment:O}),Ef(O,z=>{if(z)return Ko(i),_(z,O);C()})});C()}}}},pb=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},fb=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:f})=>_=>{if(!_.target.aborted)return i.stats=We(i.stats,sb(_)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(_,i)},gb=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:r,abortFn:n,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:T,dataFn:k,doneFn:b,onTransmuxerLog:x,triggerSegmentEventFn:O})=>{const C=[],A=hb({activeXhrs:C,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:T,dataFn:k,doneFn:b,onTransmuxerLog:x,triggerSegmentEventFn:O});if(r.key&&!r.key.bytes){const L=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&L.push(r.map.key);const v=We(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),y=dd(r,L,A,O),M={uri:r.key.resolvedUri};O({type:"segmentkeyloadstart",segment:r,keyInfo:M});const F=i(v,y);C.push(F)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const M=We(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),F=dd(r,[r.map.key],A,O),H={uri:r.map.key.resolvedUri};O({type:"segmentkeyloadstart",segment:r,keyInfo:H});const X=i(M,F);C.push(X)}const L=We(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Go(r.map),requestType:"segment-media-initialization"}),v=ub({segment:r,finishProcessingFn:A,triggerSegmentEventFn:O});O({type:"segmentloadstart",segment:r});const y=i(L,v);C.push(y)}const z=We(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Go(r),requestType:"segment"}),V=lb({segment:r,finishProcessingFn:A,responseType:z.responseType,triggerSegmentEventFn:O});O({type:"segmentloadstart",segment:r});const U=i(z,V);U.addEventListener("progress",fb({segment:r,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:T,dataFn:k})),C.push(U);const I={};return C.forEach(L=>{L.addEventListener("loadend",pb({loadendState:I,abortFn:n}))}),()=>Ko(C)},Ss=Kt("PlaylistSelector"),hd=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},Ar=function(i,e){if(!i)return"";const t=B.getComputedStyle(i);return t?t[e]:""},Dr=function(i,e){const t=i.slice();i.sort(function(r,n){const s=e(r,n);return s===0?t.indexOf(r)-t.indexOf(n):s})},ju=function(i,e){let t,r;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||B.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||B.Number.MAX_VALUE,t-r},mb=function(i,e){let t,r;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||B.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||B.Number.MAX_VALUE,t===r&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-r};let kf=function(i){const{main:e,bandwidth:t,playerWidth:r,playerHeight:n,playerObjectFit:s,limitRenditionByPlayerDimensions:a,playlistController:o}=i;if(!e)return;const l={bandwidth:t,width:r,height:n,limitRenditionByPlayerDimensions:a};let d=e.playlists;Nt.isAudioOnly(e)&&(d=o.getAudioTrackPlaylists_(),l.audioOnly=!0);let f=d.map(I=>{let L;const v=I.attributes&&I.attributes.RESOLUTION&&I.attributes.RESOLUTION.width,y=I.attributes&&I.attributes.RESOLUTION&&I.attributes.RESOLUTION.height;return L=I.attributes&&I.attributes.BANDWIDTH,L=L||B.Number.MAX_VALUE,{bandwidth:L,width:v,height:y,playlist:I}});Dr(f,(I,L)=>I.bandwidth-L.bandwidth),f=f.filter(I=>!Nt.isIncompatible(I.playlist));let _=f.filter(I=>Nt.isEnabled(I.playlist));_.length||(_=f.filter(I=>!Nt.isDisabled(I.playlist)));const w=_.filter(I=>I.bandwidth*mt.BANDWIDTH_VARIANCE<t);let T=w[w.length-1];const k=w.filter(I=>I.bandwidth===T.bandwidth)[0];if(a===!1){const I=k||_[0]||f[0];if(I&&I.playlist){let L="sortedPlaylistReps";return k&&(L="bandwidthBestRep"),_[0]&&(L="enabledPlaylistReps"),Ss(`choosing ${hd(I)} using ${L} with options`,l),I.playlist}return Ss("could not choose a playlist with options",l),null}const b=w.filter(I=>I.width&&I.height);Dr(b,(I,L)=>I.width-L.width);const x=b.filter(I=>I.width===r&&I.height===n);T=x[x.length-1];const O=x.filter(I=>I.bandwidth===T.bandwidth)[0];let C,A,z;O||(C=b.filter(I=>s==="cover"?I.width>r&&I.height>n:I.width>r||I.height>n),A=C.filter(I=>I.width===C[0].width&&I.height===C[0].height),T=A[A.length-1],z=A.filter(I=>I.bandwidth===T.bandwidth)[0]);let V;if(o.leastPixelDiffSelector){const I=b.map(L=>(L.pixelDiff=Math.abs(L.width-r)+Math.abs(L.height-n),L));Dr(I,(L,v)=>L.pixelDiff===v.pixelDiff?v.bandwidth-L.bandwidth:L.pixelDiff-v.pixelDiff),V=I[0]}const U=V||z||O||k||_[0]||f[0];if(U&&U.playlist){let I="sortedPlaylistReps";return V?I="leastPixelDiffRep":z?I="resolutionPlusOneRep":O?I="resolutionBestRep":k?I="bandwidthBestRep":_[0]&&(I="enabledPlaylistReps"),Ss(`choosing ${hd(U)} using ${I} with options`,l),U.playlist}return Ss("could not choose a playlist with options",l),null};const pd=function(){let i=this.useDevicePixelRatio&&B.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),kf({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Ar(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(Ar(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?Ar(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},yb=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&B.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),kf({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Ar(this.tech_.el(),"width"),10)*r,playerHeight:parseInt(Ar(this.tech_.el(),"height"),10)*r,playerObjectFit:this.usePlayerObjectFit?Ar(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},_b=function(i){const{main:e,currentTime:t,bandwidth:r,duration:n,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=i,d=e.playlists.filter(T=>!Nt.isIncompatible(T));let f=d.filter(Nt.isEnabled);f.length||(f=d.filter(T=>!Nt.isDisabled(T)));const _=f.filter(Nt.hasAttribute.bind(null,"BANDWIDTH")).map(T=>{const k=l.getSyncPoint(T,n,o,t)?1:2,b=Nt.estimateSegmentRequestTime(s,r,T)*k-a;return{playlist:T,rebufferingImpact:b}}),w=_.filter(T=>T.rebufferingImpact<=0);return Dr(w,(T,k)=>ju(k.playlist,T.playlist)),w.length?w[0]:(Dr(_,(T,k)=>T.rebufferingImpact-k.rebufferingImpact),_[0]||null)},bb=function(){const i=this.playlists.main.playlists.filter(Nt.isEnabled);return Dr(i,(e,t)=>ju(e,t)),i.filter(e=>!!wn(this.playlists.main,e).video)[0]||null},vb=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(r=>{t.set(r,e),e+=r.byteLength})),t};function Af(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const Tb=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let r=t;/^cc708_/.test(t)&&(r="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(r);if(n)i[t]=n;else{const s=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,l=!1;const d=s[r];d&&(a=d.label,o=d.language,l=d.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:r,default:l,label:a,language:o},!1).track}}},Sb=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const r=B.WebKitDataCue||B.VTTCue;e.forEach(n=>{const s=n.stream;n.content?n.content.forEach(a=>{const o=new r(n.startTime+t,n.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",i[s].addCue(o)}):i[s].addCue(new r(n.startTime+t,n.endTime+t,n.text))})},Cb=function(i){Object.defineProperties(i.frame,{id:{get(){return K.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return K.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return K.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},Eb=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:r})=>{if(!e)return;const n=B.WebKitDataCue||B.VTTCue,s=i.metadataTrack_;if(!s||(e.forEach(f=>{const _=f.cueTime+t;typeof _!="number"||B.isNaN(_)||_<0||!(_<1/0)||!f.frames||!f.frames.length||f.frames.forEach(w=>{const T=new n(_,_,w.value||w.url||w.data||"");T.frame=w,T.value=w,Cb(T),s.addCue(T)})}),!s.cues||!s.cues.length))return;const a=s.cues,o=[];for(let f=0;f<a.length;f++)a[f]&&o.push(a[f]);const l=o.reduce((f,_)=>{const w=f[_.startTime]||[];return w.push(_),f[_.startTime]=w,f},{}),d=Object.keys(l).sort((f,_)=>Number(f)-Number(_));d.forEach((f,_)=>{const w=l[f],T=isFinite(r)?r:f,k=Number(d[_+1])||T;w.forEach(b=>{b.endTime=k})})},wb={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},xb=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),kb=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const r=B.WebKitDataCue||B.VTTCue;e.forEach(n=>{for(const s of Object.keys(n)){if(xb.has(s))continue;const a=new r(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:wb[s],data:n[s]},(s==="scte35Out"||s==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},fd=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,K.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},_n=function(i,e,t){let r,n;if(t&&t.cues)for(r=t.cues.length;r--;)n=t.cues[r],n.startTime>=i&&n.endTime<=e&&t.removeCue(n)},Ab=function(i){const e=i.cues;if(!e)return;const t={};for(let r=e.length-1;r>=0;r--){const n=e[r],s=`${n.startTime}-${n.endTime}-${n.text}`;t[s]?i.removeCue(n):t[s]=n}},Db=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const r=Math.ceil((e-t+3)*ir.ONE_SECOND_IN_TS);let n;for(n=0;n<i.length&&!(i[n].pts>r);n++);return i.slice(n)},Ib=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const r=e[0].pts;let n=0;for(n;n<i.length&&!(i[n].pts>=r);n++);return i.slice(0,n).concat(e)},Pb=(i,e,t,r)=>{const n=Math.ceil((e-r)*ir.ONE_SECOND_IN_TS),s=Math.ceil((t-r)*ir.ONE_SECOND_IN_TS),a=i.slice();let o=i.length;for(;o--&&!(i[o].pts<=s););if(o===-1)return a;let l=o+1;for(;l--&&!(i[l].pts<=n););return l=Math.max(l,0),a.splice(l,o-l+1),a},Lb=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++){const s=t[n];if(s!==r[n]||i[s]!==e[s])return!1}return!0},Ob=function(i,e,t){e=e||[];const r=[];let n=0;for(let s=0;s<e.length;s++){const a=e[s];if(i===a.timeline&&(r.push(s),n+=a.duration,n>t))return s}return r.length===0?0:r[r.length-1]},gn=1,Nb=500,gd=i=>typeof i=="number"&&isFinite(i),Cs=1/60,Fb=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,Rb=(i,e,t)=>{let r=e-mt.BACK_BUFFER_LENGTH;i.length&&(r=Math.max(r,i.start(0)));const n=e-t;return Math.min(n,r)},_r=i=>{const{startOfSegment:e,duration:t,segment:r,part:n,playlist:{mediaSequence:s,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:f}=i,_=o.length-1;let w="mediaIndex/partIndex increment";i.getMediaInfoForTime?w=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(w="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(w+=` with independent ${i.independent}`);const T=typeof d=="number",k=i.segment.uri?"segment":"pre-segment",b=T?zp({preloadSegment:r})-1:0;return`${k} [${s+l}/${s+_}]`+(T?` part [${d}/${b}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(T?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${f}] selected by [${w}] playlist [${a}]`},md=i=>`${i}TimingInfo`,Mb=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:r,overrideCheck:n})=>!n&&i===e?null:i<e?t:r.length?r.end(r.length-1):t,Yo=({timelineChangeController:i,currentTimeline:e,segmentTimeline:t,loaderType:r,audioDisabled:n})=>{if(e===t)return!1;if(r==="audio"){const s=i.lastTimelineChange({type:"main"});return!s||s.to!==t}if(r==="main"&&n){const s=i.pendingTimelineChange({type:"audio"});return!(s&&s.to===t)}return!1},Bb=i=>{if(!i)return!1;const e=i.pendingTimelineChange({type:"audio"}),t=i.pendingTimelineChange({type:"main"}),r=e&&t,n=r&&e.to!==t.to;return!!(r&&e.from!==-1&&t.from!==-1&&n)},Ub=i=>{const e=i.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=i.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Mi=i=>{const e=i.pendingSegment_;if(e&&Yo({timelineChangeController:i.timelineChangeController_,currentTimeline:i.currentTimeline_,segmentTimeline:e.timeline,loaderType:i.loaderType_,audioDisabled:i.audioDisabled_})&&Bb(i.timelineChangeController_)){if(Ub(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},qb=i=>{let e=0;return["video","audio"].forEach(function(t){const r=i[`${t}TimingInfo`];if(!r)return;const{start:n,end:s}=r;let a;typeof n=="bigint"||typeof s=="bigint"?a=B.BigInt(s)-B.BigInt(n):typeof n=="number"&&typeof s=="number"&&(a=s-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},yd=({segmentDuration:i,maxDuration:e})=>i?Math.round(i)>e+fi:!1,jb=(i,e)=>{if(e!=="hls")return null;const t=qb({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const r=i.playlist.targetDuration,n=yd({segmentDuration:t,maxDuration:r*2}),s=yd({segmentDuration:t,maxDuration:r}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${r}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||s?{severity:n?"warn":"info",message:a}:null},tr=({type:i,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:r}};class Qo extends K.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Kt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(dt({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(dt({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Mi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return _o.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&B.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,B.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&_o.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ct();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:r,isMuxed:n}=e;if(r&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const r=zs(e);let n=this.initSegments_[r];return t&&!n&&e.bytes&&(this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const r=df(e);let n=this.keyCache_[r];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[r]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(n||e).resolvedUri};return n&&(s.bytes=n.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(r&&(r.id?s=r.id:r.uri&&(s=r.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
223
+ currentTime: ${this.currentTime_()}
224
+ bufferedEnd: ${mo(this.buffered_())}
225
+ `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(B.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&_o.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,r=()=>{},n=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let s=1;const a=()=>{s--,s===0&&r()};(n||!this.audioDisabled_)&&(s++,this.sourceUpdater_.removeAudio(e,t,a)),(n||this.loaderType_==="main")&&(this.gopBuffer_=Pb(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)_n(e,t,this.inbandTextTracks_[o]);_n(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&B.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=B.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&B.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=B.setTimeout(this.monitorBufferTick_.bind(this),Nb)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:tr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,r=this.partIndex){if(!t||!this.mediaSource_)return!1;const n=typeof e=="number"&&t.segments[e],s=e+1===t.segments.length,a=!n||!n.parts||r+1===n.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&s&&a}chooseNextRequest_(){const e=this.buffered_(),t=mo(e)||0,r=Ru(e,this.currentTime_()),n=!this.hasPlayed_()&&r>=1,s=r>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=Ob(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const w=a[this.mediaIndex],T=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=w.end?w.end:t,w.parts&&w.parts[T+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=T+1):o.mediaIndex=this.mediaIndex+1}else{let w,T,k;const b=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
226
+ For TargetTime: ${b}.
227
+ CurrentTime: ${this.currentTime_()}
228
+ BufferedEnd: ${t}
229
+ Fetch At Buffer: ${this.fetchAtBuffer_}
230
+ `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const x=this.getSyncInfoFromMediaSequenceSync_(b);if(!x){const O="No sync info found while using media sequence sync";return this.error({message:O,metadata:{errorType:K.Error.StreamingFailedToSelectNextSegment,error:new Error(O)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${x.start} --> ${x.end})`),w=x.segmentIndex,T=x.partIndex,k=x.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const x=Nt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:b,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});w=x.segmentIndex,T=x.partIndex,k=x.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${b}`:`currentTime ${b}`,o.mediaIndex=w,o.startOfSegment=k,o.partIndex=T,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const l=a[o.mediaIndex];let d=l&&typeof o.partIndex=="number"&&l.parts&&l.parts[o.partIndex];if(!l||typeof o.partIndex=="number"&&!d)return null;typeof o.partIndex!="number"&&l.parts&&(o.partIndex=0,d=l.parts[0]);const f=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&d&&!f&&!d.independent)if(o.partIndex===0){const w=a[o.mediaIndex-1],T=w.parts&&w.parts.length&&w.parts[w.parts.length-1];T&&T.independent&&(o.mediaIndex-=1,o.partIndex=w.parts.length-1,o.independent="previous segment")}else l.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const r=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!r)return null;if(!r.isAppended)return r;const n=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:r,mediaIndex:n,startOfSegment:s,isSyncRequest:a,partIndex:o,forceTimestampOffset:l,getMediaInfoForTime:d}=e,f=r.segments[n],_=typeof o=="number"&&f.parts[o],w={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||f.resolvedUri,mediaIndex:n,partIndex:_?o:null,isSyncRequest:a,startOfSegment:s,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:f.timeline,duration:_&&_.duration||f.duration,segment:f,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},T=typeof l<"u"?l:this.isPendingTimestampOffset_;w.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:f.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:T});const k=mo(this.sourceUpdater_.audioBuffered());return typeof k=="number"&&(w.audioAppendStart=k-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(w.gopsToAlignWith=Db(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),w}timestampOffsetForSegment_(e){return Mb(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),r=e.bandwidth,n=this.pendingSegment_.duration,s=Nt.estimateSegmentRequestTime(n,r,this.playlist_,e.bytesReceived),a=s1(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const o=_b({main:this.vhs_.playlists.main,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const l=s-a-o.rebufferingImpact;let d=.5;a<=fi&&(d=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||l<d)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*mt.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${_r(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:r,hasVideo:n}=t,s={segmentInfo:tr({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:r,hasVideo:n}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:s}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},Lb(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this))))}handleTimingInfo_(e,t,r,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const s=this.pendingSegment_,a=md(t);s[a]=s[a]||{},s[a][r]=n,this.logger_(`timinginfo: ${t} - ${r} - ${n}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(s=>{n[s.stream]=n[s.stream]||{startTime:1/0,captions:[],endTime:0};const a=n[s.stream];a.startTime=Math.min(a.startTime,s.startTime+r),a.endTime=Math.max(a.endTime,s.endTime+r),a.captions.push(s)}),Object.keys(n).forEach(s=>{const{startTime:a,endTime:o,captions:l}=n[s],d=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${o} for ${s}`),Tb(d,this.vhs_.tech_,s),_n(a,o,d[s]),Sb({captionArray:l,inbandTextTracks:d,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,r){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,r));return}this.addMetadataToTextTrack(r,t,this.duration_())}}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Yo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:r,hasVideo:n,isMuxed:s}=t;return!(n&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Yo({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Mi(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[md(t.type)].start;else{const n=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&n&&n.hasVideo;let a;s&&(a=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:a,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,t.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==r.mediaIndex||n.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:r,playlist:n}){if(r){const s=zs(r);if(this.activeInitSegmentId_===s)return null;t=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=s}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r},n){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+rr(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+rr(a).join(", "));const o=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,d=a.length?a.start(0):0,f=a.length?a.end(a.length-1):0;if(l-o<=gn&&f-d<=gn){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${rr(s).join(", ")}, video buffer: ${rr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:r}));const _=this.currentTime_()-gn;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${gn}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=B.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},gn*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:r},n){if(n){if(n.code===rf){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:K.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:r,data:n,bytes:s}){if(!s){const o=[n];let l=n.byteLength;r&&(o.unshift(r),l+=r.byteLength),s=vb({bytes:l,segments:o})}const a={segmentInfo:tr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,r){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,s=`${e}TimingInfo`;n[s]||(n[s]={}),n[s].transmuxerPrependedSeconds=r.prependedContentDuration||0,n[s].transmuxedPresentationStart=r.start.presentation,n[s].transmuxedDecodeStart=r.start.decode,n[s].transmuxedPresentationEnd=r.end.presentation,n[s].transmuxedDecodeEnd=r.end.decode,n[s].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,t){const{type:r,data:n}=t;if(!n||!n.byteLength||r==="audio"&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:r,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:s,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){Mi(this),this.loadQueue_.push(()=>{const t=dt({},e,{forceTimestampOffset:!0});dt(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=r||n&&s;this.logger_(`Requesting
231
+ ${Af(e.uri)}
232
+ ${_r(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=gb({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:l,stream:d})=>{this.logger_(`${_r(e)} logged from transmuxer stream ${d} as a ${l}: ${o}`)},triggerSegmentEventFn:({type:o,segment:l,keyInfo:d,trackInfo:f,timingInfo:_})=>{const w={segmentInfo:tr({segment:l})};d&&(w.keyInfo=d),f&&(w.trackInfo=f),_&&(w.timingInfo=_),this.trigger({type:o,metadata:w})}})}trimBackBuffer_(e){const t=Rb(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,s=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:s},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const l=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=l}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<Cs){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Cs}`);return}const r={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:r}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,r){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,r));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===mi.ABORTED)return;if(this.pause(),e.code===mi.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,r.gopInfo&&(this.gopBuffer_=Ib(this.gopBuffer_,r.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:r,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:s,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:l}){if(typeof e<"u")return e;if(!a)return l.start;const d=t.segments[r-1];return r===0||!d||typeof d.start>"u"||d.end!==n+s?n:o.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:n,isMuxed:s}=t,a=this.loaderType_==="main"&&n,o=!this.audioDisabled_&&r&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=Fb(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const o={segmentInfo:tr({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:o})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=jb(e,this.sourceType_);if(t&&(t.severity==="warn"?K.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${_r(e)}`);return}this.logger_(`Appended ${_r(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const r=e.segment,n=e.part,s=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(s||a){this.logger_(`bad ${s?"segment":"part"} ${_r(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<Cs){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Cs}`);return}const t=this.throughput.rate,r=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/r*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,r=t.start,n=t.end;if(!gd(r)||!gd(n))return;_n(r,n,this.segmentMetadataTrack_);const s=B.WebKitDataCue||B.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:r,end:n},o=JSON.stringify(a),l=new s(r,n,o);l.value=a,this.segmentMetadataTrack_.addCue(l)}}function ki(){}const Df=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},$b=["video","audio"],Jo=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},Hb=(i,e)=>{for(let t=0;t<e.length;t++){const r=e[t];if(r.type==="mediaSource")return null;if(r.type===i)return t}return null},Ir=(i,e)=>{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Ir("audio",e),Ir("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Jo(i,e))){if(r.type!==i){if(t=Hb(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,Ir(i,e);return}}},If=(i,e)=>{const t=e[`${i}Buffer`],r=Df(i);t&&(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},di=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,Rt={appendBuffer:(i,e,t)=>(r,n)=>{const s=n[`${r}Buffer`];if(di(n.mediaSource,s)){n.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{s.appendBuffer(i)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===rf?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),n.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const n=r[`${t}Buffer`];if(di(r.mediaSource,n)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{n.remove(i,e)}catch{r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];di(t.mediaSource,r)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){K.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){K.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(di(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){K.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=Df(i),n=Pr(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const s=t.mediaSource.addSourceBuffer(n);s.addEventListener("updateend",t[`on${r}UpdateEnd_`]),s.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=s},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(If(i,e),!!di(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){K.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],n=Pr(i);if(!di(t.mediaSource,r))return;const s=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===s)return;const o={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:o}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{r.changeType(n),t.codecs[e]=i}catch(l){o.errorType=K.Error.StreamingCodecsChangeError,o.error=l,l.metadata=o,t.error_=l,t.trigger("error"),K.log.warn(`Failed to changeType on ${e}Buffer`,l)}}},Mt=({type:i,sourceUpdater:e,action:t,doneFn:r,name:n})=>{e.queue.push({type:i,action:t,doneFn:r,name:n}),Ir(i,e)},_d=(i,e)=>t=>{const r=e[`${i}Buffered`](),n=i1(r);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,n),e.queuePending[i]){const s=e.queuePending[i].doneFn;e.queuePending[i]=null,s&&s(e[`${i}Error_`])}Ir(i,e)};class Pf extends K.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Ir("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Kt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=_d("video",this),this.onAudioUpdateEnd_=_d("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Mt({type:"mediaSource",sourceUpdater:this,action:Rt.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Mt({type:e,sourceUpdater:this,action:Rt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){K.log.error("removeSourceBuffer is not supported!");return}Mt({type:"mediaSource",sourceUpdater:this,action:Rt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!K.browser.IS_FIREFOX&&B.MediaSource&&B.MediaSource.prototype&&typeof B.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return B.SourceBuffer&&B.SourceBuffer.prototype&&typeof B.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){K.log.error("changeType is not supported!");return}Mt({type:e,sourceUpdater:this,action:Rt.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:n,bytes:s}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${s.length} until video append`);return}const a=t;if(Mt({type:n,sourceUpdater:this,action:Rt.appendBuffer(s,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return di(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Ct()}videoBuffered(){return di(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Ct()}buffered(){const e=di(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=di(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():n1(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ki){Mt({type:"mediaSource",sourceUpdater:this,action:Rt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ki){typeof e!="string"&&(e=void 0),Mt({type:"mediaSource",sourceUpdater:this,action:Rt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=ki){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}Mt({type:"audio",sourceUpdater:this,action:Rt.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=ki){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}Mt({type:"video",sourceUpdater:this,action:Rt.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(Jo("audio",this)||Jo("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Mt({type:"audio",sourceUpdater:this,action:Rt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Mt({type:"video",sourceUpdater:this,action:Rt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Mt({type:"audio",sourceUpdater:this,action:Rt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Mt({type:"video",sourceUpdater:this,action:Rt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),$b.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>If(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const bd=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),Vb=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},vd=new Uint8Array(`
233
+
234
+ `.split("").map(i=>i.charCodeAt(0)));class zb extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Wb extends Qo{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Ct();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return Ct([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=zs(e);let n=this.initSegments_[r];if(t&&!n&&e.bytes){const s=vd.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(vd,e.bytes.byteLength),this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){_n(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===mi.TIMEOUT&&this.handleTimeout_(),e.code===mi.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,s=r.mp4VttCues&&r.mp4VttCues.length;s&&(n.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof B.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(n)}catch(o){this.stopForError({message:o.message,metadata:{errorType:K.Error.StreamingVttParserError,error:o}});return}if(s||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(o=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new B.VTTCue(o.startTime,o.endTime,o.text):o)}),Ab(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const r=e&&e.type==="vtt",n=t&&t.type==="text";r&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const n=r.start+t,s=r.end+t,a=new B.VTTCue(n,s,r.cueText);r.settings&&r.settings.split(" ").forEach(o=>{const l=o.split(":"),d=l[0],f=l[1];a[d]=isNaN(f)?f:Number(f)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof B.WebVTT!="function")throw new zb;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof B.TextDecoder=="function"?t=new B.TextDecoder("utf8"):(t=B.WebVTT.StringDecoder(),r=!0);const n=new B.WebVTT.Parser(B,B.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{K.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=bd(a)),n.parse(a)}let s=e.bytes;r&&(s=bd(s)),n.parse(s),n.flush()}updateTimeMapping_(e,t,r){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:s,LOCAL:a}=e.timestampmap,o=s/ir.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(l=>{const d=l.endTime-l.startTime,f=this.handleRollover_(l.startTime+o,t.time);l.startTime=Math.max(f,0),l.endTime=Math.max(f+d,0)}),!r.syncInfo){const l=e.cues[0].startTime,d=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(l,d-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let r=e*ir.ONE_SECOND_IN_TS;const n=t*ir.ONE_SECOND_IN_TS;let s;for(n<r?s=-8589934592:s=8589934592;Math.abs(r-n)>4294967296;)r+=s;return r/ir.ONE_SECOND_IN_TS}}const Gb=function(i,e){const t=i.cues;for(let r=0;r<t.length;r++){const n=t[r];if(e>=n.adStartTime&&e<=n.adEndTime)return n}return null},Xb=function(i,e,t=0){if(!i.segments)return;let r=t,n;for(let s=0;s<i.segments.length;s++){const a=i.segments[s];if(n||(n=Gb(e,r+a.duration/2)),n){if("cueIn"in a){n.endTime=r,n.adEndTime=r,r+=a.duration,n=null;continue}if(r<n.endTime){r+=a.duration;continue}n.endTime+=a.duration}else if("cueOut"in a&&(n=new B.VTTCue(r,r+a.duration,a.cueOut),n.adStartTime=r,n.adEndTime=r+parseFloat(a.cueOut),e.addCue(n)),"cueOutCont"in a){const[o,l]=a.cueOutCont.split("/").map(parseFloat);n=new B.VTTCue(r,r+a.duration,""),n.adStartTime=r-o,n.adEndTime=n.adStartTime+l,e.addCue(n)}r+=a.duration}};class Td{constructor({start:e,end:t,segmentIndex:r,partIndex:n=null,appended:s=!1}){this.start_=e,this.end_=t,this.segmentIndex_=r,this.partIndex_=n,this.appended_=s}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class Kb{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class Lf{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:r,segments:n}=e;if(this.isReliable_=this.isReliablePlaylist_(r,n),!!this.isReliable_)return this.updateStorage_(n,r,this.calculateBaseTime_(r,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const n of r)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,r){const n=new Map;let s=`
235
+ `,a=r,o=t;this.start_=a,e.forEach((l,d)=>{const f=this.storage_.get(o),_=a,w=_+l.duration,T=!!(f&&f.segmentSyncInfo&&f.segmentSyncInfo.isAppended),k=new Td({start:_,end:w,appended:T,segmentIndex:d});l.syncInfo=k;let b=a;const x=(l.parts||[]).map((O,C)=>{const A=b,z=b+O.duration,V=!!(f&&f.partsSyncInfo&&f.partsSyncInfo[C]&&f.partsSyncInfo[C].isAppended),U=new Td({start:A,end:z,appended:V,segmentIndex:d,partIndex:C});return b=z,s+=`Media Sequence: ${o}.${C} | Range: ${A} --> ${z} | Appended: ${V}
236
+ `,O.syncInfo=U,U});n.set(o,new Kb(k,x)),s+=`${Af(l.resolvedUri)} | Media Sequence: ${o} | Range: ${_} --> ${w} | Appended: ${T}
237
+ `,o++,a=w}),this.end_=a,this.storage_=n,this.diagnostics_=s}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const s=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let o=0;o<s;o++){const l=t[o];a-=l.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Sd extends Lf{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const Yb=86400,bo=[{name:"VOD",run:(i,e,t,r,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,n,s)=>{const a=i.getMediaSequenceSync(s);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(n);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,n)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let s=null,a=null;const o=$o(e);n=n||0;for(let l=0;l<o.length;l++){const d=e.endList||n===0?l:o.length-(l+1),f=o[d],_=f.segment,w=i.timelineToDatetimeMappings[_.timeline];if(!w||!_.dateTimeObject)continue;let T=_.dateTimeObject.getTime()/1e3+w;if(_.parts&&typeof f.partIndex=="number")for(let b=0;b<f.partIndex;b++)T+=_.parts[b].duration;const k=Math.abs(n-T);if(a!==null&&(k===0||a<k))break;a=k,s={time:T,segmentIndex:f.segmentIndex,partIndex:f.partIndex}}return s}},{name:"Segment",run:(i,e,t,r,n)=>{let s=null,a=null;n=n||0;const o=$o(e);for(let l=0;l<o.length;l++){const d=e.endList||n===0?l:o.length-(l+1),f=o[d],_=f.segment,w=f.part&&f.part.start||_&&_.start;if(_.timeline===r&&typeof w<"u"){const T=Math.abs(n-w);if(a!==null&&a<T)break;(!s||a===null||a>=T)&&(a=T,s={time:w,segmentIndex:f.segmentIndex,partIndex:f.partIndex})}}return s}},{name:"Discontinuity",run:(i,e,t,r,n)=>{let s=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const l=e.discontinuityStarts[o],d=e.discontinuitySequence+o+1,f=i.discontinuities[d];if(f){const _=Math.abs(n-f.time);if(a!==null&&a<_)break;(!s||a===null||a>=_)&&(a=_,s={time:f.time,segmentIndex:l,partIndex:null})}}}return s}},{name:"Playlist",run:(i,e,t,r,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Qb extends K.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Lf,r=new Sd(t),n=new Sd(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:n},this.logger_=Kt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,n,s){if(t!==1/0)return bo.find(({name:o})=>o==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,n,s);if(!a.length)return null;for(const o of a){const{syncPoint:l,strategy:d}=o,{segmentIndex:f,time:_}=l;if(f<0)continue;const w=e.segments[f],T=_,k=T+w.duration;if(this.logger_(`Strategy: ${d}. Current time: ${n}. selected segment: ${f}. Time: [${T} -> ${k}]}`),n>=T&&n<k)return this.logger_("Found sync point with exact match: ",l),l}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const n=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+En({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,n,s){const a=[];for(let o=0;o<bo.length;o++){const l=bo[o],d=l.run(this,e,t,r,n,s);d&&(d.strategy=l.name,a.push({strategy:l.name,syncPoint:d}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy;for(let a=1;a<e.length;a++){const o=Math.abs(e[a].syncPoint[t.key]-t.value);o<n&&(n=o,r=e[a].syncPoint,s=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${s}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,t){const r=t.mediaSequence-e.mediaSequence;if(r>Yb){K.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let n=r-1;n>=0;n--){const s=e.segments[n];if(s&&typeof s.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:s.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const n=e.segment,s=e.part;let a=this.timelines[e.timeline],o,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,l=t.end+a.mapping;else if(a)o=t.start+a.mapping,l=t.end+a.mapping;else return!1;return s&&(s.start=o,s.end=l),(!n.start||o<n.start)&&(n.start=o),n.end=l,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let n=0;n<t.discontinuityStarts.length;n++){const s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,o=s-e.mediaIndex,l=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>l){let d;o<0?d=r.start-En({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):d=r.end+En({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:d,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class Jb extends K.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){if(typeof t=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Zb=yf(_f(function(){var i=(function(){function b(){this.listeners={}}var x=b.prototype;return x.on=function(O,C){this.listeners[O]||(this.listeners[O]=[]),this.listeners[O].push(C)},x.off=function(O,C){if(!this.listeners[O])return!1;var A=this.listeners[O].indexOf(C);return this.listeners[O]=this.listeners[O].slice(0),this.listeners[O].splice(A,1),A>-1},x.trigger=function(O){var C=this.listeners[O];if(C)if(arguments.length===2)for(var A=C.length,z=0;z<A;++z)C[z].call(this,arguments[1]);else for(var V=Array.prototype.slice.call(arguments,1),U=C.length,I=0;I<U;++I)C[I].apply(this,V)},x.dispose=function(){this.listeners={}},x.pipe=function(O){this.on("data",function(C){O.push(C)})},b})();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(b){return b.subarray(0,b.byteLength-b[b.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const b=[[[],[],[],[],[]],[[],[],[],[],[]]],x=b[0],O=b[1],C=x[4],A=O[4];let z,V,U;const I=[],L=[];let v,y,M,F,H,X;for(z=0;z<256;z++)L[(I[z]=z<<1^(z>>7)*283)^z]=z;for(V=U=0;!C[V];V^=v||1,U=L[U]||1)for(F=U^U<<1^U<<2^U<<3^U<<4,F=F>>8^F&255^99,C[V]=F,A[F]=V,M=I[y=I[v=I[V]]],X=M*16843009^y*65537^v*257^V*16843008,H=I[F]*257^F*16843008,z=0;z<4;z++)x[z][V]=H=H<<24^H>>>8,O[z][F]=X=X<<24^X>>>8;for(z=0;z<5;z++)x[z]=x[z].slice(0),O[z]=O[z].slice(0);return b};let r=null;class n{constructor(x){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let O,C,A;const z=this._tables[0][4],V=this._tables[1],U=x.length;let I=1;if(U!==4&&U!==6&&U!==8)throw new Error("Invalid aes key size");const L=x.slice(0),v=[];for(this._key=[L,v],O=U;O<4*U+28;O++)A=L[O-1],(O%U===0||U===8&&O%U===4)&&(A=z[A>>>24]<<24^z[A>>16&255]<<16^z[A>>8&255]<<8^z[A&255],O%U===0&&(A=A<<8^A>>>24^I<<24,I=I<<1^(I>>7)*283)),L[O]=L[O-U]^A;for(C=0;O;C++,O--)A=L[C&3?O:O-4],O<=4||C<4?v[C]=A:v[C]=V[0][z[A>>>24]]^V[1][z[A>>16&255]]^V[2][z[A>>8&255]]^V[3][z[A&255]]}decrypt(x,O,C,A,z,V){const U=this._key[1];let I=x^U[0],L=A^U[1],v=C^U[2],y=O^U[3],M,F,H;const X=U.length/4-2;let G,te=4;const N=this._tables[1],j=N[0],Y=N[1],Q=N[2],ee=N[3],ue=N[4];for(G=0;G<X;G++)M=j[I>>>24]^Y[L>>16&255]^Q[v>>8&255]^ee[y&255]^U[te],F=j[L>>>24]^Y[v>>16&255]^Q[y>>8&255]^ee[I&255]^U[te+1],H=j[v>>>24]^Y[y>>16&255]^Q[I>>8&255]^ee[L&255]^U[te+2],y=j[y>>>24]^Y[I>>16&255]^Q[L>>8&255]^ee[v&255]^U[te+3],te+=4,I=M,L=F,v=H;for(G=0;G<4;G++)z[(3&-G)+V]=ue[I>>>24]<<24^ue[L>>16&255]<<16^ue[v>>8&255]<<8^ue[y&255]^U[te++],M=I,I=L,L=v,v=y,y=M}}class s extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(x){this.jobs.push(x),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(b){return b<<24|(b&65280)<<8|(b&16711680)>>8|b>>>24},o=function(b,x,O){const C=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>2),A=new n(Array.prototype.slice.call(x)),z=new Uint8Array(b.byteLength),V=new Int32Array(z.buffer);let U,I,L,v,y,M,F,H,X;for(U=O[0],I=O[1],L=O[2],v=O[3],X=0;X<C.length;X+=4)y=a(C[X]),M=a(C[X+1]),F=a(C[X+2]),H=a(C[X+3]),A.decrypt(y,M,F,H,V,X),V[X]=a(V[X]^U),V[X+1]=a(V[X+1]^I),V[X+2]=a(V[X+2]^L),V[X+3]=a(V[X+3]^v),U=y,I=M,L=F,v=H;return z};class l{constructor(x,O,C,A){const z=l.STEP,V=new Int32Array(x.buffer),U=new Uint8Array(x.byteLength);let I=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(V.subarray(I,I+z),O,C,U)),I=z;I<V.length;I+=z)C=new Uint32Array([a(V[I-4]),a(V[I-3]),a(V[I-2]),a(V[I-1])]),this.asyncStream_.push(this.decryptChunk_(V.subarray(I,I+z),O,C,U));this.asyncStream_.push(function(){A(null,e(U))})}static get STEP(){return 32e3}decryptChunk_(x,O,C,A){return function(){const z=o(x,O,C);A.set(z,x.byteOffset)}}}var d=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},f;typeof window<"u"?f=window:typeof d<"u"?f=d:typeof self<"u"?f=self:f={};var _=f,w=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},T=_.BigInt||Number;T("0x1"),T("0x100"),T("0x10000"),T("0x1000000"),T("0x100000000"),T("0x10000000000"),T("0x1000000000000"),T("0x100000000000000"),T("0x10000000000000000"),(function(){var b=new Uint16Array([65484]),x=new Uint8Array(b.buffer,b.byteOffset,b.byteLength);return x[0]===255?"big":x[0]===204?"little":"unknown"})();const k=function(b){const x={};return Object.keys(b).forEach(O=>{const C=b[O];w(C)?x[O]={bytes:C.buffer,byteOffset:C.byteOffset,byteLength:C.byteLength}:x[O]=C}),x};self.onmessage=function(b){const x=b.data,O=new Uint8Array(x.encrypted.bytes,x.encrypted.byteOffset,x.encrypted.byteLength),C=new Uint32Array(x.key.bytes,x.key.byteOffset,x.key.byteLength/4),A=new Uint32Array(x.iv.bytes,x.iv.byteOffset,x.iv.byteLength/4);new l(O,C,A,function(z,V){self.postMessage(k({source:x.source,decrypted:V}),[V.buffer])})}}));var ev=mf(Zb);const tv=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Of=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Zo=(i,e)=>{e.activePlaylistLoader=i,i.load()},iv=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:n}}=e,s=n.activeTrack(),a=n.getActiveGroup(),o=n.activePlaylistLoader,l=n.lastGroup_;if(!(a&&l&&a.id===l.id)&&(n.lastGroup_=a,n.lastTrack_=s,Of(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&r.resetEverything();return}t.resyncLoader(),Zo(a.playlistLoader,n)}},rv=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},nv=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:n},mediaTypes:{[i]:s}}=e,a=s.activeTrack(),o=s.getActiveGroup(),l=s.activePlaylistLoader,d=s.lastTrack_;if(!(d&&a&&d.id===a.id)&&(s.lastGroup_=o,s.lastTrack_=a,Of(r,s),!!o)){if(o.isMainPlaylist){if(!a||!d||a.id===d.id)return;const f=e.vhs.playlistController_,_=f.selectPlaylist();if(f.media()===_)return;s.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),t.pause(),n.resetEverything(),f.fastQualityChange_(_);return}if(i==="AUDIO"){if(!o.playlistLoader){n.setAudio(!0),n.resetEverything();return}r.setAudio(!0),n.setAudio(!1)}if(l===o.playlistLoader){Zo(o.playlistLoader,s);return}r.track&&r.track(a),r.resetEverything(),Zo(o.playlistLoader,s)}},Ws={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,n=t.activeTrack(),s=t.activeGroup(),a=(s.filter(l=>l.default)[0]||s[0]).id,o=t.tracks[a];if(n===o){r({error:{message:"Problem encountered loading the default audio track."}});return}K.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in t.tracks)t.tracks[l].enabled=t.tracks[l]===o;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;K.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},Cd={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:n,segmentLoaders:{[i]:s}}=t;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,n),(!r.paused()||a.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",Ws[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:n,segmentLoaders:{[i]:s},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();s.playlist(o,n),s.track(a.activeTrack()),(!r.paused()||o.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",Ws[i](i,t))}},sv={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:n},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[i]:{groups:o,tracks:l,logger_:d}},mainPlaylistLoader:f}=e,_=Un(f.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},_&&(a[i].main.default.playlists=f.main.playlists));for(const w in a[i]){o[w]||(o[w]=[]);for(const T in a[i][w]){let k=a[i][w][T],b;if(_?(d(`AUDIO group '${w}' label '${T}' is a main playlist`),k.isMainPlaylist=!0,b=null):r==="vhs-json"&&k.playlists?b=new Tr(k.playlists[0],t,s):k.resolvedUri?b=new Tr(k.resolvedUri,t,s):k.playlists&&r==="dash"?b=new Xo(k.playlists[0],t,s,f):b=null,k=We({id:T,playlistLoader:b},k),Cd[i](i,k.playlistLoader,e),o[w].push(k),typeof l[T]>"u"){const x=new K.AudioTrack({id:T,kind:tv(k),enabled:!1,language:k.language,default:k.default,label:T});l[T]=x}}}n.on("error",Ws[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:n,segmentLoaders:{[i]:s},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[i]:{groups:l,tracks:d}},mainPlaylistLoader:f}=e;for(const _ in o[i]){l[_]||(l[_]=[]);for(const w in o[i][_]){if(!r.options_.useForcedSubtitles&&o[i][_][w].forced)continue;let T=o[i][_][w],k;if(n==="hls")k=new Tr(T.resolvedUri,r,a);else if(n==="dash"){if(!T.playlists.filter(b=>b.excludeUntil!==1/0).length)return;k=new Xo(T.playlists[0],r,a,f)}else n==="vhs-json"&&(k=new Tr(T.playlists?T.playlists[0]:T.resolvedUri,r,a));if(T=We({id:w,playlistLoader:k},T),Cd[i](i,T.playlistLoader,e),l[_].push(T),typeof d[w]>"u"){const b=t.addRemoteTextTrack({id:w,kind:"subtitles",default:T.default&&T.autoselect,language:T.language,label:w},!1).track;d[w]=b}}}s.on("error",Ws[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:n,tracks:s}}}=e;for(const a in r[i]){n[a]||(n[a]=[]);for(const o in r[i][a]){const l=r[i][a][o];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const d=t.options_.vhs&&t.options_.vhs.captionServices||{};let f={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(d[f.instreamId]&&(f=We(f,d[f.instreamId])),f.default===void 0&&delete f.default,n[a].push(We({id:o},l)),typeof s[o]>"u"){const _=t.addRemoteTextTrack({id:f.instreamId,kind:"captions",default:f.default,language:f.language,label:f.label},!1).track;s[o]=_}}}}},Nf=(i,e)=>{for(let t=0;t<i.length;t++)if(Uu(e,i[t])||i[t].playlists&&Nf(i[t].playlists,e))return!0;return!1},av=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:n}}}=e,s=r.media();if(!s)return null;let a=null;s.attributes[i]&&(a=n[s.attributes[i]]);const o=Object.keys(n);if(!a)if(i==="AUDIO"&&o.length>1&&Un(e.main))for(let l=0;l<o.length;l++){const d=n[o[l]];if(Nf(d,s)){a=d;break}}else n.main?a=n.main:o.length===1&&(a=n[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(l=>l.id===t.id)[0]||null},ov={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},uv=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},lv=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(d=>{sv[d](d,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:n,segmentLoaders:{["AUDIO"]:s,main:a}}=i;["AUDIO","SUBTITLES"].forEach(d=>{e[d].activeGroup=av(d,i),e[d].activeTrack=ov[d](d,i),e[d].onGroupChanged=iv(d,i),e[d].onGroupChanging=rv(d,i),e[d].onTrackChanged=nv(d,i),e[d].getActiveGroup=uv(d,i)});const o=e.AUDIO.activeGroup();if(o){const d=(o.filter(f=>f.default)[0]||o[0]).id;e.AUDIO.tracks[d].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const d in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[d])},cv=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ki,activeTrack:ki,getActiveGroup:ki,onGroupChanged:ki,onTrackChanged:ki,lastTrack_:null,logger_:Kt(`MediaGroups[${e}]`)}}),i};class Ed{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Ot(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class dv extends K.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Ed,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Kt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const r=t.serverUri||t.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=Ot(e,r),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const r=e?t:this.getRequestURI(t);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(s,a)=>{if(s){if(a.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const d=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${d} seconds.`),this.startTTLTimeout_(parseInt(d,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let o;try{o=JSON.parse(this.request_.responseText)}catch(d){const f={errorType:K.Error.StreamingContentSteeringParserError,error:d};this.trigger({type:"error",metadata:f})}this.assignSteeringProperties_(o);const l={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:l}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new B.URL(e),r=new B.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(B.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new B.URL(e),r=this.getPathway(),n=this.getBandwidth_();if(r){const s=`_${this.manifestType_}_pathway`;t.searchParams.set(s,r)}if(n){const s=`_${this.manifestType_}_throughput`;t.searchParams.set(s,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=B.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){B.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Ed}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Ot(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const hv=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},pv=10;let Bi;const fv=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],gv=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},mv=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:a,bufferBasedABR:o,log:l}){if(!r)return K.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return l(`${d} as current playlist is not set`),!0;if(r.id===i.id)return!1;const f=!!vr(e,t).length;if(!i.endList)return!f&&typeof i.partTargetDuration=="number"?(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${d} as current playlist is live`),!0);const _=Ru(e,t),w=o?mt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:mt.MAX_BUFFER_LOW_WATER_LINE;if(a<w)return l(`${d} as duration < max low water line (${a} < ${w})`),!0;const T=r.attributes.BANDWIDTH,k=i.attributes.BANDWIDTH;if(T<k&&(!o||_<s)){let b=`${d} as next bandwidth < current bandwidth (${T} < ${k})`;return o&&(b+=` and forwardBuffer < bufferHighWaterLine (${_} < ${s})`),l(b),!0}if((!o||T>k)&&_>=n){let b=`${d} as forwardBuffer >= bufferLowWaterLine (${_} >= ${n})`;return o&&(b+=` and next bandwidth > current bandwidth (${T} > ${k})`),l(b),!0}return l(`not ${d} as no switching criteria met`),!1};class yv extends K.EventTarget{constructor(e){super(),this.fastQualityChange_=hv(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:n,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:d,sourceType:f,cacheEncryptionKeys:_,bufferBasedABR:w,leastPixelDiffSelector:T,captionServices:k,experimentalUseMMS:b}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:x}=e;(x===null||typeof x>"u")&&(x=1/0),Bi=a,this.bufferBasedABR=!!w,this.leastPixelDiffSelector=!!T,this.withCredentials=r,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=f,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=x,this.enableLowInitialPlaylist=d,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:x,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=cv(),b&&B.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new B.ManagedMediaSource,this.usingManagedMediaSource_=!0,K.log("Using ManagedMediaSource")):B.MediaSource&&(this.mediaSource=new B.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Ct(),this.hasPlayed_=!1,this.syncController_=new Qb(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ev,this.sourceUpdater_=new Pf(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Jb,this.keyStatusMap_=new Map;const O={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:k,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Xo(t,this.vhs_,We(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Tr(t,this.vhs_,We(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Qo(We(O,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Qo(We(O,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Wb(We(O,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((z,V)=>{function U(){n.off("vttjserror",I),z()}function I(){n.off("vttjsloaded",U),V()}n.one("vttjsloaded",U),n.one("vttjserror",I),n.addWebVttScript_()})}),e);const C=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new dv(this.vhs_.xhr,C),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),fv.forEach(z=>{this[z+"_"]=gv.bind(this,z)}),this.logger_=Kt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const A=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(A,()=>{const z=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-z,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const n=this.media(),s=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(s&&s!==a){this.logger_(`switch media ${s} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],r=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(r&&n){const s=(r.length?r[0].playlists:r.playlists).filter(a=>a.attributes.serviceLocation===n);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=B.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(B.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,n=Object.keys(r);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const o=r.main||n.length&&r[n[0]];for(const l in o)if(o[l].default){s={label:l};break}}if(!s)return t;const a=[];for(const o in r)if(r[o][s.label]){const l=r[o][s.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(e.playlists.length)for(let d=0;d<e.playlists.length;d++){const f=e.playlists[d];f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===o&&a.push(f)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;Ho(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),lv({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;Ho(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(dt({},t))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let n=!0;const s=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const o in r.AUDIO[a])r.AUDIO[a][o].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Bi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(r.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),n=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return mv({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const r=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:pv}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,r=>{this.player_.trigger(dt({},r))}),this.audioSegmentLoader_.on(t,r=>{this.player_.trigger(dt({},r))}),this.subtitleSegmentLoader_.on(t,r=>{this.player_.trigger(dt({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let n=r;if(e.start){const s=e.start.timeOffset;s<0?n=Math.max(r+s,t.start(0)):n=Math.min(r,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const r=Bi.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return r-n<=gi;const a=s.end(s.length-1);return a-n<=gi&&r-a<=gi}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,s=n.filter(Ta),a=s.length===1&&s[0]===e;if(n.length===1&&r!==1/0)return K.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const k=this.pathwayAttribute_(e),b=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(k),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(k)},b);return}let T=!1;n.forEach(k=>{if(k===e)return;const b=k.excludeUntil;typeof b<"u"&&b!==1/0&&(T=!0,delete k.excludeUntil)}),T&&(K.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+r*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const l=this.selectPlaylist();if(!l){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const d=t.internal?this.logger_:K.log.warn,f=t.message?" "+t.message:"";d(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${f} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=l.targetDuration/2*1e3||5*1e3,w=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=_;return this.switchMedia_(l,"exclude",a||w)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],n=e==="all";(n||e==="main")&&r.push(this.mainPlaylistLoader_);const s=[];(n||e==="audio")&&s.push("AUDIO"),(n||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&r.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&r.push(o)}),r.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=vr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Bi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const o=n.start,l=n.end;if(!isFinite(o)||!isFinite(l))return null;const d=Bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),f=Math.max(o,l-d);return Ct([[o,f]])}const s=this.syncController_.getExpiredTime(r,this.duration());if(s===null)return null;const a=Bi.Playlist.seekable(r,s,Bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),n=e.end(0),s=t.start(0),a=t.end(0);return s>n||r>a?e:Ct([[Math.max(r,s),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Hp(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let r=Bi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const r in t)t[r].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=wn(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=r.video||e.main.videoCodec||s0),e.main.isMuxed&&(n.video+=`,${r.audio||e.main.audioCodec||hc}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||hc,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(d,f)=>d?vn(f,this.usingManagedMediaSource_):Za(f),o={};let l;if(["video","audio"].forEach(function(d){if(n.hasOwnProperty(d)&&!a(e[d].isFmp4,n[d])){const f=e[d].isFmp4?"browser":"muxer";o[f]=o[f]||[],o[f].push(n[d]),d==="audio"&&(l=f)}}),s&&l&&t.attributes.AUDIO){const d=t.attributes.AUDIO;this.main().playlists.forEach(f=>{(f.attributes&&f.attributes.AUDIO)===d&&f!==t&&(f.excludeUntil=1/0)}),this.logger_(`excluding audio group ${d} as ${l} does not support codec(s): "${n.audio}"`)}if(Object.keys(o).length){const d=Object.keys(o).reduce((f,_)=>(f&&(f+=", "),f+=`${_} does not support codec(s): "${o[_].join(",")}"`,f),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:d},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const d=[];if(["video","audio"].forEach(f=>{const _=(ci(this.sourceUpdater_.codecs[f]||"")[0]||{}).type,w=(ci(n[f]||"")[0]||{}).type;_&&w&&_.toLowerCase()!==w.toLowerCase()&&d.push(`"${this.sourceUpdater_.codecs[f]}" -> "${n[f]}"`)}),d.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${d.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const n=e[r];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const s=wn(this.main,n),a=[];s.audio&&!Za(s.audio)&&!vn(s.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${s.audio}`),s.video&&!Za(s.video)&&!vn(s.video,this.usingManagedMediaSource_)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,n=Ln(ci(e)),s=ad(n),a=n.video&&ci(n.video)[0]||null,o=n.audio&&ci(n.audio)[0]||null;Object.keys(r).forEach(l=>{const d=r[l];if(t.indexOf(d.id)!==-1||d.excludeUntil===1/0)return;t.push(d.id);const f=[],_=wn(this.mainPlaylistLoader_.main,d),w=ad(_);if(!(!_.audio&&!_.video)){if(w!==s&&f.push(`codec count "${w}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const T=_.video&&ci(_.video)[0]||null,k=_.audio&&ci(_.audio)[0]||null;T&&a&&T.type.toLowerCase()!==a.type.toLowerCase()&&f.push(`video codec "${T.type}" !== "${a.type}"`),k&&o&&k.type.toLowerCase()!==o.type.toLowerCase()&&f.push(`audio codec "${k.type}" !== "${o.type}"`)}f.length&&(d.excludeUntil=1/0,this.logger_(`excluding ${d.id}: ${f.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),Xb(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=mt.GOAL_BUFFER_LENGTH,r=mt.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,mt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=mt.BUFFER_LOW_WATER_LINE,r=mt.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,mt.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,mt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?s:n)}bufferHighWaterLine(){return mt.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){fd(this.inbandTextTracks_,"com.apple.streaming",this.tech_),kb({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();fd(this.inbandTextTracks_,e,this.tech_),Eb({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(dt({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),r=[];for(const n of e.playlists){const s=n.attributes.serviceLocation;if(s&&(r.push(s),!t.has(s)))return!0}return!!(!r.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,r=new Set;let n=!1;Object.keys(t).forEach(s=>{const a=t[s],o=this.pathwayAttribute_(a),l=o&&e!==o;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!l&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const d=!a.excludeUntil&&a.excludeUntil!==1/0;!r.has(a.id)&&l&&d&&(r.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const a=this.mediaTypes_[s];if(a.activePlaylistLoader){const o=a.activePlaylistLoader.media_;o&&o.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||r&&r.size){for(const[n,s]of t.entries())r.get(n)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(n));for(const[n,s]of r.entries()){const a=t.get(n);if(!a){e.filter(o=>o.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(o=>{this.mainPlaylistLoader_.addClonePathway(s,o)}),this.contentSteeringController_.addAvailablePathway(n);continue}this.equalPathwayClones_(a,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(n))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const s in r)if(r[s]!==n[s])return!1;for(const s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=this.mainPlaylistLoader_.getKeyIdSet(r);!n||!n.size||n.forEach(s=>{const a="usable",o=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===a,l=r.lastExcludeReason_===t&&r.excludeUntil===1/0;o?o&&l&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${s} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==t&&(r.excludeUntil=1/0,r.lastExcludeReason_=t,this.logger_(`excluding playlist ${r.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,s=r.excludeUntil===1/0&&r.lastExcludeReason_===t;n&&s&&(delete r.excludeUntil,K.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:Vb(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const _v=(i,e,t)=>r=>{const n=i.main.playlists[e],s=Bu(n),a=Ta(n);if(typeof r>"u")return a;r?delete n.disabled:n.disabled=!0;const o={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return r!==a&&!s&&(r?(t(n),i.trigger({type:"renditionenabled",metadata:o})):i.trigger({type:"renditiondisabled",metadata:o})),r};class bv{constructor(e,t,r){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=wn(n.main(),t),this.playlist=t,this.id=r,this.enabled=_v(e.playlists,t.id,s)}}const vv=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=Un(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Bu(r)).map((r,n)=>new bv(i,r,r.id)):[]}},wd=["seeking","seeked","pause","playing","error"];class Tv extends K.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Kt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach(f=>{l[f]={reset:()=>this.resetSegmentDownloads_(f),updateend:()=>this.checkSegmentDownloads_(f)},a[`${f}SegmentLoader_`].on("appendsdone",l[f].updateend),a[`${f}SegmentLoader_`].on("playlistupdate",l[f].reset),this.tech_.on(["seeked","seeking"],l[f].reset)});const d=f=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][f]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(wd,s),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(wd,s),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(f=>{a[`${f}SegmentLoader_`].off("appendsdone",l[f].updateend),a[`${f}SegmentLoader_`].off("playlistupdate",l[f].reset),this.tech_.off(["seeked","seeking"],l[f].reset)}),this.checkCurrentTimeTimeout_&&B.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&B.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=B.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],n=r.buffered_(),s=a1(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,s){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:rr(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+gi>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Ct([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime(),r=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const T=e.start(0);n=T+(T===e.end(0)?0:gi)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Hp(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const s=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),o=s.audioBuffer?s.audioBuffered():null,l=s.videoBuffer?s.videoBuffered():null,d=this.media(),f=d.partTargetDuration?d.partTargetDuration:(d.targetDuration-fi)*2,_=[o,l];for(let T=0;T<_.length;T++)if(_[T]&&Ru(_[T],t)<f)return!1;const w=Ts(a,t);return w.length===0?!1:(n=w.start(0)+gi,this.logger_(`Buffered region starts (${w.start(0)}) just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=vr(t,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=Ts(n,t);return s.length>0?(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+gi;const a=!r.endList,o=typeof r.partTargetDuration=="number";return a&&(o||n)&&(s=e.end(e.length-1)+r.targetDuration*3),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:r}){if(!e)return;let n;if(e.length&&t.length){const s=vr(e,r-3),a=vr(e,r),o=vr(t,r);o.length&&!a.length&&s.length&&(n={start:s.end(0),end:o.end(0)})}else Ts(e,r).length||(n=this.gapFromVideoUnderflow_(e,r));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),n=Ts(t,r);if(this.resetTimeUpdate_(),n.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+fi);const s={gapInfo:{from:r,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=r1(e);for(let n=0;n<r.length;n++){const s=r.start(n),a=r.end(n);if(t-s<4&&t-s>2)return{start:s,end:a}}return null}}const Sv={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},Ff=function(i,e){let t=0,r=0;const n=We(Sv,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){r&&i.currentTime(r)},a=function(f){f!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(f),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},o=function(){if(Date.now()-t<n.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){K.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(i,a)},l=function(){i.off("loadedmetadata",s),i.off("error",o),i.off("dispose",l)},d=function(f){l(),Ff(i,f)};i.on("error",o),i.on("dispose",l),i.reloadSourceOnError=d},Cv=function(i){Ff(this,i)};var Rf="3.17.2",Ev="7.1.0",wv="1.3.1",xv="7.2.0",kv="4.0.2";const at={PlaylistLoader:Tr,Playlist:Nt,utils:L1,STANDARD_PLAYLIST_SELECTOR:pd,INITIAL_PLAYLIST_SELECTOR:bb,lastBandwidthSelector:pd,movingAverageBandwidthSelector:yb,comparePlaylistBandwidth:ju,comparePlaylistResolution:mb,xhr:lf()};Object.keys(mt).forEach(i=>{Object.defineProperty(at,i,{get(){return K.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),mt[i]},set(e){if(K.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){K.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}mt[i]=e}})});const Mf="videojs-vhs",Bf=function(i,e){const t=e.media();let r=-1;for(let n=0;n<i.length;n++)if(i[n].id===t.id){r=n;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},Av=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),Bf(i,e.playlists)};at.canPlaySource=function(){return K.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Dv=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=Ln(ci(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const n=Pr(r.video),s=Pr(r.audio),a={};for(const o in i)a[o]={},s&&(a[o].audioContentType=s),n&&(a[o].videoContentType=n),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof i[o]=="string"&&(a[o].url=i[o]);return We(i,a)},Iv=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const n=e.reduce((s,a)=>{const o=r.contentProtection[a];return o&&o.pssh&&(s[a]={pssh:o.pssh}),s},{});return Object.keys(n).length&&t.push(n),t},[]),Pv=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=Iv(n,Object.keys(e)),a=[],o=[];return s.forEach(l=>{o.push(new Promise((d,f)=>{i.tech_.one("keysessioncreated",d)})),a.push(new Promise((d,f)=>{i.eme.initializeMediaKeys({keySystems:l},_=>{if(_){f(_);return}d()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},Lv=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=Dv(e,t,r);return n?(i.currentSource().keySystems=n,n&&!i.eme?(K.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Uf=()=>{if(!B.localStorage)return null;const i=B.localStorage.getItem(Mf);if(!i)return null;try{return JSON.parse(i)}catch{return null}},Ov=i=>{if(!B.localStorage)return!1;let e=Uf();e=e?We(e,i):i;try{B.localStorage.setItem(Mf,JSON.stringify(e))}catch{return!1}return e},Nv=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,qf=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},jf=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},$f=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},Hf=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};at.supportsNativeHls=(function(){if(!ce||!ce.createElement)return!1;const i=ce.createElement("video");return K.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(i.canPlayType(e))}):!1})();at.supportsNativeDash=(function(){return!ce||!ce.createElement||!K.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(ce.createElement("video").canPlayType("application/dash+xml"))})();at.supportsTypeNatively=i=>i==="hls"?at.supportsNativeHls:i==="dash"?at.supportsNativeDash:!1;at.isSupported=function(){return K.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};at.xhr.onRequest=function(i){qf(at.xhr,i)};at.xhr.onResponse=function(i){jf(at.xhr,i)};at.xhr.offRequest=function(i){$f(at.xhr,i)};at.xhr.offResponse=function(i){Hf(at.xhr,i)};const Fv=K.getComponent("Component");class Vf extends Fv{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Kt("VhsHandler"),t.options_&&t.options_.playerId){const n=K.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(ce,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const s=ce.fullscreenElement||ce.webkitFullscreenElement||ce.mozFullScreenElement||ce.msFullscreenElement;s&&s.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=We(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=Uf();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=mt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===mt.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=Nv(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=at,this.options_.sourceType=ch(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new yv(this.options_);const r=We({liveRangeSafeTimeDelta:gi},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Tv(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const s=K.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),s.error(a)});const n=this.options_.bufferBasedABR?at.movingAverageBandwidthSelector(.55):at.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=at.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=B.navigator.connection||B.navigator.mozConnection||B.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=o&&s>=o?s=Math.max(s,l):s=l}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){K.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>rr(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>rr(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&Ov({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{vv(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=B.URL.createObjectURL(this.playlistController_.mediaSource),(K.browser.IS_ANY_SAFARI||K.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Pv({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=Lv({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=K.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{Av(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Bf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Rf,"mux.js":Ev,"mpd-parser":wv,"m3u8-parser":xv,"aes-decrypter":kv}}version(){return this.constructor.version()}canChangeType(){return Pf.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&B.URL.revokeObjectURL&&(B.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return U1({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return ff({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{qf(this.xhr,e)},this.xhr.onResponse=e=>{jf(this.xhr,e)},this.xhr.offRequest=e=>{$f(this.xhr,e)},this.xhr.offResponse=e=>{Hf(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,n=>{this.player_.trigger(dt({},n))})}),t.forEach(r=>{this.playbackWatcher_.on(r,n=>{this.player_.trigger(dt({},n))})})}}const Gs={name:"videojs-http-streaming",VERSION:Rf,canHandleSource(i,e={}){const t=We(K.options,e);return!t.vhs.experimentalUseMMS&&!vn("avc1.4d400d,mp4a.40.2",!1)?!1:Gs.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=We(K.options,t);return e.vhs=new Vf(i,e,r),e.vhs.xhr=lf(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=ch(i);if(!t)return"";const r=Gs.getOverrideNative(e);return!at.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(K.browser.IS_ANY_SAFARI||K.browser.IS_IOS),{overrideNative:r=t}=e;return r}},Rv=()=>vn("avc1.4d400d,mp4a.40.2",!0);Rv()&&K.getTech("Html5").registerSourceHandler(Gs,0);K.VhsHandler=Vf;K.VhsSourceHandler=Gs;K.Vhs=at;K.use||K.registerComponent("Vhs",at);K.options.vhs=K.options.vhs||{};(!K.getPlugin||!K.getPlugin("reloadSourceOnError"))&&K.registerPlugin("reloadSourceOnError",Cv);const xd=i=>{if(typeof i=="number")return i;const e=i.toString().trim(),t=e.split(":").map(r=>parseInt(r,10));if(t.length===3)return t[0]*3600+t[1]*60+t[2];if(t.length===2)return t[0]*60+t[1];{const r=parseFloat(e);return isNaN(r)?0:r}},Mv=()=>{const i=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#84cc16","#f97316","#ec4899","#6366f1","#14b8a6","#f43f5e","#a855f7","#0ea5e9","#22c55e"];return i[Math.floor(Math.random()*i.length)]},vo=i=>i.map(e=>({...e,start:xd(e.start),end:xd(e.end),color:e.color||Mv()})),Bv=(i,e)=>e.find(t=>i>=t.start&&i<=t.end)||null,Uv=i=>{const e=nt(null),t=nt(null),r=vo(i.segments||[]),[n,s]=Ne({isReady:!1,isPlaying:!1,isPaused:!0,currentTime:0,duration:0,volume:1,muted:!1,playbackRate:1,currentSegment:null,segments:r});Ye(()=>{if(!e.current)return;console.log("\u521D\u59CB\u5316\u64AD\u653E\u5668\uFF0C\u89C6\u9891\u6E90:",i.src);let C=0;const A=5,z=()=>{if(!e.current||!e.current.parentNode)if(C<A){C++,console.log(`\u89C6\u9891\u5143\u7D20\u4E0D\u5728 DOM \u4E2D\uFF0C\u7B2C ${C} \u6B21\u91CD\u8BD5...`),setTimeout(z,200*C);return}else{console.error("\u89C6\u9891\u5143\u7D20\u521D\u59CB\u5316\u5931\u8D25\uFF0C\u5DF2\u8FBE\u5230\u6700\u5927\u91CD\u8BD5\u6B21\u6570");return}try{const U=e.current;t.current&&(t.current.dispose(),t.current=null);const I=K(U,{controls:!1,fluid:i.fluid??!0,responsive:i.responsive??!0,preload:i.preload??"metadata",playbackRates:i.playbackRates??[.5,1,1.25,1.5,2],poster:i.poster,autoplay:i.autoplay??!1,muted:i.muted??!1,loop:i.loop??!1});I.src(i.src),t.current=I,I.on("error",L=>{console.error("\u89C6\u9891\u64AD\u653E\u9519\u8BEF:",L),console.error("\u9519\u8BEF\u8BE6\u60C5:",I.error())}),I.on("loadstart",()=>{console.log("\u5F00\u59CB\u52A0\u8F7D\u89C6\u9891")}),I.on("canplay",()=>{console.log("\u89C6\u9891\u53EF\u4EE5\u64AD\u653E")}),I.on("loadedmetadata",()=>{console.log("\u89C6\u9891\u5143\u6570\u636E\u52A0\u8F7D\u5B8C\u6210\uFF0C\u65F6\u957F:",I.duration()),s(L=>({...L,duration:I.duration()||0,volume:I.volume()||1,muted:I.muted()||!1,playbackRate:I.playbackRate()||1}))}),I.on("loadeddata",()=>{console.log("\u89C6\u9891\u6570\u636E\u52A0\u8F7D\u5B8C\u6210")}),I.ready(()=>{var L;s(v=>({...v,isReady:!0})),(L=i.onReady)==null||L.call(i,I)}),I.on("play",()=>{var L;s(v=>({...v,isPlaying:!0,isPaused:!1})),(L=i.onPlay)==null||L.call(i)}),I.on("pause",()=>{var L;s(v=>({...v,isPlaying:!1,isPaused:!0})),(L=i.onPause)==null||L.call(i)}),I.on("ended",()=>{var L;s(v=>({...v,isPlaying:!1,isPaused:!0})),(L=i.onEnded)==null||L.call(i)}),I.on("timeupdate",()=>{var y,M,F;const L=I.currentTime()||0;s(H=>({...H,currentTime:L})),(y=i.onTimeUpdate)==null||y.call(i,L);const v=Bv(L,n.segments);v&&v.id!==((M=n.currentSegment)==null?void 0:M.id)&&(s(H=>({...H,currentSegment:v})),(F=i.onSegmentChange)==null||F.call(i,v))}),I.on("volumechange",()=>{s(L=>({...L,volume:I.volume()||1,muted:I.muted()||!1}))}),I.on("ratechange",()=>{s(L=>({...L,playbackRate:I.playbackRate()||1}))})}catch(U){console.error("\u521D\u59CB\u5316 video.js \u5931\u8D25:",U)}},V=requestAnimationFrame(()=>{z()});return()=>{cancelAnimationFrame(V),t.current&&(t.current.dispose(),t.current=null)}},[i.src,i.poster,i.autoplay,i.muted,i.loop,i.fluid,i.responsive,i.preload,i.playbackRates]);const a=Dt(()=>{console.log("\u64AD\u653E\u6309\u94AE\u88AB\u70B9\u51FB"),t.current&&t.current.play()},[]),o=Dt(()=>{console.log("\u6682\u505C\u6309\u94AE\u88AB\u70B9\u51FB"),t.current&&t.current.pause()},[]),l=Dt(C=>{t.current&&t.current.currentTime(C)},[]),d=Dt(C=>{t.current&&t.current.volume(C)},[]),f=Dt(C=>{t.current&&t.current.muted(C)},[]),_=Dt(C=>{t.current&&t.current.playbackRate(C)},[]),w=Dt(()=>{console.log("\u5207\u6362\u64AD\u653E\u72B6\u6001\uFF0C\u5F53\u524D\u72B6\u6001:",n.isPlaying),t.current&&(n.isPlaying?t.current.pause():t.current.play())},[n.isPlaying]),T=Dt((C,A)=>{if(t.current&&(t.current.currentTime(C.start),t.current.play(),A==null?void 0:A.autostop)){const z=C.end-C.start,V=setTimeout(()=>{t.current&&(t.current.pause(),console.log(`\u6BB5\u843D "${C.label}" \u64AD\u653E\u5B8C\u6210\uFF0C\u81EA\u52A8\u6682\u505C`))},z*1e3);t.current._segmentTimeout&&clearTimeout(t.current._segmentTimeout),t.current._segmentTimeout=V}},[]),k=Dt(C=>{const A=vo([C])[0];s(z=>({...z,segments:[...z.segments,A]}))},[]),b=Dt(C=>{s(A=>{var z;return{...A,segments:A.segments.filter(V=>V.id!==C),currentSegment:((z=A.currentSegment)==null?void 0:z.id)===C?null:A.currentSegment}})},[]),x=Dt((C,A)=>{s(z=>({...z,segments:z.segments.map(V=>{if(V.id===C){const U={...V,...A};return vo([U])[0]}return V})}))},[]),O={play:a,pause:o,seekTo:l,setVolume:d,setMuted:f,setPlaybackRate:_,playSegment:T,addSegment:k,removeSegment:b,updateSegment:x,togglePlay:w};return{videoRef:e,player:t.current,state:n,actions:O}};/**
238
+ * @license lucide-react v0.456.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const qv=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zf=(...i)=>i.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
243
+ * @license lucide-react v0.456.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */var jv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
248
+ * @license lucide-react v0.456.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const $v=Js(({color:i="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:n="",children:s,iconNode:a,...o},l)=>Co("svg",{ref:l,...jv,width:e,height:e,stroke:i,strokeWidth:r?Number(t)*24/Number(e):t,className:zf("lucide",n),...o},[...a.map(([d,f])=>Co(d,f)),...Array.isArray(s)?s:[s]]));/**
253
+ * @license lucide-react v0.456.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const qn=(i,e)=>{const t=Js(({className:r,...n},s)=>Co($v,{ref:s,iconNode:e,className:zf(`lucide-${qv(i)}`,r),...n}));return t.displayName=`${i}`,t};/**
258
+ * @license lucide-react v0.456.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const Hv=qn("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
263
+ * @license lucide-react v0.456.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const Vv=qn("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
268
+ * @license lucide-react v0.456.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const zv=qn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
273
+ * @license lucide-react v0.456.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const Wv=qn("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
278
+ * @license lucide-react v0.456.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const Gv=qn("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),Xv=[.5,.75,1,1.25,1.5,2],Kv=({isPlaying:i,currentTime:e,duration:t,volume:r,muted:n,playbackRate:s,onTogglePlay:a,onSeek:o,onVolumeChange:l,onMuteToggle:d,onPlaybackRateChange:f,segments:_=[],currentSegment:w=null,onSegmentClick:T,showTimeline:k=!0,showTimelineSegments:b=!0,showPlaybackRate:x=!1})=>{const[O,C]=Qs.useState(!1),[A,z]=Ne(null),V=F=>{const H=Math.floor(F/60),X=Math.floor(F%60);return`${H}:${X.toString().padStart(2,"0")}`},U=F=>{const H=F.currentTarget.getBoundingClientRect(),X=(F.clientX-H.left)/H.width*t;o(X)},I=F=>{const H=parseFloat(F.target.value);l(H)},L=F=>{const H=F.currentTarget.getBoundingClientRect(),X=(F.clientX-H.left)/H.width*t;o(X)},v=F=>{T&&T(F)},y=k&&_.length>0,M=(F,H=80)=>{if(F.length<=H)return F;let X=F.substring(0,H);const G=X[X.length-1];return/[,。!?;:""''()【】]/.test(G)&&(X=X.substring(0,X.length-1)),X+"..."};return De.jsxs("div",{className:"video-controls",children:[De.jsx("div",{className:"video-controls__progress",onClick:U,children:De.jsx("div",{className:"video-controls__progress-bar",style:{width:`${e/t*100}%`}})}),y&&De.jsxs("div",{className:"video-timeline",children:[De.jsxs("div",{className:"video-timeline__track",onClick:L,children:[De.jsx("div",{className:"video-timeline__progress",style:{width:`${e/t*100}%`}}),b&&_.map(F=>De.jsx("div",{className:`video-timeline__segment ${(w==null?void 0:w.id)===F.id?"active":""}`,style:{left:`${F.start/t*100}%`,width:`${(F.end-F.start)/t*100}%`,background:F.color||"#3b82f6"},onClick:H=>{H.stopPropagation(),v(F)},onMouseEnter:()=>F.label&&z(F),onMouseLeave:()=>F.label&&z(null)},F.id))]}),A&&A.label&&(()=>{const F=A.start/t*100;let H={position:"absolute",bottom:"100%",left:`${Math.max(5,Math.min(95,F))}%`,transform:"translateX(-50%)",zIndex:1e3,pointerEvents:"none",marginBottom:"8px",maxWidth:"180px",minWidth:"60px"};return De.jsx("div",{className:"video-timeline__tooltip",style:H,title:A.label,children:M(A.label,80)})})()]}),De.jsxs("div",{className:"video-controls__buttons",children:[De.jsxs("div",{className:"video-controls__left",children:[De.jsx("button",{className:"video-controls__button video-controls__play-button",onClick:a,"aria-label":i?"\u6682\u505C":"\u64AD\u653E",children:i?De.jsx(Hv,{size:20}):De.jsx(Vv,{size:20})}),De.jsxs("div",{className:"video-controls__time",children:[De.jsx("span",{children:V(e)}),De.jsx("span",{children:"/"}),De.jsx("span",{children:V(t)})]})]}),De.jsxs("div",{className:"video-controls__right",children:[De.jsxs("div",{className:"video-controls__volume",children:[De.jsx("button",{className:"video-controls__button",onClick:()=>d(!n),"aria-label":n?"\u53D6\u6D88\u9759\u97F3":"\u9759\u97F3",children:n?De.jsx(Gv,{size:20}):De.jsx(Wv,{size:20})}),De.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:n?0:r,onChange:I,className:"video-controls__volume-slider"})]}),x&&De.jsxs("div",{className:"video-controls__settings",children:[De.jsx("button",{className:"video-controls__button",onClick:()=>C(!O),"aria-label":"\u8BBE\u7F6E",children:De.jsx(zv,{size:20})}),O&&De.jsx("div",{className:"video-controls__settings-menu",children:De.jsxs("div",{className:"video-controls__settings-item",children:[De.jsx("label",{children:"\u64AD\u653E\u901F\u5EA6"}),De.jsx("select",{value:s,onChange:F=>f(parseFloat(F.target.value)),children:Xv.map(F=>De.jsxs("option",{value:F,children:[F,"x"]},F))})]})})]})]})]})]})},Yv=({segments:i,currentSegment:e,onSegmentClick:t,onSegmentAdd:r,onSegmentRemove:n,onSegmentUpdate:s})=>De.jsx("div",{className:"video-segments",children:i.map(a=>De.jsx("div",{className:`video-segments__item ${(e==null?void 0:e.id)===a.id?"active":""}`,onClick:()=>t(a),style:{background:a.color||"#3b82f6",color:"white",padding:"4px 8px",margin:"2px",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:a.label},a.id))}),Wf=Js(({className:i="",showControls:e=!0,showTimeline:t=!0,showTimelineSegments:r=!0,showSegments:n=!0,showPlaybackRate:s=!1,theme:a="default",showDebugInfo:o=!1,showPlayerState:l=!1,aspectRatio:d="16:9",...f},_)=>{const{videoRef:w,player:T,state:k,actions:b}=Uv(f);return Bd(_,()=>({player:T,state:k,actions:b,segments:{add:x=>{b.addSegment(x)},remove:x=>{b.removeSegment(x)},update:(x,O)=>{b.updateSegment(x,O)},clear:()=>{k.segments.forEach(x=>{b.removeSegment(x.id)})},play:(x,O)=>{b.playSegment(x,O)},getCurrent:()=>k.currentSegment,getAll:()=>k.segments}}),[T,k,b]),De.jsx("div",{className:`video-player video-player--${a} ${i}`,style:{width:"100%",height:"100%",aspectRatio:d,position:"relative",overflow:"hidden"},children:De.jsxs("div",{className:"video-player__container",children:[De.jsx("video",{ref:w,className:"video-js vjs-default-skin",controls:!1,preload:"metadata","data-setup":"{}",src:f.src,poster:f.poster,style:{width:"100%",height:"100%"}}),!k.isPlaying&&De.jsx("div",{className:"video-player__play-button",onClick:()=>b.play(),style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"80px",height:"80px",background:"rgba(0, 0, 0, 0.7)",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,transition:"all 0.3s ease"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(0, 0, 0, 0.9)",x.currentTarget.style.transform="translate(-50%, -50%) scale(1.1)"},onMouseLeave:x=>{x.currentTarget.style.background="rgba(0, 0, 0, 0.7)",x.currentTarget.style.transform="translate(-50%, -50%) scale(1)"},children:De.jsx("div",{style:{width:0,height:0,borderLeft:"20px solid white",borderTop:"12px solid transparent",borderBottom:"12px solid transparent",marginLeft:"4px"}})}),e&&De.jsx(Kv,{isPlaying:k.isPlaying,currentTime:k.currentTime,duration:k.duration,volume:k.volume,muted:k.muted,playbackRate:k.playbackRate,onTogglePlay:b.togglePlay,onSeek:b.seekTo,onVolumeChange:b.setVolume,onMuteToggle:b.setMuted,onPlaybackRateChange:b.setPlaybackRate,segments:k.segments,currentSegment:k.currentSegment,onSegmentClick:b.playSegment,showTimeline:t,showTimelineSegments:r,showPlaybackRate:s}),n&&k.segments.length>0&&De.jsx(Yv,{segments:k.segments,currentSegment:k.currentSegment,onSegmentClick:x=>b.playSegment(x),onSegmentAdd:b.addSegment,onSegmentRemove:b.removeSegment,onSegmentUpdate:b.updateSegment}),l&&T&&De.jsxs("div",{style:{position:"absolute",top:"16px",left:"16px",background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"8px 12px",borderRadius:"6px",fontSize:"12px",fontFamily:"monospace",zIndex:20},children:[De.jsxs("div",{children:["\u65F6\u957F: ",Math.round(T.duration()||0),"s"]}),De.jsxs("div",{children:["\u5F53\u524D: ",Math.round(T.currentTime()||0),"s"]}),De.jsxs("div",{children:["\u97F3\u91CF: ",Math.round((T.volume()||0)*100),"%"]}),De.jsxs("div",{children:["\u901F\u5EA6: ",T.playbackRate()||1,"x"]})]}),o&&De.jsxs("div",{style:{position:"absolute",top:"16px",right:"16px",background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"8px 12px",borderRadius:"6px",fontSize:"11px",fontFamily:"monospace",zIndex:20},children:[De.jsxs("div",{children:["\u89C6\u9891\u8DEF\u5F84: ",f.src]}),De.jsxs("div",{children:["\u64AD\u653E\u5668\u72B6\u6001: ",T?"\u5DF2\u52A0\u8F7D":"\u52A0\u8F7D\u4E2D..."]}),De.jsxs("div",{children:["\u6BB5\u843D\u6570\u91CF: ",k.segments.length]}),T&&De.jsxs(De.Fragment,{children:[De.jsxs("div",{children:["\u89C6\u9891\u5C3A\u5BF8: ",T.videoWidth(),"x",T.videoHeight()]}),De.jsxs("div",{children:["\u7F51\u7EDC\u72B6\u6001: ",T.networkState()]}),De.jsxs("div",{children:["\u5C31\u7EEA\u72B6\u6001: ",T.readyState()]})]})]})]})})});Wf.displayName="VideoPlayer";const kd=i=>{const[e,t,r]=i.split(":");return parseInt(e)*3600+parseInt(t)*60+parseInt(r)},Qv=({curFileInfo:i,onClose:e})=>{const t=pt(()=>({id:bi(4),start:kd(i.begin_date),end:kd(i.end_date),color:"#ef2345"}),[i]),r=nt(null);Ye(()=>{i.displayType=="retrive"&&t&&setTimeout(()=>{var s;(s=r.current)==null||s.segments.play(t,{autostop:!0})},1e3)},[t]);const n={aspectRatio:"1:1",theme:"default",showControls:!0,showTimeline:!1,showTimelineSegments:!0,showDebugInfo:!1,showPlayerState:!1};return Pe("div",{children:[Pe("div",{className:"h-[52px] flex justify-between leading-[52px] font-bold text-[16px] px-[15px] overflow-hidden border-t-none border-l-none border-b-[1px] border-solid border-[rgb(222,226,230)]",children:[(i==null?void 0:i.source_name)||"-",J("div",{onClick:e,children:J("img",{src:Zs,className:"cursor-pointer",onClick:()=>e()})})]}),J("div",{className:"h-[calc(100vh-60px)] p-[20px] flex items-center justify-center",children:J("div",{style:{background:"white",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",overflow:"hidden",position:"relative",width:"100%",height:"400px",margin:"auto"},children:J(Wf,{ref:r,src:i.link,segments:[t],showControls:n.showControls,showTimeline:n.showTimeline,showTimelineSegments:n.showTimelineSegments,showSegments:!1,theme:n.theme,showDebugInfo:n.showDebugInfo,showPlayerState:n.showPlayerState,aspectRatio:n.aspectRatio})})})]})},Ad=({i,item:e,j:t,clickTag:r})=>{const n=(t==null?void 0:t.name)!=null&&t.name!==""?String(t.name):(t==null?void 0:t.label)!=null&&t.label!==""?String(t.label):(t==null?void 0:t.content)!=null&&t.content!==""?String(t.content):(t==null?void 0:t.index)!=null?String(t.index):"";return J("div",{style:{minWidth:"16px",maxWidth:"80px",height:"16px",padding:"0 4px",backgroundColor:Zv[e.key],margin:"0 4px",color:eT[e.key],display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"2px",fontSize:"12px",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>r&&r(i,t,e),title:n,children:n},t.id)},Jv=({title:i,setOpen:e})=>Pe("div",{style:{width:"100%",height:"60px",borderBottom:"1px solid #EBEBEB",padding:"20px",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"16px",fontWeight:600},children:[J("div",{children:i}),J("img",{src:Zs,style:{width:"16px",height:"16px",cursor:"pointer"},onClick:()=>e(!1)})]}),Zv={knowledgeList:"#EAF4FD",searchList:"#E8F7F0",databaseList:"#FFF4E5",graphList:"#E7F8FB"},eT={knowledgeList:"#2072F0",searchList:"#39B83F",databaseList:"#F48C14",graphList:"#10BBD9"},Dd=[{key:"knowledgeList",name:"\u77E5\u8BC6\u5E93\u6587\u6863"},{key:"searchList",name:"\u8054\u7F51\u641C\u7D22",hideBtns:!0},{key:"databaseList",name:"\u6570\u636E\u5E93",hideBtns:!0},{key:"graphList",name:"\u77E5\u8BC6\u56FE\u8C31",hideBtns:!0}],tT=({type:i,data:e,token:t,eventsEmit:r,is_download:n,onClose:s})=>{const[a,o]=Ne(Dd),[l,d]=Ne("mark"),[f,_]=Ne(!1),[w,T]=Ne({}),[k,b]=Ne("knowledgeList"),[x,O]=Ne({knowledgeList:[],searchList:[],databaseList:[],graphList:[]}),C=pt(()=>{const L=4-a.length,v=Array(L).fill(null).map((M,F)=>({name:"",key:100+F})),y=[...a,...v];return console.log("rrrrrr",y),y},[a]),A=L=>isNaN(L)?"":(+L).toFixed(2),z=L=>{const v=(L||"").toLowerCase();return["pdf"].includes(v)?"rag/pdf":["doc","docx"].includes(v)?"rag/word":["csv"].includes(v)?"rag/csv":["xls","xlsx"].includes(v)?"rag/excel":["ppt","pptx","pub"].includes(v)?"rag/ppt":["png","jpg","jpeg","jpge"].includes(v)?"rag/pic":(["txt"].includes(v),"rag/txt")},V=L=>{switch(L){case"searchList":return gy;case"databaseList":return fy;case"graphList":return py;default:return""}},U=(L,v)=>L==="graphList"?v.map(y=>({...y,name:y.graphName})).sort((y,M)=>(M.score||0)-(y.score||0)):L==="knowledgeList"?v.map(y=>{const M=y.type==="faq"?y.file_name:eh(y.source)||y.file_name;return{...y,file_type:ky(y.source)||y.file_type,name:M,score:y.rrf_score}}).sort((y,M)=>(M.score||0)-(y.score||0)):L==="searchList"?v.map(y=>({...y,name:y.file_name})).sort((y,M)=>(M.score||0)-(y.score||0)):L==="databaseList"?v.map(y=>{const M=y.tableName?`${y.databaseName||"\u6570\u636E\u5E93"} - ${y.tableName}`:y.databaseName||y.name||"\u6570\u636E\u5E93";return{...y,name:M,file_name:M,file_type:"database"}}).sort((y,M)=>(M.score||0)-(y.score||0)):v,I=(L,v,y)=>{var M;switch(y.key){case"knowledgeList":const{pdfPages:F,parsedFilePath:H,order_num:X,tags:G}=L||{},te=v.id||X||"Unknown ID",N=(G||[]).find(he=>he.id===te);if(L.type==="faq"){T(L),d("faq"),_(!0),r==null||r("retrive_tag:click",{tagInfo:{id:v.id,index:v.index,image_urls:v.image_urls||[]},fromtype:"10",leaf:{id:v.id,fromtype:"10"},referenceDoc:L});return}if(L.type==="video")return console.log("sdgasdgag",{file:{...L,...N}}),r==null?void 0:r("retrive_tag:click",{file:{...L,...N}});if(console.log("click knowledge tag",L,v),!L||!N)return;const{metadata:j}=N,Y=j.source.split("/"),Q=Y[Y.length-1]||"",ee=Q.split("."),ue=ee.slice(0,-1).join(".")||"Unknown Label",le=ee[ee.length-1]||"Unknown Type";T({id:te,title:ue,file_name:Q,file_type:le,file_source:Jd(le)?`${kn}${j.source}`:H,metadata:j,pdfPages:F}),d("mark"),_(!0);break;case"searchList":console.log("click search tag",L,v);break;case"databaseList":console.log("click database tag",L,v),d("database"),T({...L,metadata:L.metadata||{},fetchUrl:L.fetchUrl||((M=L.metadata)==null?void 0:M.fetchUrl)||""}),_(!0);break;case"graphList":console.log("click graph tag",L,v),d("graphPreview"),T({...L,traceNode:((e==null?void 0:e.traceNode)||[]).find(he=>he.id===v.id)}),_(!0);break}};return Ye(()=>{if(i!==Gf.REFERENCELIST||(console.log("data in reference drawer",e),!e))return;const{graphRefs:L,knowledgeRefs:v,webRefs:y,databaseRefs:M}=e;L!=null&&L.length&&(x.graphList=U("graphList",L)),v!=null&&v.length&&(x.knowledgeList=U("knowledgeList",v)),y!=null&&y.length&&(x.searchList=U("searchList",y)),M!=null&&M.length&&(x.databaseList=U("databaseList",M));const F=Dd.filter(H=>{var X;return(X=x[H.key])==null?void 0:X.length}).sort((H,X)=>{var G,te;return(((G=x[X.key])==null?void 0:G.length)||0)-(((te=x[H.key])==null?void 0:te.length)||0)});o(F),F!=null&&F.length&&b(F[0].key),O({...x})},[e]),Pe(Ys,{children:[Pe("div",{className:"listWrap w-full h-full",children:[J(Jv,{title:"\u77E5\u8BC6\u6EAF\u6E90",setOpen:()=>{s&&s()}}),Pe("div",{style:{height:"calc(100% - 60px)"},children:[J("div",{className:"tabs",style:{display:"flex",justifyContent:"space-between",padding:"12px 20px"},children:C.map(L=>J("div",{className:"tab-item",style:{padding:"5.5px 12px",backgroundColor:L.name?k===L.key?"#4E6EF2":"#F5F6F9":"transparent",cursor:"pointer",borderRadius:"4px",color:k===L.key?"#FFFFFF":"#4E5969",fontSize:"14px",minWidth:"80px",display:"flex",justifyContent:"center"},onClick:()=>{L.name&&b(L.key)},children:L.name},L.key))}),J("div",{className:"listBox",style:{height:"calc(100% - 66px)",overflowY:"auto",display:"flex",flexDirection:"column",alignItems:"center",willChange:"scroll-position",transform:"translateZ(0)"},children:a.map(L=>{let v=x[L.key]||[];return k!==L.key?null:J("div",{children:v.map(y=>{var M,F,H,X,G;return Pe("div",{style:{width:"360px",padding:"4px 8px",borderRadius:"4px",margin:"6px 0",cursor:"pointer"},className:"listItemBox",onClick:()=>{L.key==="searchList"&&window.open(y.link,"_blank")},children:[Pe("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"},children:[Pe("div",{style:{flex:1,minWidth:0,fontSize:"14px",color:"#1D2129",fontWeight:"700",display:"flex",alignItems:"center"},children:[L.key==="knowledgeList"?J(dy,{type:z(y.file_type),size:22,style:{marginRight:"2px",flexShrink:0}}):J("img",{src:V(L.key),style:{width:"22px",height:"22px",marginRight:"2px",flexShrink:0}}),J(wo,{placement:"topLeft",title:((M=y==null?void 0:y.name)==null?void 0:M.length)>17?y.name:"",children:J("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:1.4,wordBreak:"break-all"},onClick:()=>{var te,N;if(L.key==="knowledgeList"){if(y.type==="faq"){T(y),d("faq"),_(!0),r==null||r("retrive_tag:click",{tagInfo:{id:y.pk,index:(te=(y.tags||[])[0])==null?void 0:te.index,image_urls:[]},fromtype:"10",leaf:{id:y.pk,fromtype:"10"},referenceDoc:y});return}r==null||r("knowledge_referenceFile_title:click",{data:{...y,file_type:y.file_type,file_name:y.file_name,metadata:y.metadata,parsedFilePath:y.parsedFilePath}})}else L.key==="databaseList"&&(d("database"),T({...y,metadata:y.metadata||{},fetchUrl:y.fetchUrl||((N=y.metadata)==null?void 0:N.fetchUrl)||""}),_(!0))},children:y.name})})]}),((F=y==null?void 0:y.tags)==null?void 0:F.length)&&y.tags.length>0&&y.tags.length<=10&&J("div",{style:{display:"flex",alignItems:"center",flexShrink:0,gap:"2px"},children:(y.tags||[]).map(te=>J(Ad,{i:y,item:L,j:te,clickTag:I},te.id))}),Pe("div",{style:{width:"52px",justifyContent:"space-between",alignItems:"center",marginRight:"8px",display:L.hideBtns||y.type==="video"||y.type==="faq"||y.faq_question||y.faq_answer?"none":"flex"},children:[J("div",{}),J("img",{src:hy,style:{width:"16px",height:"16px",cursor:n?"pointer":"not-allowed"},onClick:()=>{var N,j,Y;if(!((N=y==null?void 0:y.tags)!=null&&N.length)&&!((j=y==null?void 0:y.metadata)!=null&&j.source)||!n)return;const te=((Y=((y==null?void 0:y.tags)||[])[0])==null?void 0:Y.metadata)||(y==null?void 0:y.metadata);Ay({filePath:`${kn}${te.source}`,fileName:ru({metadata:te}),token:t})}})]})]}),(typeof y.score=="string"||typeof y.score=="number")&&!(y.type==="faq"||y.faq_question||y.faq_answer)&&J("div",{style:{display:"flex",alignItems:"center",height:"18px",marginTop:"4px"},children:Pe("div",{style:{backgroundColor:"#F2F2FB",borderRadius:"4px",padding:"2px 3px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"12px"},children:[J("span",{style:{color:"#4E5969",marginRight:"6px"},children:"\u5206\u6570:"}),J("span",{style:{color:"#1D2129"},children:A(y.score)})]})}),J("div",{style:{flex:1,display:"flex",justifyContent:"flex-start",marginTop:"4px"},children:((H=y==null?void 0:y.tags)!=null&&H.length&&y.tags.length>10?y.tags:[]).map(te=>J(Ad,{i:y,item:L,j:te,clickTag:I},te.id))}),y.type==="faq"&&(y.faq_question||y.faq_answer)&&Pe("div",{style:{marginTop:"8px",padding:"8px 10px",background:"#EAF4FD",borderRadius:"4px",fontSize:"12px",color:"#1D2129",lineHeight:1.5},children:[y.faq_question!=null&&String(y.faq_question).trim()!==""&&Pe("div",{style:{marginBottom:"4px",display:"flex"},children:[J("span",{style:{color:"#4E5969",flexShrink:0},children:"Q: "}),J("span",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:String(y.faq_question).trim()})]}),y.faq_answer!=null&&String(y.faq_answer).trim()!==""&&Pe("div",{style:{display:"flex"},children:[J("span",{style:{color:"#4E5969",flexShrink:0},children:"A: "}),J("span",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:String(y.faq_answer).replace(/\s*--+[A-Za-z0-9]*\s*$/,"").trim()||String(y.faq_answer).trim()})]})]}),!!((X=y==null?void 0:y.main_source)!=null&&X.length)&&Pe("div",{style:{flex:1,display:"flex",alignItems:"flex-start",marginTop:"4px"},children:[J("div",{style:{fontSize:"12px",color:"#4E5969",width:"60px"},children:"\u5173\u8054\u6587\u6863:"}),J(wo,{placement:"topLeft",title:((G=qa(y.main_source[0]))==null?void 0:G.length)>22?qa(y.main_source[0]):"",children:J("div",{style:{fontSize:"12px",color:"#4E5969",width:"289px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:qa(y.main_source[0])})})]})]},y.id)})},L.key)})})]})]}),J(qd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:Pe(jd,{autoFocus:!1,onClose:()=>_(!1),open:f,width:k==="graphList"?"100%":720,className:"overflow-x-hidden",destroyOnClose:!0,afterOpenChange:L=>{L||T(null)},children:[l==="graphPreview"&&J(th,{curFileInfo:w,onClose:_,token:t}),l==="mark"&&J(ih,{content:w,onClose:_,token:t}),l==="preview"&&J(rh,{curFileInfo:w,onClose:_,token:t}),l==="database"&&J(nh,{curFileInfo:w,onClose:_,token:t}),l==="faq"&&w&&Pe("div",{className:"p-4",style:{fontSize:"14px",color:"#1D2129",lineHeight:1.6},children:[w.faq_question!=null&&String(w.faq_question).trim()!==""&&Pe("div",{style:{marginBottom:"12px"},children:[J("span",{style:{color:"#4E5969",marginRight:"4px"},children:"Q:"}),J("span",{children:String(w.faq_question).trim()})]}),w.faq_answer!=null&&String(w.faq_answer).trim()!==""&&Pe("div",{children:[J("span",{style:{color:"#4E5969",marginRight:"4px"},children:"A:"}),J("span",{children:String(w.faq_answer).replace(/\s*--+[A-Za-z0-9]*\s*$/,"").trim()||String(w.faq_answer).trim()})]})]})]})})]})};var Gf=(i=>(i.REFERENCELIST="referencelist",i.ALLFILELIST="allFileList",i))(Gf||{});const iT=({item:i,scrollOld:e,token:t,normalizedStyles:r,currentChatData:n,assistantList:s,setFeed:a,CSRFToken:o,handleReSenderSend:l,appStatus:d,recommandQuestions:f})=>{const[_,w]=Ne([]),[T,k]=Ne(!1),[b,x]=Ne({}),[O,C]=Ne(!1),[A,z]=Ne(null),[V,U]=Ne("mark"),[I,L]=Ne({url:"",parse_url:"",file_type:"",file_name:""});Ud();const v=pt(()=>{const N={};return(s||[]).forEach(j=>{N[j.id]=j}),N},[s]),y=pt(()=>{if(i.configId&&v){const N=v[i.configId];return N!=null&&N.configJson?JSON.parse(N.configJson).is_download:!1}else return!1},[i.configId,v]);function M(N){N.restult==1?Vl({url:Ui(),token:t,CSRFToken:o},{queryId:N.queryId},()=>{a(N.queryId,null)}):Hl({url:Ui(),token:t,CSRFToken:o},{restult:1,queryId:N.queryId},()=>{a(N.queryId,1)})}const F=async N=>{var j;try{const Y=await Bt.get(`${Ui()}/index/knowledgeBase/file/getFileStatusByUids?uids=${N.data.uids}`,{headers:{Authorization:t}});return console.log("resslkdjgalsg",Y),(j=Y==null?void 0:Y.data)==null?void 0:j.data}catch{}},H=async N=>{var j;if(Qd.includes(N.file_type)){const Y=(j=N.metadata)!=null&&j.source?`${kn}${N.metadata.source}`:N.url||N.convertedFilePath||N.filePath;L({...N,parse_url:Y}),U("preview"),C(!0);return}try{const Y=await F({data:{uids:N.uid},config:{url:Ui(),token:t,enableMock:!1}});if(Y!=null&&Y.length){const Q=Y[0];L({...N,parse_url:Q.convertedFilePath}),U("preview"),C(!0)}}catch{}},X=(N,j)=>{var Y;switch(console.log(`[Event] ${N}`,j),N){case"reference_file:click":if(j.file_type==="image")return;if(!j.parse_url){if(!j.uid)return j.references?void 0:hi.warning("\u6587\u4EF6\u8FD8\u672A\u89E3\u6790\u5B8C\u6210,\u8BF7\u7A0D\u540E\u9884\u89C8");H(j);return}L({...j,file_type:j.type,file_name:j.file}),U("preview"),C(!0);break;case"chatbox:repeat":l(j);break;case"chatbox:dislike":(j==null?void 0:j.result)===0?Vl({url:Ui(),token:t,CSRFToken:o},{queryId:j.queryId},()=>{a(j.queryId,null)}):(x({queryId:j==null?void 0:j.queryId}),k(!0));break;case"chatbox:like":M({queryId:j==null?void 0:j.queryId,restult:j==null?void 0:j.result});break;case"chatbox:copy":{let Q=(j==null?void 0:j.content)||"";if(!Q)break;Q=Q.replace(/\[retrive-tag[^\]]*\][\s\S]*?\[\/retrive-tag\]/g,"");const ee=async le=>{try{return await navigator.clipboard.writeText(le),hi.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F"),!0}catch{return!1}},ue=le=>{const he=document.createElement("textarea");he.value=le,he.style.position="fixed",he.style.opacity="0",document.body.appendChild(he),he.focus(),he.select();try{document.execCommand("copy"),hi.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F")}catch{hi.error("\u590D\u5236\u5931\u8D25")}document.body.removeChild(he)};ee(Q).then(le=>{le||ue(Q)});break}case"action_retrive_tag":case"retrive_tag:click":{if((j==null?void 0:j.fromtype)==="10"&&(j!=null&&j.referencesPayloadSingle)){L(j.referencesPayloadSingle),U("reference"),C(!0);break}if((Y=j==null?void 0:j.graph)!=null&&Y.id){U("graphPreview"),L({...j.graph,traceNode:j.traceNode}),C(!0);return}if((j==null?void 0:j.fromtype)==="10"||!(j!=null&&j.tagInfo)&&!(j!=null&&j.file)&&!(j!=null&&j.referenceDoc))return;const Q=(j==null?void 0:j.referenceDoc)||(j==null?void 0:j.file)||(j==null?void 0:j.tagInfo),{pdfPages:ee,parsedFilePath:ue,order_num:le,metadata:he,tags:fe}=Q;if(Q.type=="video"){L({...he,displayType:"retrive"}),U("video"),C(!0);return}const Fe=Q.id||le||"Unknown ID",xe=he.source.split("/"),oe=xe[xe.length-1]||"",ge=oe.split("."),Ee=ge.slice(0,-1).join(".")||"Unknown Label",Ce=ge[ge.length-1]||"Unknown Type";z({id:Fe,title:Ee,file_name:oe,file_type:Ce,file_source:Jd(Ce)?`${kn}${he.source}`:ue,metadata:he,pdfPages:ee}),U("mark"),C(!0);break}case"references:click":L(j),U("reference"),C(!0);break}},G=N=>{Hl({url:Ui(),token:t,CSRFToken:o},{...N,...b,restult:0},()=>{a(b.queryId,0)})},te=(N,j)=>{var xe,oe,ge,Ee;const Y=j===(((xe=n==null?void 0:n.messages)==null?void 0:xe.length)||0)-1;let Q="ready";if(Y)if(N.status!==void 0)switch(N.status){case 0:Q="thinking";break;case 1:Q="processing";break;case 2:Q="ready";break;case 3:Q="error";break;case 4:Q="thinking";break;default:Q=d.display}else Q=d.display;let ee=[];if(Array.isArray(f))ee=f;else if(typeof f=="string")try{ee=JSON.parse(f)||[]}catch{ee=[]}const ue=(()=>{const Ce=N==null?void 0:N.reference;if(!Ce)return"[]";if(typeof Ce=="string")try{return JSON.parse(Ce),Ce}catch{return"[]"}try{return JSON.stringify(Ce)}catch{return"[]"}})(),le=(()=>{const Ce=N==null?void 0:N.webReference;if(!Ce)return"[]";if(typeof Ce=="string")try{return JSON.parse(Ce),Ce}catch{return"[]"}try{return JSON.stringify(Ce)}catch{return"[]"}})(),he=(()=>{const Ce=N==null?void 0:N.graphReference;if(!Ce)return"[]";if(typeof Ce=="string")try{return JSON.parse(Ce),Ce}catch{return"[]"}try{return JSON.stringify(Ce)}catch{return"[]"}})(),fe=N==null?void 0:N.databaseReference,Fe=(()=>{var Me,Ge,ye;if(N!=null&&N.chainRespTime||(Me=N==null?void 0:N.reply)!=null&&Me.chainRespTime)return(N==null?void 0:N.chainRespTime)??((Ge=N==null?void 0:N.reply)==null?void 0:Ge.chainRespTime);const Ce=(N==null?void 0:N.chain)||((ye=N==null?void 0:N.reply)==null?void 0:ye.chain);if(Array.isArray(Ce)&&Ce.length>0){const be=Ce.reduce((Te,_e)=>{const se=(_e==null?void 0:_e.chainRespTime)??(_e==null?void 0:_e.respTime);return se!=null&&se>0?Te+se:Te},0);return be>0?be:void 0}})();return J(ty,{...N,enablePrism:!1,token:t,streamUrl:"/proxy/index/knowledgeBase/file/stream",referenceMode:"button",reference:ue,webReference:le,graphReference:he,faqReference:(N==null?void 0:N.faqReference)??((oe=N==null?void 0:N.reply)==null?void 0:oe.faqReference),databaseReference:fe,contentType:N.istype==="ai"?"stream":"plainText",displayStatus:Q,eventsEmit:X,isLast:Y&&(N==null?void 0:N.istype)==="ai",followUpQuestions:Y&&(N==null?void 0:N.istype)==="ai"?ee:[],defaultAnswer:((ge=n==null?void 0:n.searchConfigDTO)==null?void 0:ge.defaultAnswer)||"\u4E0D\u77E5\u9053\u4EC0\u4E48\u539F\u56E0\u6211\u4EEC\u6CA1\u80FD\u67E5\u5230\u4F60\u8981\u7684\u95EE\u9898*-*",isUser:(N==null?void 0:N.istype)==="user",is_download:y,styles:r,enableThoughtChain:!0,chain:N==null?void 0:N.chain,thoughtChainNodes:N==null?void 0:N.thoughtChainNodes,thoughtChainStatus:N==null?void 0:N.status,enableCot:(N==null?void 0:N.enableCot)??((Ee=N==null?void 0:N.reply)==null?void 0:Ee.enableCot),chainRespTime:Fe},`${(N==null?void 0:N.queryId)||(N==null?void 0:N.id)||j}-${(N==null?void 0:N.istype)||"unknown"}`)};return Ye(()=>{my({url:Ui(),token:t},N=>{w(N)})},[]),Pe(Ys,{children:[J("div",{style:{direction:e?"ltr":"rtl",transform:e?"":"rotate(180deg)",borderRadius:8},className:" max-w-[1000px] min-w-[430px] mx-auto",children:n.messages.map((N,j)=>Pe("div",{style:{flex:1},children:[N.istype==="user"&&J("div",{style:{direction:"ltr"},children:te(N,j)}),N.istype==="ai"&&J("div",{style:{direction:"ltr"},children:te(N,j)})]},N.istype==="user"?N.queryId:"relatedTo-"+N.queryId))}),J(yy,{open:T,feedBackList:_,setOpen:k,handleConfirm:G}),J(qd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:Pe(jd,{autoFocus:!1,onClose:()=>C(!1),open:O,width:V==="graphPreview"?"100%":V==="reference"?400:720,className:"overflow-x-hidden",destroyOnClose:!0,afterOpenChange:N=>{N||z(null)},children:[V==="graphPreview"&&J(th,{curFileInfo:I,onClose:()=>C(!1),token:t}),V==="mark"&&J(ih,{content:A,onClose:()=>C(!1),token:t}),V==="preview"&&J(rh,{curFileInfo:I,onClose:()=>C(!1),token:t}),V==="database"&&J(nh,{curFileInfo:I,onClose:()=>C(!1),token:t}),V=="video"&&J(Qv,{type:"referencelist",data:I,token:t,eventsEmit:X,is_download:y}),V==="reference"&&J(tT,{type:"referencelist",data:I,token:t,eventsEmit:X,is_download:y,onClose:()=>C(!1)})]})})]})},rT="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.8179%2012.9392L10.6284%209.75381C11.4674%208.72414%2011.9702%207.4114%2011.9702%205.98045C11.9702%202.67681%209.29131%200%205.9851%200C2.6789%200%200%202.67681%200%205.98045C0%209.28408%202.6789%2011.9609%205.9851%2011.9609C7.41094%2011.9609%208.72004%2011.4632%209.74739%2010.631L12.9368%2013.818C13.0583%2013.9393%2013.217%2014%2013.3774%2014C13.5361%2014%2013.6965%2013.9393%2013.8179%2013.818C14.0607%2013.5754%2014.0607%2013.1819%2013.8179%2012.9392ZM7.87792%2010.4599C7.27863%2010.7135%206.64198%2010.841%205.9851%2010.841C5.32822%2010.841%204.69157%2010.7119%204.09228%2010.4599C3.51323%2010.2158%202.99333%209.86424%202.54503%209.41784C2.09829%208.97145%201.7465%208.45039%201.50211%207.87179C1.24839%207.27297%201.12075%206.63682%201.12075%205.98045C1.12075%205.32408%201.24994%204.68792%201.50211%204.0891C1.7465%203.5105%202.09829%202.991%202.54503%202.54305C2.99177%202.09666%203.51323%201.74514%204.09228%201.50094C4.69157%201.24742%205.32822%201.11988%205.9851%201.11988C6.64198%201.11988%207.27863%201.24897%207.87792%201.50094C8.45697%201.74514%208.97687%202.09666%209.42517%202.54305C9.87191%202.98945%2010.2237%203.50894%2010.4681%204.0891C10.7218%204.68792%2010.8495%205.32408%2010.8495%205.98045C10.8495%206.63682%2010.7203%207.27297%2010.4681%207.87179C10.2237%208.45039%209.87191%208.96989%209.42517%209.41784C8.97687%209.86424%208.45697%2010.2142%207.87792%2010.4599Z'%20fill='black'%20fill-opacity='0.25'/%3e%3c/svg%3e",Id=""+new URL("assets/iconAi.svg",import.meta.url).href,nT="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20width='16'%20height='16'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1%208C1%204.13438%204.13438%201%208%201C11.8656%201%2015%204.13438%2015%208C15%2011.8656%2011.8656%2015%208%2015C4.13438%2015%201%2011.8656%201%208ZM7.73281%2010.2766L11.0234%205.71406C11.0828%205.63125%2011.0234%205.51562%2010.9219%205.51562H10.1891C10.0281%205.51562%209.87813%205.59375%209.78438%205.72344L7.32812%209.12969L6.21562%207.58594C6.12187%207.45469%205.97031%207.37813%205.81094%207.37813H5.07812C4.97656%207.37813%204.91719%207.49375%204.97656%207.57656L6.925%2010.2766C7.12344%2010.5531%207.53437%2010.5531%207.73281%2010.2766Z'%20fill='%233AB318'/%3e%3c/svg%3e",sT=({assistList:i,value:e,onChange:t,loading:r,defaultValue:n,disabled:s=!1,className:a=""})=>{const[o,l]=Ne(!1),[d,f]=Ne(),_=k=>{if(i&&i.length>0){const b=i.filter(x=>x.label.toLowerCase().includes(k.target.value.toLowerCase()));f(b)}},w=k=>{t&&t(k||""),l(!1)},T=pt(()=>k=>{const b=i.find(x=>x.value===k);return{modelName:(b==null?void 0:b.details.model_name)||"N/A",temperature:(b==null?void 0:b.details.temperature)||"N/A",maxTokens:(b==null?void 0:b.details.max_tokens)||"N/A"}},[i]);return Pe("div",{className:`w-[233px] h-[30px] relative ${a}`,children:[J("img",{src:Id,width:20,height:20,style:{position:"absolute",margin:"4px 12px 0 12px",zIndex:10}}),J($d,{open:o,onDropdownVisibleChange:l,popupMatchSelectWidth:!1,style:{height:"30px",width:"233px"},dropdownStyle:{width:"323px",maxHeight:"425px",overflowY:"auto",backgroundColor:"#fff"},disabled:s,className:"assistantSelector",dropdownRender:()=>Pe("div",{style:{padding:"8px",marginTop:"4px"},children:[J(ay,{placeholder:"\u8BF7\u8F93\u5165",onChange:_,style:{marginBottom:"8px"},suffix:J("img",{src:rT})}),J("div",{style:{maxHeight:"calc(280px - 40px)",overflowY:"auto",overflowX:"hidden"},children:(d||i).map((k,b)=>Pe(oy,{align:"center",className:"w-[280px] h-[68px] rounded-[8px] mt-[8px] cursor-pointer",style:{backgroundColor:e===k.value?"#F1F7FF":"#fff",border:e===k.value?"1px solid #315EFB":"1px solid #fff"},onClick:()=>w(k.value),children:[J("img",{src:Id,width:24,height:24,className:"mr-[8px] ml-[8px]"}),Pe("div",{className:"w-[336px]",children:[J("div",{className:"w-full text-[#2a2a2a] text-[14px] text-ellipsis break-words line-clamp-1",children:k.label}),Pe("div",{className:"w-full text-[#888888] text-[12px] text-ellipsis break-words line-clamp-1 mt-[2px]",children:["\u5927\u6A21\u578B\uFF1A",T(k.value).modelName,":\xA0\xA0 \u6E29\u5EA6\uFF1A",T(k.value).temperature,"\xA0\xA0 \u6700\u5927\u6807\u8BB0\uFF1A",T(k.value).maxTokens]})]}),J("div",{className:"w-[40px] h-full flex justify-center items-center",children:e===k.value&&J("img",{src:nT})})]},b))})]}),value:e,onChange:w,options:(d||i).map(k=>({value:k.value,label:k.label})),placeholder:"\u6CA1\u6709\u52A9\u624B\u53EF\u9009\uFF0C\u8BF7\u5148\u521B\u5EFA\u52A9\u624B\u914D\u7F6E",defaultValue:n,loading:r})]})};function aT({scrollOld:i}){const e=()=>{t.current.addEventListener("wheel",n=>{n.preventDefault();const{deltaY:s}=n;t.current.scrollTop-=s})},t=nt(null),r=nt(null);return Ye(()=>{if(!i&&!r.current)return r.current=setInterval(()=>{var n;(n=t==null?void 0:t.current)!=null&&n.scrollTo&&(e(),clearInterval(r.current),r.current=null)},100),()=>{var n;clearInterval(r.current),r.current=null,(n=t==null?void 0:t.current)!=null&&n.removeEventListener&&t.current.removeEventListener("wheel",e)}},[]),{chatContainerRef:t}}const oT=async({token:i})=>{var e,t;try{const r=await Bt.get(`${bn()}/qa/search/config/helper/list`,{headers:{Authorization:i}});return(t=(e=r==null?void 0:r.data)==null?void 0:e.data)!=null&&t.length?r.data.data:(Xs(),!1)}catch(r){console.log("error",r),Xs(r)}},uT=async({token:i,params:e})=>{try{const t=await Bt.post(`${bn()}/qa/dialogue/create`,e,{headers:{Authorization:i}});return t!=null&&t.data?t.data:(Xs(),!1)}catch(t){console.log("error",t),Xs(t)}};function Xs(i){throw new Error("Response Error: "+i)}const lT=async(i,e,t)=>{try{const{uid:r,queryId:n}=e;let s=`${i.url}/index/knowledgeBase/file/deleteByUid?uid=${r}`;n&&(s+=`&queryId=${n}`),Bt.delete(s,{headers:{Authorization:i.token,"X-CSRF-TOKEN-IN":i.CSRFToken||""}}).then(a=>{a.data.success?t&&t(!0,a):t&&t(!1,a)}).catch(a=>{t&&t(!1,a)})}catch(r){t&&t(!1,r)}};function cT({token:i,sessionId:e,api_startChat_re:t,addEmptyMessage:r,setCurrentChatData:n,setAppStatus:s,uploadController:a,resetStopFlag:o,setFileStatuses:l,stoppedRef:d,stopPoll:f,pollFileStatusHook:_,setFileManagerData:w,senderSwitchValues:T,tempKnowledgeBaseCheck:k,setRecommandQuestions:b,configId:x,currentChatData:O}){const C=nt(!0),A=async L=>{const{content:v,assist_id:y}=L;if(C.current){C.current=!1;const M=await uT({token:i,params:{label:v,sessionId:e,configId:y,sysType:"TEMPORARY"}});return!(M!=null&&M.success)||!(M!=null&&M.data)?void 0:M.data}else return{configId:y,name:""}},z=(L,v,y,M)=>{f=_(L,{onStatusUpdate:v,onComplete:y,onFail:M})},V=async L=>{},U=(L,v,y)=>{const M=v.assist_id||x;console.log("\u52A9\u624B\u914D\u7F6E\u8BE6\u60C5",M);const F=`chat-${bi(32)}`,H=v.content||v.text||"",X=typeof H=="string"?H:String(H),G=X?X.slice(0,20):"\u672A\u547D\u540D\u4F1A\u8BDD";let te;if(v.files&&v.files.length>0&&(te=v.files.map(j=>({name:j.file.name,size:j.file.size,type:j.file.type,filePath:j.filePath||"",convertedFilePath:j.convertedFilePath||"",uid:j.uid||"",...j}))),console.log("\u672C\u5730\u6587\u4EF6\u4E0A\u4F20",v.files),r({content:X,queryId:F,currentFiles:te,filePaths:te?JSON.stringify(te):void 0}),n(j=>({...j,label:G,isNew:!1})),v.files&&v.files.length>0){s(ue=>({...ue,sender:"uploading",display:"uploading"})),a=new AbortController,o();const j=v.files.map(()=>`rc-upload-${Date.now()}-${Math.random().toString(36).slice(2)}`),Y=v.files.map((ue,le)=>({...ue,uid:j[le],status:"uploading"}));l(Y);const Q=new FormData;v.files.forEach(ue=>{Q.append("files",ue.file)});const ee=String(L||"");Q.append("sessionId",ee),Q.append("uids",j.join(",")),Bt.post(`${_y()}/index/knowledgeBase/file/uploadFiles`,Q,{headers:{Authorization:i,"Content-Type":"multipart/form-data"},signal:a.signal}).then(ue=>{var Fe,xe,oe,ge,Ee,Ce,Me,Ge,ye,be;if(console.log("\u6587\u4EF6\u4E0A\u4F20\u7684\u6253\u5370\u7ED3\u679C",ue),console.log("\u6587\u4EF6\u4E0A\u4F20\u54CD\u5E94\u8BE6\u60C5:",{status:ue.status,success:(Fe=ue.data)==null?void 0:Fe.success,dataType:Array.isArray((xe=ue.data)==null?void 0:xe.data)?"array":typeof((oe=ue.data)==null?void 0:oe.data),dataLength:Array.isArray((ge=ue.data)==null?void 0:ge.data)?ue.data.data.length:"N/A",errorMsg:(Ee=ue.data)==null?void 0:Ee.errorMsg,errorCode:(Ce=ue.data)==null?void 0:Ce.errorCode,fullResponse:ue.data}),d.current)return;const le=(Me=ue.data)==null?void 0:Me.data,he=((Ge=ue.data)==null?void 0:Ge.success)===!0,fe=Array.isArray(le)&&le.length>0;if(he&&fe){const Te=le,_e=Te.map(se=>se.uid);l(se=>se.map(Se=>{const ne=le.find(de=>de.uid===Se.uid);return ne?{...Se,...ne}:Se})),s(se=>({...se,sender:"processing",display:"analyzing"})),l(se=>se.map(Se=>({...Se,status:"parsing"}))),z(_e,se=>{if(!se||!Array.isArray(se)){console.warn("pollFileStatus \u56DE\u8C03\u8FD4\u56DE\u7684 serverStatuses \u65E0\u6548:",se);return}if(l(ne=>ne.map(de=>{const we=se.find(qe=>qe&&qe.uid===de.uid);if(we)switch(we.fileParseStatus??we.status){case 3:return{...de,status:"done"};case 4:return{...de,status:"error"};case 1:case 2:default:return{...de,status:"parsing"}}return de})),Array.isArray(se)&&se.length>0&&se.every(ne=>{if(!ne)return!1;const de=ne.fileParseStatus??ne.status;return de===3||de===4})){l([]);const ne=new Map;(se||[]).forEach(de=>{ne.set(de.id,de)}),w(de=>({uploadedFiles:by(de.uploadedFiles,Te).map(qe=>{var He;return{...qe,pdfPages:((He=ne.get(qe.id))==null?void 0:He.pdfPages)||0}})}))}},se=>{y==null||y(),s(ne=>({...ne,sender:"processing",display:"processing"})),l(ne=>ne.map(de=>{const we=Te.find(qe=>qe.uid===de.uid);return we?{...de,...we,url:we.filePath,filePath:we.filePath,name:we.fileName||de.name,convertedFilePath:we.convertedFilePath||de.convertedFilePath}:de})),console.log("uploadedFilesData",Te),n(ne=>{if(!ne)return ne;const{messages:de}=ne;for(let we=de.length-1;we>=0;we--)if(de[we].istype==="user"){const qe=de[we].currentFiles||[];de[we].currentFiles=qe.map(He=>{const bt=Te.find(je=>je.uid===He.uid);return bt?{...He,...bt}:He});break}return ne});const Se=Date.now();t({configId:M,content:X,fileUids:_e,lastDate:Se,name:G,queryId:F,sessionId:String(L||""),type:"text",audioUrl:"",enableThinking:!!T.reasoning,enableWebsearch:!!T.netSearch,qaChannel:T.qaChannel,tempKnowledgeBaseCheck:k.current},ne=>{V()})},se=>{s(Se=>({...Se,display:"ready",sender:"ready"})),l(Se=>Se.map(ne=>({...ne,status:"error",message:se})))})}else{let Te="\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25";(ye=ue.data)!=null&&ye.errorMsg?Te=ue.data.errorMsg:he?fe||(Array.isArray(le)?le.length===0&&(Te="\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u4E3A\u7A7A"):Te=`\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF0C\u671F\u671B\u6570\u7EC4\uFF0C\u5B9E\u9645\u4E3A ${typeof le}`):Te=`\u4E0A\u4F20\u5931\u8D25: success=${(be=ue.data)==null?void 0:be.success}`,console.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\u8BE6\u60C5:",{errorMsg:Te,response:ue.data,isSuccess:he,isValidData:fe}),hi.error(Te),s(_e=>({..._e,display:"error",sender:"ready"})),l(_e=>_e.map(se=>({...se,status:"error",message:Te})))}}).catch(ue=>{var le,he;((le=ue==null?void 0:ue.response)==null?void 0:le.status)===413?(he=ue==null?void 0:ue.response)!=null&&he.statusText.includes("Request Entity Too Large")&&hi.error("\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u53EF\u4E0A\u4F20\u9650\u5236"):hi.error("\u7F51\u7EDC\u9519\u8BEF"),s(fe=>({...fe,display:"error",sender:"ready"})),l(fe=>fe.map(Fe=>({...Fe,status:"error",message:"\u7F51\u7EDC\u9519\u8BEF"})))});return}s(j=>({...j,display:"processing",sender:"processing"}));const N=Date.now();y==null||y(),t({configId:M,content:X,fileUids:[],lastDate:N+"",name:G,queryId:F,sessionId:String(L||""),type:"text",audioUrl:"",enableThinking:!!T.reasoning,enableWebsearch:!!T.netSearch,qaChannel:T.qaChannel,tempKnowledgeBaseCheck:k.current},j=>{V()})};return{handleSendMessage:async L=>{if(!(L!=null&&L.assist_id)&&!x)return hi.warning(`\u5BF9\u8BDD${(L==null?void 0:L.index)+1}\u8BF7\u9009\u62E9\u52A9\u624B`);console.log("Sending message:",L);const{clearFn:v}=L;await A(L),U(e,L,v)}}}class To extends Error{}const dT=({baseUrl:i,token:e,CSRFToken:t,setCurrentChatData:r,activeSessionId:n,setAppStatus:s})=>{const a=nt(null),o=nt(null),l=nt(null),d=nt([]),f=nt(void 0),_=nt(void 0),w=nt(new Map),T=U=>{if(!U)return!1;if(typeof U=="string"){const I=U.trim();return I!==""&&I!=="[]"&&I!=="null"}return!0},k=({content:U,status:I,respTime:L,filePaths:v,reference:y,webReference:M,knowledgeBases:F,graphReference:H,databaseReference:X,llmType:G,resultType:te,queryId:N,tokens:j,chain:Y,thoughtChainNodes:Q,enableCot:ee,chainRespTime:ue})=>{r(le=>{var be;if(!le)return le;const he=le,fe=he.messages||[],Fe=fe.length-1;if(Fe<0)return le;const xe=fe[Fe];if(xe.istype!=="ai")return le;let oe=fe.slice();if(v!=null&&v.length){const Te=fe.length-2;if(Te>=0&&((be=fe[Te])==null?void 0:be.istype)==="user"){const _e={...fe[Te],filePaths:v};oe[Te]=_e}}const ge=N&&N!==xe.queryId,Ee=I===1&&xe.status===2,Ce=ge||Ee?T(H)?H:null:H!==void 0&&T(H)?H:xe.graphReference;I===2&&H!==void 0&&console.log("[AichatUseController] reset_chat status=2 \u65F6\u7684 graphReference:",{graphReference:H,isValid:T(H),lastMessageGraphReference:xe.graphReference,finalGraphReference:Ce,isNewQuery:ge,isRestart:Ee});let Me;ge?Me=U:Ee?Me="":I===4||I===2&&!U?Me=xe.content||"":Me=(xe.content||"")+U;const Ge={...xe,content:Me,status:I,respTime:L,filePaths:v,reference:ge||Ee?y||"[]":y,webReference:ge||Ee?M||"[]":M,knowledgeBases:ge||Ee?F||"[]":F,graphReference:Ce,databaseReference:ge||Ee?X!==void 0?X:null:X!==void 0?X:xe.databaseReference,resultType:te,llmType:G,tokens:j,queryId:N||xe.queryId||bi(32),chain:ge||Ee?Y!==void 0?Y:void 0:Y!==void 0?Y:xe.chain,thoughtChainNodes:ge||Ee?Q!==void 0?Q:void 0:Q!==void 0?Q:xe.thoughtChainNodes,enableCot:ee!==void 0?ee:xe.enableCot,chainRespTime:ue!==void 0?ue:xe.chainRespTime};return Ge.clientSideId=Ge.clientSideId||Ge.queryId+"-ai",oe[Fe]=Ge,{...he,isNew:!1,messages:oe}})},b=U=>{if(U instanceof To)throw s(I=>({...I,display:"error",sender:"ready"})),a.current&&(a.current.abort(),a.current=null),o.current=null,l.current=null,U};return{updateUserFilesMessage:({currentFiles:U})=>{r(I=>{if(!I)return I;const L=I,v=L.messages||[];if(!v.length)return I;const y=v.length-2;if(y<0||v[y].istype!=="user")return I;const F=v.slice();return F[y]={...v[y],currentFiles:U},{...L,messages:F}})},api_startChat_re:(U,I)=>{a.current&&a.current.abort(),a.current=new AbortController,o.current=U.sessionId,l.current=U.queryId,d.current=[],f.current=void 0,_.current=void 0,w.current=new Map;const L=`${i}/qa/ai/question_re`;console.log("data",U);const v={...U};vy(L,{method:"post",signal:a.current.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream",Authorization:e||"","X-CSRF-TOKEN-IN":t||""},openWhenHidden:!0,body:JSON.stringify(v),onopen:async y=>{if(y.status===500)throw new To("Internal Server Error");if(!y.ok)throw new To(`HTTP error: ${y.status}`)},onmessage:y=>{var Ee,Ce,Me,Ge;const M=JSON.parse(y.data);if(o.current!==M.sessionId){console.log("[AichatUseController] \u6D41\u5F0F\u8BF7\u6C42\u7684 sessionId \u5DF2\u4E0D\u5339\u914D\uFF0C\u5FFD\u7565\u6570\u636E",{currentStreamSessionId:o.current,receivedSessionId:M.sessionId,activeSessionId:n});return}if(n!==M.sessionId)return;const{reply:F,resultType:H,respTime:X,reference:G,webReference:te,graphReference:N,knowledgeBases:j,filePaths:Y,status:Q,docs:ee,llmType:ue,databaseReference:le,businessType:he,nodeStatus:fe,enableCot:Fe,chainRespTime:xe}=M;if(Q===4&&he){fe===2&&typeof xe=="number"&&xe>0&&w.current.set(he,xe);const ye=fe===2&&typeof xe=="number"&&xe>0?xe:void 0;d.current=iy(d.current,{businessType:he,nodeStatus:fe,reply:F,respTime:ye,chainRespTime:ye}),console.log("[AichatUseController] status=4 \u805A\u5408\u601D\u7EF4\u94FE\u6570\u636E:",{businessType:he,nodeStatus:fe,content:(Ee=F==null?void 0:F.content)==null?void 0:Ee.substring(0,50),currentThoughtNodesCount:d.current.length,chainRespTime:fe===2?xe:void 0})}else Q===1&&he&&console.log("[AichatUseController] status=1 \u8DF3\u8FC7\u601D\u7EF4\u94FE\u805A\u5408:",{businessType:he,content:(Ce=F==null?void 0:F.content)==null?void 0:Ce.substring(0,50),note:"status=1 \u7684\u5185\u5BB9\u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u4E0D\u662F\u601D\u7EF4\u94FE"});if(typeof Fe=="number"&&(f.current=Fe),Q===1||Q===2){const ye=Array.from(w.current.values()).reduce((be,Te)=>be+Te,0);ye>0&&(_.current=ye)}const oe=Y?JSON.parse(Y):[];Q===2&&F&&F.content&&(F.content.includes("\u6A21\u578B\u6682\u65E0\u6CD5\u8FD4\u56DE")||F.content.includes("\u5931\u8D25")||F.content.includes("\u9519\u8BEF")||F.content.includes("\u8BF7\u7A0D\u540E\u518D\u8BD5"))&&s(ye=>({...ye,display:"ready",sender:"ready"}));const ge=T(N)?N:void 0;if(Q===2&&console.log("[AichatUseController] status=2 \u65F6\u7684 graphReference:",{graphReference:N,type:typeof N,isValid:T(N),finalGraphReference:ge}),Q===4){const ye=d.current.length>0?d.current.map(be=>({businessType:be.businessType,nodeStatus:be.nodeStatus,content:be.content})):void 0;console.log("[AichatUseController] status=4 \u66F4\u65B0\u601D\u7EF4\u94FE:",{businessType:he,chainLength:(ye==null?void 0:ye.length)||0,replyContentLength:((Me=F==null?void 0:F.content)==null?void 0:Me.length)||0,note:"status=4 \u65F6\uFF0Creply.content \u5E94\u8BE5\u805A\u5408\u5230\u601D\u7EF4\u94FE\uFF0C\u4E0D\u66F4\u65B0\u6B63\u6587"}),k({content:"",status:Q,respTime:X,filePaths:oe,reference:G||ee||"",webReference:te||"",knowledgeBases:j||"",graphReference:ge,databaseReference:le,llmType:ue,resultType:H,queryId:M.queryId,tokens:M.tokens,chain:ye,thoughtChainNodes:d.current.length>0?[...d.current]:void 0,enableCot:f.current,chainRespTime:_.current})}else if(Q===1){d.current.length>0&&(d.current=d.current.map(be=>({...be,nodeStatus:2}))),console.log("[AichatUseController] status=1 \u66F4\u65B0\u6B63\u6587:",{businessType:he,content:(Ge=F==null?void 0:F.content)==null?void 0:Ge.substring(0,50),thoughtNodesCount:d.current.length,note:"status=1 \u65F6\uFF0Creply.content \u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u601D\u7EF4\u94FE\u8282\u70B9\u72B6\u6001\u66F4\u65B0\u4E3A\u5B8C\u6210"});const ye=d.current.length>0?d.current.map(be=>({businessType:be.businessType,nodeStatus:be.nodeStatus,content:be.content})):void 0;k({content:F.content||"",status:Q,respTime:X,filePaths:oe,reference:G||ee||"",webReference:te||"",graphReference:ge,knowledgeBases:j||"",databaseReference:le??null,llmType:ue,resultType:H,queryId:M.queryId,tokens:M.tokens,chain:ye??void 0,thoughtChainNodes:d.current.length>0?[...d.current]:void 0,enableCot:f.current,chainRespTime:_.current})}else if(Q===2){d.current.length>0&&(d.current=d.current.map(be=>({...be,nodeStatus:2})));const ye=d.current.length>0?d.current.map(be=>({businessType:be.businessType,nodeStatus:be.nodeStatus,content:be.content})):void 0;if(k({content:F.content||"",status:2,respTime:X,filePaths:oe,reference:G||ee||"",webReference:te||"",knowledgeBases:j||"",graphReference:ge,databaseReference:le,llmType:ue,resultType:H,queryId:M.queryId,tokens:M.tokens,chain:ye,thoughtChainNodes:d.current.length>0?[...d.current]:void 0,enableCot:f.current,chainRespTime:_.current}),d.current=[],s(be=>({...be,display:"ready",sender:"ready"})),I){const be=X||Date.now();console.log("[AichatUseController] \u6D88\u606F\u53D1\u9001\u6210\u529F\uFF0CgmtModified:",be),I(be)}}else{const ye=d.current.length>0?d.current.map(be=>({businessType:be.businessType,nodeStatus:be.nodeStatus,content:be.content,respTime:be.respTime,chainRespTime:be.respTime})):void 0;k({content:F.content||"",status:Q,respTime:X,filePaths:oe,reference:G||ee||"",knowledgeBases:j||"",webReference:te||"",graphReference:ge,databaseReference:le,llmType:ue,resultType:H,queryId:M.queryId,tokens:M.tokens,chain:ye,thoughtChainNodes:d.current.length>0?[...d.current]:void 0,enableCot:f.current,chainRespTime:_.current})}},onerror:b,onclose:()=>{s(y=>({...y,display:"ready",sender:"ready"})),o.current===U.sessionId&&(o.current=null,l.current=null)}})},addEmptyMessage:({queryId:U,content:I,filePaths:L,currentFiles:v})=>{r(y=>{const M=new Date().toISOString(),F=U||bi(32),H={istype:"user",content:I,time:M,queryId:F,clientSideId:F+"-user",filePaths:L||"",currentFiles:v||[]},X={istype:"ai",content:"",time:new Date(Date.now()+1).toISOString(),streaming:!0,status:0,queryId:F,clientSideId:F+"-ai"},G=y;return G?G.messages.push(H,X):console.warn("addEmptyMessage called without an active session."),y})},setLastEmptyMessage:({now:U})=>{r(I=>{if(!I)return I;const L=I,v=L.messages||[];if(!v.length)return I;const y=v.length-1;if(y<0)return I;const M=v[y];if(M.istype!=="ai")return I;const F=v.slice();return F[y]={...M,istype:"ai",content:"",time:U,streaming:!0,status:0},{...L,messages:F}})},stopStream:async()=>{if(l.current)try{await Bt.delete(`${i}/qa/ai/abortStream?queryId=${l.current}`,{headers:{Authorization:e||"","X-CSRF-TOKEN-IN":t||""}}),console.log("[AichatUseController] \u5DF2\u8C03\u7528\u540E\u7AEF\u63A5\u53E3\u505C\u6B62\u6D41\u5F0F\u8BF7\u6C42",l.current)}catch(U){console.error("[AichatUseController] \u8C03\u7528\u505C\u6B62\u63A5\u53E3\u5931\u8D25",U)}else console.warn("[AichatUseController] \u505C\u6B62\u6D41\u5F0F\u8BF7\u6C42\u65F6\u672A\u627E\u5230 queryId");a.current=null,o.current=null,l.current=null,s(U=>({...U,display:"ready",sender:"ready"}))},cancelStreamBySessionId:async U=>{if(a.current&&o.current===U){if(console.log("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\uFF0C\u53D6\u6D88\u6B63\u5728\u8FDB\u884C\u7684\u6D41\u5F0F\u8BF7\u6C42",U),l.current)try{await Bt.delete(`${i}/qa/ai/abortStream?queryId=${l.current}`,{headers:{Authorization:e||"","X-CSRF-TOKEN-IN":t||""}}),console.log("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\u65F6\u5DF2\u8C03\u7528\u540E\u7AEF\u63A5\u53E3\u505C\u6B62\u6D41\u5F0F\u8BF7\u6C42",l.current)}catch(I){console.error("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\u65F6\u8C03\u7528\u505C\u6B62\u63A5\u53E3\u5931\u8D25",I)}else console.warn("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\u65F6\u672A\u627E\u5230 queryId");return a.current=null,o.current=null,l.current=null,s(I=>({...I,display:"ready",sender:"ready"})),!0}return!1}}},hT=1e3,pT=3e3;function fT({url:i,token:e,CSRFToken:t,onError:r,activeSessionId:n}){const[s,a]=Ne([]),[o,l]=Ne(()=>({uploadedFiles:[]})),d=nt(!1),f=async b=>{var x,O;if(!b)return null;try{const C=await Bt.get(`${i}/index/knowledgeBase/file/getFilesBysessionId?sessionId=${b}`,{headers:{Authorization:e}});console.log("[DEBUG] \u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868 res:",(x=C==null?void 0:C.data)==null?void 0:x.data),l({uploadedFiles:((O=C==null?void 0:C.data)==null?void 0:O.data)||[]})}catch(C){throw console.error("\u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868\u5931\u8D25:",C),C}},_=Dt((b,x)=>{const O=b.join(",");let C=0,A=null;A=()=>{d.current=!0};const z=async()=>{if(!d.current){if(C>=hT){d.current||x.onFail("\u6587\u4EF6\u89E3\u6790\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");return}C++;try{const V=await Bt.get(`${i}/index/knowledgeBase/file/getFileStatusByUids?uids=${O}`,{headers:{Authorization:e}});if(d.current)return;if(V.data.success){const U=V.data.data;d.current||x.onStatusUpdate(U),U.every(L=>{const v=L.fileParseStatus??L.status;return v===3||v===4})?d.current||x.onComplete(U):d.current||setTimeout(z,pT)}else d.current||x.onFail(V.data.errorMsg||"\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u5931\u8D25")}catch(V){if(r==null||r(V),d.current)return;x.onFail("\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u65F6\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF")}}};return z(),A},[i,e,r]),w=Dt(async(b,x)=>{if(!b){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6");return}lT({url:i,token:e,CSRFToken:t},{uid:b,queryId:x},(O,C)=>{O?(hi.success("\u6587\u4EF6\u5DF2\u4ECE\u4E34\u65F6\u77E5\u8BC6\u5E93\u79FB\u9664"),f(n)):(console.log("[DEBUG] removeFilefromTempUpload \u56DE\u8C03 false\uFF0Cres:",C),hi.error("\u6587\u4EF6\u79FB\u9664\u5931\u8D25"))})},[i,e,t,n]),T=Dt(()=>{d.current=!1},[]),k=Dt(()=>{d.current=!0},[]);return{fileManagerData:o,fileStatuses:s,setFileManagerData:l,setFileStatuses:a,pollFileStatus:_,handleRemoveFromTemp:w,resetStopFlag:T,setStopFlag:k,stoppedRef:d,getTempFileList:f}}const gT=Js((i,e)=>{const{item:t,inputValue:r,status:n,senderSwitchValues:s,clearInput:a,configLoading:o,assistantList:l,emitEvent:d,token:f,CSRFToken:_="",showRemoveIcon:w,onRemove:T,index:k,senderConfig:b,normalizedStyles:x,setChatItems:O}=i,[C,A]=Ne({display:"ready",sender:"ready",app:"initializing"}),z=(ye,be)=>ye+"_"+be;let V=null,U=null;const I=nt(!1),[L,v]=Ne([]),y=pt(()=>z(bi(32),t.configId),[t.configId]),[M,F]=Ne({messages:[]}),{chatContainerRef:H}=aT({scrollOld:i.scrollOld}),{fileStatuses:X,setFileStatuses:G,pollFileStatus:te,handleRemoveFromTemp:N,resetStopFlag:j,setStopFlag:Y,stoppedRef:Q,setFileManagerData:ee,fileManagerData:ue}=fT({url:bn(),token:f,CSRFToken:_,activeSessionId:y}),{api_startChat_re:le,addEmptyMessage:he,setLastEmptyMessage:fe,stopStream:Fe}=dT({baseUrl:bn(),CSRFToken:_,token:f,setCurrentChatData:F,activeSessionId:y,setAppStatus:A}),{handleSendMessage:xe}=cT({token:f,api_startChat_re:le,addEmptyMessage:he,setCurrentChatData:F,setAppStatus:A,uploadController:V,resetStopFlag:j,setFileStatuses:G,stoppedRef:Q,stopPoll:U,pollFileStatusHook:te,setFileManagerData:ee,senderSwitchValues:s,tempKnowledgeBaseCheck:I,setRecommandQuestions:v,configId:t.configId,currentChatData:M,sessionId:y});Ye(()=>{O(ye=>{const be=ye.find(Te=>Te.id===t.id);return be.appStatus=C,[...ye]})},[C,t]),Ye(()=>{d("fileChanges",ue)},[ue]),Bd(e,()=>({handleStopMessage:()=>{Y(),A(ye=>({...ye,display:"ready",sender:"ready"})),G([]),Fe==null||Fe()},handleSendMessage:ye=>{ye.length&&(I.current=!0),xe({content:r,files:ye,status:n,currentData:M,senderConfig:b,clearFn:a,assist_id:t.configId,index:k})}}));const oe=async ye=>{var be;if(ye)try{const Te=(M==null?void 0:M.configId)||t.configId||"",_e=await Bt.get(`${bn()}/qa/ai/recommendQuestion?queryId=${ye}&configId=${Te||""}`.replace(/\?&/,"?"),{headers:{Authorization:f}});v(((be=_e.data)==null?void 0:be.data)||[])}catch{v([])}},ge=(ye,be)=>{F(Te=>Te&&{...Te,messages:Te.messages.map(se=>se.queryId===ye?{...se,feedbackResult:be}:se)})};function Ee(ye){const{content:be,audioUrl:Te,filePaths:_e,queryId:se}=ye;if(!y||!se)return;const Se=(M==null?void 0:M.messages)||[],ne=Se.findIndex(je=>(je==null?void 0:je.queryId)===se&&((je==null?void 0:je.istype)==="ai"||(je==null?void 0:je.isUser)===!1));let de;if(ne>0)for(let je=ne-1;je>=0;je-=1){const ft=Se[je];if((ft==null?void 0:ft.istype)==="user"||(ft==null?void 0:ft.isUser)===!0){de=ft;break}}const we=(de==null?void 0:de.content)??be;if(!we)return;const qe=(de==null?void 0:de.filePaths)??_e,He=(typeof qe=="string"&&qe?JSON.parse(qe):qe||[]).map(je=>je.uid),bt=Date.now();fe({now:bt}),A(je=>({...je,display:"processing",sender:"processing"})),ne>=0&&Se[ne]&&F(je=>{if(!je)return je;const ft=je,Yt=ft.messages||[];if(ne>=Yt.length)return je;const si=Yt.slice();return si[ne]={...si[ne],content:si[ne].content,reference:"[]",webReference:"[]",graphReference:null,databaseReference:null,status:2,chain:void 0},{...ft,messages:si}}),ye.clearFn&&ye.clearFn(),le({configId:M.configId,content:we,fileUids:He,lastDate:bt,name:M.label||"",queryId:se,sessionId:String(y||""),type:(de==null?void 0:de.audioUrl)??Te?"audioUrl":"text",audioUrl:((de==null?void 0:de.audioUrl)??Te)||"",enableThinking:!!s.reasoning,enableWebsearch:!!s.netSearch,qaChannel:s.qaChannel,tempKnowledgeBaseCheck:I.current},je=>{oe(se)})}const Ce=pt(()=>J(iT,{...i,currentChatData:M,setFeed:ge,handleReSenderSend:Ee,setAppStatus:A,appStatus:C,recommandQuestions:L}),[M,A,C,L]),Me=pt(()=>ue.uploadedFiles||[],[ue]),{FileDisplayTools:Ge}=Vd({fileManagerData:{uploadedFiles:Me},styles:x,eventsEmit:(ye,be)=>{var Te;switch(console.log("upload Event:",ye,be),ye){case"uploaded_file:removeFromTemp":const _e=(Te=be==null?void 0:be.file)==null?void 0:Te.uid;if(!_e){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6",be);break}const se=[...(M==null?void 0:M.messages)||[]].reverse().find(ne=>ne.istype==="user"),Se=se==null?void 0:se.queryId;N(_e,Se);break;case"TempKnowledgeBase":I.current=be;break}}});return Ye(()=>{console.log("currentChatData",M)},[M]),Ye(()=>{X.length&&F(ye=>{if(!ye)return ye;const{messages:be}=ye;for(let Te=be.length-1;Te>=0;Te--)if(be[Te].istype==="user"){const _e=be[Te].currentFiles||[];be[Te].currentFiles=X.map(se=>{var ne,de,we;const Se=_e.find(qe=>qe.uid===se.uid);return{name:((ne=se.file)==null?void 0:ne.name)||se.name,size:((de=se.file)==null?void 0:de.size)||se.size,type:((we=se.file)==null?void 0:we.type)||se.type,status:se.status,uid:se.uid,url:se.url||(Se==null?void 0:Se.url)||""}});break}return ye})},[X]),Pe("div",{style:{height:"calc(100% - 8px)",display:"flex",flexDirection:"column",flex:1,minWidth:568,padding:16,borderRadius:8,backgroundColor:"#FFFFFF"},children:[Pe("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",paddingBottom:12},children:[Pe("div",{className:"flex",children:[J(sT,{assistList:l,value:t.configId,loading:o,onChange:ye=>d&&d("assistant:change",{...t,configId:ye})}),J("div",{className:"ml-[12px]",children:Ge})]}),J("div",{style:{display:w?"":"none"},children:J("img",{src:Zs,className:"cursor-pointer",width:14,height:14,onClick:()=>T(t.id)})})]}),Pe("div",{ref:H,className:"relative",style:{direction:i.scrollOld?"ltr":"rtl",transform:i.scrollOld?"":"rotate(180deg)",flex:1,overflowY:"scroll",overflowX:"hidden",paddingBottom:8,display:"flex",flexDirection:"column",alignItems:"center",borderRadius:8},children:[J("div",{style:{flexGrow:1,flexShrink:1,flex:1}}),J("div",{style:{maxWidth:1e3,borderRadius:8,width:"100%"},children:Ce})]})]})});var Xf={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},$u={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},mT=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Ks={CSS:{},springs:{}};function yi(i,e,t){return Math.min(Math.max(i,e),t)}function xn(i,e){return i.indexOf(e)>-1}function So(i,e){return i.apply(null,e)}var ke={arr:function(i){return Array.isArray(i)},obj:function(i){return xn(Object.prototype.toString.call(i),"Object")},pth:function(i){return ke.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return i.nodeType||ke.svg(i)},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i>"u"},nil:function(i){return ke.und(i)||i===null},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return ke.hex(i)||ke.rgb(i)||ke.hsl(i)},key:function(i){return!Xf.hasOwnProperty(i)&&!$u.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function Kf(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function Yf(i,e){var t=Kf(i),r=yi(ke.und(t[0])?1:t[0],.1,100),n=yi(ke.und(t[1])?100:t[1],.1,100),s=yi(ke.und(t[2])?10:t[2],.1,100),a=yi(ke.und(t[3])?0:t[3],.1,100),o=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),d=l<1?o*Math.sqrt(1-l*l):0,f=1,_=l<1?(l*o+-a)/d:-a+o;function w(k){var b=e?e*k/1e3:k;return l<1?b=Math.exp(-b*l*o)*(f*Math.cos(d*b)+_*Math.sin(d*b)):b=(f+_*b)*Math.exp(-b*o),k===0||k===1?k:1-b}function T(){var k=Ks.springs[i];if(k)return k;for(var b=1/6,x=0,O=0;;)if(x+=b,w(x)===1){if(O++,O>=16)break}else O=0;var C=x*b*1e3;return Ks.springs[i]=C,C}return e?w:T}function yT(i){return i===void 0&&(i=10),function(e){return Math.ceil(yi(e,1e-6,1)*i)*(1/i)}}var _T=(function(){var i=11,e=1/(i-1);function t(f,_){return 1-3*_+3*f}function r(f,_){return 3*_-6*f}function n(f){return 3*f}function s(f,_,w){return((t(_,w)*f+r(_,w))*f+n(_))*f}function a(f,_,w){return 3*t(_,w)*f*f+2*r(_,w)*f+n(_)}function o(f,_,w,T,k){var b,x,O=0;do x=_+(w-_)/2,b=s(x,T,k)-f,b>0?w=x:_=x;while(Math.abs(b)>1e-7&&++O<10);return x}function l(f,_,w,T){for(var k=0;k<4;++k){var b=a(_,w,T);if(b===0)return _;var x=s(_,w,T)-f;_-=x/b}return _}function d(f,_,w,T){if(!(0<=f&&f<=1&&0<=w&&w<=1))return;var k=new Float32Array(i);if(f!==_||w!==T)for(var b=0;b<i;++b)k[b]=s(b*e,f,w);function x(O){for(var C=0,A=1,z=i-1;A!==z&&k[A]<=O;++A)C+=e;--A;var V=(O-k[A])/(k[A+1]-k[A]),U=C+V*e,I=a(U,f,w);return I>=.001?l(O,U,f,w):I===0?U:o(O,C,C+e,f,w)}return function(O){return f===_&&w===T||O===0||O===1?O:s(x(O),_,T)}}return d})(),Qf=(function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Expo:function(){return function(r){return r?Math.pow(2,10*r-10):0}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=yi(r,1,10),a=yi(n,.1,2);return function(o){return o===0||o===1?o:-s*Math.pow(2,10*(o-1))*Math.sin((o-1-a/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/a)}}},t=["Quad","Cubic","Quart","Quint"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,a){return function(o){return 1-n(s,a)(1-o)}},i["easeInOut"+r]=function(s,a){return function(o){return o<.5?n(s,a)(o*2)/2:1-n(s,a)(o*-2+2)/2}},i["easeOutIn"+r]=function(s,a){return function(o){return o<.5?(1-n(s,a)(1-o*2))/2:(n(s,a)(o*2-1)+1)/2}}}),i})();function Hu(i,e){if(ke.fnc(i))return i;var t=i.split("(")[0],r=Qf[t],n=Kf(i);switch(t){case"spring":return Yf(i,e);case"cubicBezier":return So(_T,n);case"steps":return So(yT,n);default:return So(r,n)}}function Jf(i){try{var e=document.querySelectorAll(i);return e}catch{return}}function Sa(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var a=i[s];e.call(r,a,s,i)&&n.push(a)}return n}function Ca(i){return i.reduce(function(e,t){return e.concat(ke.arr(t)?Ca(t):t)},[])}function Pd(i){return ke.arr(i)?i:(ke.str(i)&&(i=Jf(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function Vu(i,e){return i.some(function(t){return t===e})}function zu(i){var e={};for(var t in i)e[t]=i[t];return e}function eu(i,e){var t=zu(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function Ea(i,e){var t=zu(i);for(var r in e)t[r]=ke.und(i[r])?e[r]:i[r];return t}function bT(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function vT(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(o,l,d,f){return l+l+d+d+f+f}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),a=parseInt(r[3],16);return"rgba("+n+","+s+","+a+",1)"}function TT(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function a(w,T,k){return k<0&&(k+=1),k>1&&(k-=1),k<1/6?w+(T-w)*6*k:k<1/2?T:k<2/3?w+(T-w)*(2/3-k)*6:w}var o,l,d;if(r==0)o=l=d=n;else{var f=n<.5?n*(1+r):n+r-n*r,_=2*n-f;o=a(_,f,t+1/3),l=a(_,f,t),d=a(_,f,t-1/3)}return"rgba("+o*255+","+l*255+","+d*255+","+s+")"}function ST(i){if(ke.rgb(i))return bT(i);if(ke.hex(i))return vT(i);if(ke.hsl(i))return TT(i)}function Di(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function CT(i){if(xn(i,"translate")||i==="perspective")return"px";if(xn(i,"rotate")||xn(i,"skew"))return"deg"}function tu(i,e){return ke.fnc(i)?i(e.target,e.id,e.total):i}function _i(i,e){return i.getAttribute(e)}function Wu(i,e,t){var r=Di(e);if(Vu([t,"deg","rad","turn"],r))return e;var n=Ks.CSS[e+t];if(!ke.und(n))return n;var s=100,a=document.createElement(i.tagName),o=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;o.appendChild(a),a.style.position="absolute",a.style.width=s+t;var l=s/a.offsetWidth;o.removeChild(a);var d=l*parseFloat(e);return Ks.CSS[e+t]=d,d}function Zf(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?Wu(i,n,t):n}}function Gu(i,e){if(ke.dom(i)&&!ke.inp(i)&&(!ke.nil(_i(i,e))||ke.svg(i)&&i[e]))return"attribute";if(ke.dom(i)&&Vu(mT,e))return"transform";if(ke.dom(i)&&e!=="transform"&&Zf(i,e))return"css";if(i[e]!=null)return"object"}function eg(i){if(ke.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function ET(i,e,t,r){var n=xn(e,"scale")?1:0+CT(e),s=eg(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Wu(i,s,r):s}function Xu(i,e,t,r){switch(Gu(i,e)){case"transform":return ET(i,e,r,t);case"css":return Zf(i,e,t);case"attribute":return _i(i,e);default:return i[e]||0}}function Ku(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=Di(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function tg(i,e){if(ke.col(i))return ST(i);if(/\s/g.test(i))return i;var t=Di(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function Yu(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function wT(i){return Math.PI*2*_i(i,"r")}function xT(i){return _i(i,"width")*2+_i(i,"height")*2}function kT(i){return Yu({x:_i(i,"x1"),y:_i(i,"y1")},{x:_i(i,"x2"),y:_i(i,"y2")})}function ig(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=Yu(r,s)),r=s}return t}function AT(i){var e=i.points;return ig(i)+Yu(e.getItem(e.numberOfItems-1),e.getItem(0))}function rg(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return wT(i);case"rect":return xT(i);case"line":return kT(i);case"polyline":return ig(i);case"polygon":return AT(i)}}function DT(i){var e=rg(i);return i.setAttribute("stroke-dasharray",e),e}function IT(i){for(var e=i.parentNode;ke.svg(e)&&ke.svg(e.parentNode);)e=e.parentNode;return e}function ng(i,e){var t=e||{},r=t.el||IT(i),n=r.getBoundingClientRect(),s=_i(r,"viewBox"),a=n.width,o=n.height,l=t.viewBox||(s?s.split(" "):[0,0,a,o]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:o,vW:l[2],vH:l[3]}}function PT(i,e){var t=ke.str(i)?Jf(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:ng(t),totalLength:rg(t)*(r/100)}}}function LT(i,e,t){function r(f){f===void 0&&(f=0);var _=e+f>=1?e+f:0;return i.el.getPointAtLength(_)}var n=ng(i.el,i.svg),s=r(),a=r(-1),o=r(1),l=t?1:n.w/n.vW,d=t?1:n.h/n.vH;switch(i.property){case"x":return(s.x-n.x)*l;case"y":return(s.y-n.y)*d;case"angle":return Math.atan2(o.y-a.y,o.x-a.x)*180/Math.PI}}function Ld(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=tg(ke.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:ke.str(i)||e?r.split(t):[]}}function Qu(i){var e=i?Ca(ke.arr(i)?i.map(Pd):Pd(i)):[];return Sa(e,function(t,r,n){return n.indexOf(t)===r})}function sg(i){var e=Qu(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:eg(t)}}})}function OT(i,e){var t=zu(e);if(/^spring/.test(t.easing)&&(t.duration=Yf(t.easing)),ke.arr(i)){var r=i.length,n=r===2&&!ke.obj(i[0]);n?i={value:i}:ke.fnc(e.duration)||(t.duration=e.duration/r)}var s=ke.arr(i)?i:[i];return s.map(function(a,o){var l=ke.obj(a)&&!ke.pth(a)?a:{value:a};return ke.und(l.delay)&&(l.delay=o?0:e.delay),ke.und(l.endDelay)&&(l.endDelay=o===s.length-1?e.endDelay:0),l}).map(function(a){return Ea(a,t)})}function NT(i){for(var e=Sa(Ca(i.map(function(s){return Object.keys(s)})),function(s){return ke.key(s)}).reduce(function(s,a){return s.indexOf(a)<0&&s.push(a),s},[]),t={},r=function(s){var a=e[s];t[a]=i.map(function(o){var l={};for(var d in o)ke.key(d)?d==a&&(l.value=o[d]):l[d]=o[d];return l})},n=0;n<e.length;n++)r(n);return t}function FT(i,e){var t=[],r=e.keyframes;r&&(e=Ea(NT(r),e));for(var n in e)ke.key(n)&&t.push({name:n,tweens:OT(e[n],i)});return t}function RT(i,e){var t={};for(var r in i){var n=tu(i[r],e);ke.arr(n)&&(n=n.map(function(s){return tu(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function MT(i,e){var t;return i.tweens.map(function(r){var n=RT(r,e),s=n.value,a=ke.arr(s)?s[1]:s,o=Di(a),l=Xu(e.target,i.name,o,e),d=t?t.to.original:l,f=ke.arr(s)?s[0]:d,_=Di(f)||Di(l),w=o||_;return ke.und(a)&&(a=d),n.from=Ld(f,w),n.to=Ld(Ku(a,f),w),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Hu(n.easing,n.duration),n.isPath=ke.pth(s),n.isPathTargetInsideSVG=n.isPath&&ke.svg(e.target),n.isColor=ke.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var ag={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(a,o){s+=o+"("+a+") "}),i.style.transform=s}}};function og(i,e){var t=sg(i);t.forEach(function(r){for(var n in e){var s=tu(e[n],r),a=r.target,o=Di(s),l=Xu(a,n,o,r),d=o||Di(l),f=Ku(tg(s,d),l),_=Gu(a,n);ag[_](a,n,f,r.transforms,!0)}})}function BT(i,e){var t=Gu(i.target,e.name);if(t){var r=MT(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function UT(i,e){return Sa(Ca(i.map(function(t){return e.map(function(r){return BT(t,r)})})),function(t){return!ke.und(t)})}function ug(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var Od=0;function qT(i){var e=eu(Xf,i),t=eu($u,i),r=FT(t,i),n=sg(i.targets),s=UT(n,r),a=ug(s,t),o=Od;return Od++,Ea(e,{id:o,children:[],animatables:n,animations:s,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}var ti=[],lg=(function(){var i;function e(){!i&&(!Nd()||!Ze.suspendWhenDocumentHidden)&&ti.length>0&&(i=requestAnimationFrame(t))}function t(n){for(var s=ti.length,a=0;a<s;){var o=ti[a];o.paused?(ti.splice(a,1),s--):(o.tick(n),a++)}i=a>0?requestAnimationFrame(t):void 0}function r(){Ze.suspendWhenDocumentHidden&&(Nd()?i=cancelAnimationFrame(i):(ti.forEach(function(n){return n._onDocumentVisibility()}),lg()))}return typeof document<"u"&&document.addEventListener("visibilitychange",r),e})();function Nd(){return!!document&&document.hidden}function Ze(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,a=null;function o(C){var A=window.Promise&&new Promise(function(z){return a=z});return C.finished=A,A}var l=qT(i);o(l);function d(){var C=l.direction;C!=="alternate"&&(l.direction=C!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(A){return A.reversed=l.reversed})}function f(C){return l.reversed?l.duration-C:C}function _(){e=0,t=f(l.currentTime)*(1/Ze.speed)}function w(C,A){A&&A.seek(C-A.timelineOffset)}function T(C){if(l.reversePlayback)for(var z=s;z--;)w(C,n[z]);else for(var A=0;A<s;A++)w(C,n[A])}function k(C){for(var A=0,z=l.animations,V=z.length;A<V;){var U=z[A],I=U.animatable,L=U.tweens,v=L.length-1,y=L[v];v&&(y=Sa(L,function(Fe){return C<Fe.end})[0]||y);for(var M=yi(C-y.start-y.delay,0,y.duration)/y.duration,F=isNaN(M)?1:y.easing(M),H=y.to.strings,X=y.round,G=[],te=y.to.numbers.length,N=void 0,j=0;j<te;j++){var Y=void 0,Q=y.to.numbers[j],ee=y.from.numbers[j]||0;y.isPath?Y=LT(y.value,F*Q,y.isPathTargetInsideSVG):Y=ee+F*(Q-ee),X&&(y.isColor&&j>2||(Y=Math.round(Y*X)/X)),G.push(Y)}var ue=H.length;if(!ue)N=G[0];else{N=H[0];for(var le=0;le<ue;le++){H[le];var he=H[le+1],fe=G[le];isNaN(fe)||(he?N+=fe+he:N+=fe+" ")}}ag[U.type](I.target,U.property,N,I.transforms),U.currentValue=N,A++}}function b(C){l[C]&&!l.passThrough&&l[C](l)}function x(){l.remaining&&l.remaining!==!0&&l.remaining--}function O(C){var A=l.duration,z=l.delay,V=A-l.endDelay,U=f(C);l.progress=yi(U/A*100,0,100),l.reversePlayback=U<l.currentTime,n&&T(U),!l.began&&l.currentTime>0&&(l.began=!0,b("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,b("loopBegin")),U<=z&&l.currentTime!==0&&k(0),(U>=V&&l.currentTime!==A||!A)&&k(A),U>z&&U<V?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,b("changeBegin")),b("change"),k(U)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,b("changeComplete")),l.currentTime=yi(U,0,A),l.began&&b("update"),C>=A&&(t=0,x(),l.remaining?(e=r,b("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&d()):(l.paused=!0,l.completed||(l.completed=!0,b("loopComplete"),b("complete"),!l.passThrough&&"Promise"in window&&(a(),o(l)))))}return l.reset=function(){var C=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=C==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var A=s;A--;)l.children[A].reset();(l.reversed&&l.loop!==!0||C==="alternate"&&l.loop===1)&&l.remaining++,k(l.reversed?l.duration:0)},l._onDocumentVisibility=_,l.set=function(C,A){return og(C,A),l},l.tick=function(C){r=C,e||(e=r),O((r+(t-e))*Ze.speed)},l.seek=function(C){O(f(C))},l.pause=function(){l.paused=!0,_()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,ti.push(l),_(),lg())},l.reverse=function(){d(),l.completed=!l.reversed,_()},l.restart=function(){l.reset(),l.play()},l.remove=function(C){var A=Qu(C);cg(A,l)},l.reset(),l.autoplay&&l.play(),l}function Fd(i,e){for(var t=e.length;t--;)Vu(i,e[t].animatable.target)&&e.splice(t,1)}function cg(i,e){var t=e.animations,r=e.children;Fd(i,t);for(var n=r.length;n--;){var s=r[n],a=s.animations;Fd(i,a),!a.length&&!s.children.length&&r.splice(n,1)}!t.length&&!r.length&&e.pause()}function jT(i){for(var e=Qu(i),t=ti.length;t--;){var r=ti[t];cg(e,r)}}function $T(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Hu(e.easing):null,n=e.grid,s=e.axis,a=e.from||0,o=a==="first",l=a==="center",d=a==="last",f=ke.arr(i),_=parseFloat(f?i[0]:i),w=f?parseFloat(i[1]):0,T=Di(f?i[1]:i)||0,k=e.start||0+(f?_:0),b=[],x=0;return function(O,C,A){if(o&&(a=0),l&&(a=(A-1)/2),d&&(a=A-1),!b.length){for(var z=0;z<A;z++){if(!n)b.push(Math.abs(a-z));else{var V=l?(n[0]-1)/2:a%n[0],U=l?(n[1]-1)/2:Math.floor(a/n[0]),I=z%n[0],L=Math.floor(z/n[0]),v=V-I,y=U-L,M=Math.sqrt(v*v+y*y);s==="x"&&(M=-v),s==="y"&&(M=-y),b.push(M)}x=Math.max.apply(Math,b)}r&&(b=b.map(function(H){return r(H/x)*x})),t==="reverse"&&(b=b.map(function(H){return s?H<0?H*-1:-H:Math.abs(x-H)}))}var F=f?(w-_)/x:_;return k+F*(Math.round(b[C]*100)/100)+T}}function HT(i){i===void 0&&(i={});var e=Ze(i);return e.duration=0,e.add=function(t,r){var n=ti.indexOf(e),s=e.children;n>-1&&ti.splice(n,1);function a(w){w.passThrough=!0}for(var o=0;o<s.length;o++)a(s[o]);var l=Ea(t,eu($u,i));l.targets=l.targets||i.targets;var d=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=ke.und(r)?d:Ku(r,d),a(e),e.seek(l.timelineOffset);var f=Ze(l);a(f),s.push(f);var _=ug(s,i);return e.delay=_.delay,e.endDelay=_.endDelay,e.duration=_.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Ze.version="3.2.1";Ze.speed=1;Ze.suspendWhenDocumentHidden=!0;Ze.running=ti;Ze.remove=jT;Ze.get=Xu;Ze.set=og;Ze.convertPx=Wu;Ze.path=PT;Ze.setDashoffset=DT;Ze.stagger=$T;Ze.timeline=HT;Ze.easing=Hu;Ze.penner=Qf;Ze.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};const VT=ey({badgeCounts:{},updateBadgeCount:()=>{}}),zT=()=>{const i=Zm(VT);if(!i)throw new Error("useBadge must be used within a BadgeProvider");return i},WT=i=>i?i<1024?`${i}B`:i<1024*1024?`${(i/1024).toFixed(1)}KB`:`${(i/1024/1024).toFixed(1)}MB`:"",GT=({fileName:i,fileSize:e,icon:t,statusText:r,statusColor:n="text-gray-400",statusIcon:s,onRemove:a,themeColors:o={},cardId:l,showRemove:d=!0,disabledRemove:f=!1,onRemoveWithAnim:_,extra:w,style:T})=>Pe("div",{id:l,className:"group gap-x-3 items-center file-display-card relative flex w-[240px] bg-white border border-gray-200 rounded-lg shadow-sm px-3 py-2.5 transition-all hover:shadow-md hover:border-blue-300",style:T,children:[J("div",{className:"pt-0.5 flex-shrink-0",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:J("div",{style:{transform:"scale(1.2)",transformOrigin:"center"},children:t})}),Pe("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[Pe("div",{className:"flex items-center justify-between gap-1.5",children:[J("span",{className:"text-[13px] font-medium truncate max-w-[140px]",title:i,children:i}),J("span",{className:"ml-1 text-[12px] text-gray-400 whitespace-nowrap",children:WT(e)})]}),Pe("div",{className:`text-[11px] mt-1 flex items-center gap-2 ${n}`,children:[s,J("span",{children:r})]})]}),w,d&&!f&&J("button",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400 text-xs p-1 rounded-full bg-white shadow-sm z-10",onClick:()=>{_&&l?_(l):a&&a()},title:"\u79FB\u9664",style:{lineHeight:0,color:o.error||"#FF0000"},children:J(Wd,{className:"w-4 h-4"})})]});function XT(i,e){var n;const t=((n=e==null?void 0:e.theme)==null?void 0:n.icons)||{},r=(s,a,o)=>{const l=[s,...o||[]];for(const d of l){const f=t[d];if(f){if(Qs.isValidElement(f))return f;if(typeof f=="string")return J("img",{src:f,alt:d,style:{width:20,height:20}})}}return J(Eo,{type:a,size:18})};switch(i.toLowerCase()){case"docx":case"doc":return r("docx","rag/word",["doc"]);case"image":case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return r("image","rag/pic",["png","jpg","jpeg"]);case"pptx":case"ppt":return r("pptx","rag/ppt",["ppt"]);case"sheets":case"excel":case"xls":case"xlsx":case"xlsm":case"xlsb":case"xltx":case"xltm":case"xlt":case"xlam":return i.toLowerCase()==="csv"?r("csv","rag/csv",["sheets","excel"]):r("sheets","rag/excel",["excel","xls","xlsx"]);case"pdf":return r("pdf","rag/pdf");case"txt":return r("txt","rag/txt");case"md":return r("md","rag/txt",["txt"]);case"json":return r("json","rag/json");case"html":case"htm":case"url":return r("html","rag/url",["htm","url"]);case"zip":case"rar":case"7z":return r("archive","rag/zip",["zip","rar"]);case"odt":case"ods":case"odp":case"odf":return r("odt","rag/odf");case"xml":return r("xml","rag/file");default:return J(Eo,{type:"rag/file",size:18})}}const KT=({src:i,alt:e,fallback:t,onError:r})=>{const[n,s]=Ne(!1);return n?J("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:t}):J("img",{src:i,alt:e,style:{width:24,height:24,objectFit:"cover",borderRadius:"4px"},onError:()=>{s(!0),r==null||r()}})};function YT({uploadedFiles:i,onRemoveFile:e,eventsEmit:t,styles:r}){var T,k,b,x;const n=nt(null),[s,a]=Ne(!1),[o,l]=Ne(!1),d=()=>{const O=n.current;if(!O)return;const{scrollLeft:C,scrollWidth:A,clientWidth:z}=O;a(C>0),l(C<A-z-1)};Ye(()=>{const O=n.current;if(!O)return;const C=setTimeout(()=>{d()},0);O.addEventListener("scroll",d);const A=new ResizeObserver(()=>{d()});return A.observe(O),()=>{clearTimeout(C),O.removeEventListener("scroll",d),A.disconnect()}},[i]);const f=O=>{const C=n.current;if(!C)return;const A=200,z=C.scrollLeft,V=O==="left"?z-A:z+A;C.scrollTo({left:V,behavior:"smooth"})};Ye(()=>{i.forEach((O,C)=>{O&&console.log("FilesDisplay currentStatus",O.status)})},[i]),Ye(()=>{i.length>0&&i.every(C=>C.status==="finished")&&Ze({targets:".file-display-card",opacity:0,scale:.8,delay:Ze.stagger(100),duration:400,easing:"easeOutExpo",complete:()=>{t==null||t("files:finished_animation_complete")}})},[i,t]);const _=((k=(T=r==null?void 0:r.theme)==null?void 0:T.colors)==null?void 0:k.border)||"#dee2e6",w=((x=(b=r==null?void 0:r.theme)==null?void 0:b.colors)==null?void 0:x.disabled)||"#808080";return Pe("div",{className:"flex items-center w-full gap-2",children:[s?J("button",{onClick:()=>f("left"),className:"shrink-0 w-7 h-7 rounded-full bg-white shadow-sm border flex items-center justify-center hover:bg-gray-50 hover:shadow-md transition-all cursor-pointer",style:{borderColor:_,borderWidth:"1px"},"aria-label":"\u5411\u5DE6\u6EDA\u52A8",children:J(Sy,{size:16,style:{color:w}})}):J("div",{className:"shrink-0 w-0"}),J("div",{ref:n,className:"flex-1 flex overflow-x-auto gap-3 pb-[0.5px] files-display-scroll",style:{scrollbarWidth:"none",scrollbarColor:"transparent transparent"},children:i.filter(Boolean).map((O,C)=>{var te,N,j;if(!O||!O.file)return null;const A=O.name||O.file.name,z=(te=O.file)==null?void 0:te.size;let{type:V,status:U}=O;U==="finished"&&(U="done");const I=O.uid||`${A}-${z}-${C}-${O.file.lastModified||Date.now()}`,v={pending:{text:"\u5F85\u53D1\u9001",icon:null,color:"text-gray-400"},uploading:{text:"\u4E0A\u4F20\u4E2D",icon:J(zl,{className:"w-3 h-3 animate-spin"}),color:"text-blue-500"},parsing:{text:"\u89E3\u6790\u4E2D",icon:J(zl,{className:"w-3 h-3 animate-spin"}),color:"text-blue-500"},done:{text:"\u5DF2\u5C31\u7EEA",icon:J(xy,{className:"w-3 h-3"}),color:"text-green-500"},error:{text:"\u5931\u8D25",icon:J(Ty,{className:"w-3 h-3"}),color:"text-red-500"}}[U||"pending"]||{text:"\u672A\u77E5",icon:null,color:"text-gray-400"},y=((N=A.split(".").pop())==null?void 0:N.toLowerCase())||"",M=XT(y||"unknow",r),G=["jpg","jpeg","png","gif","bmp","webp","svg","ico"].includes(y)&&V==="image"&&O.preview?J(KT,{src:O.preview,alt:A,fallback:M}):M;return J(GT,{cardId:`file-card-${C}`,fileName:A,fileSize:z,icon:G,statusText:v.text||"\u672A\u77E5",statusColor:v.color||"text-gray-400",statusIcon:v.icon||null,showRemove:U!=="parsing"&&U!=="uploading",onRemoveWithAnim:Y=>{Ze({targets:`#${Y}`,opacity:0,scale:.8,duration:300,easing:"easeOutExpo",complete:()=>{e==null||e(C)}})},themeColors:(j=r==null?void 0:r.theme)==null?void 0:j.colors},I)})}),o?J("button",{onClick:()=>f("right"),className:"shrink-0 w-7 h-7 rounded-full bg-white shadow-sm border flex items-center justify-center hover:bg-gray-50 hover:shadow-md transition-all cursor-pointer",style:{borderColor:_,borderWidth:"1px"},"aria-label":"\u5411\u53F3\u6EDA\u52A8",children:J(Cy,{size:16,style:{color:w}})}):J("div",{className:"shrink-0 w-0"})]})}const QT=({size:i=20,color:e="#ffffff",circleColor:t="#ffffff",className:r=""})=>Pe("svg",{width:i,height:i,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,children:[J("circle",{cx:"10",cy:"10",r:"9",fill:"none",stroke:t,strokeWidth:"1.5"}),J("rect",{x:"7",y:"7",width:"6",height:"6",rx:"1",ry:"1",fill:e})]});function JT({checked:i,onChange:e,icon:t,children:r,styles:n,disabled:s}){var T,k,b,x,O,C,A,z,V,U,I,L,v,y;const a=((k=(T=n==null?void 0:n.theme)==null?void 0:T.colors)==null?void 0:k.primary)||"#00C26A",o=((x=(b=n==null?void 0:n.theme)==null?void 0:b.colors)==null?void 0:x.text)||"#343a40";(C=(O=n==null?void 0:n.theme)==null?void 0:O.colors)!=null&&C.background;const l=((z=(A=n==null?void 0:n.theme)==null?void 0:A.colors)==null?void 0:z.border)||"#dee2e6",d=((U=(V=n==null?void 0:n.theme)==null?void 0:V.colors)==null?void 0:U.disabledBackground)||"#F5F5F5",f=((L=(I=n==null?void 0:n.theme)==null?void 0:I.colors)==null?void 0:L.disabledText)||"#808080",_=((y=(v=n==null?void 0:n.theme)==null?void 0:v.colors)==null?void 0:y.disabled)||"#808080";return Pe("button",{type:"button",onClick:()=>e(!i),disabled:s,className:"flex items-center gap-1 bg-white px-3 py-1 rounded-full border transition-all duration-200 text-xs select-none",style:{borderWidth:1.5,outline:"none",cursor:s?"not-allowed":"pointer",minWidth:0,background:s?d:i?"linear-gradient(90deg, #F1F8FF 0%, #F9F4FF 100%)":"transparent",color:s?f:i?a:o,borderColor:s?_:i?a:l},children:[t,J("span",{children:r})]})}function ZT({value:i,onChange:e,options:t,styles:r,disabled:n,placeholder:s="\u8BF7\u9009\u62E9"}){var _,w,T,k,b,x,O,C,A,z,V,U,I,L;(w=(_=r==null?void 0:r.theme)==null?void 0:_.colors)!=null&&w.primary;const a=((k=(T=r==null?void 0:r.theme)==null?void 0:T.colors)==null?void 0:k.text)||"#343a40";(x=(b=r==null?void 0:r.theme)==null?void 0:b.colors)!=null&&x.background;const o=((C=(O=r==null?void 0:r.theme)==null?void 0:O.colors)==null?void 0:C.border)||"#dee2e6",l=((z=(A=r==null?void 0:r.theme)==null?void 0:A.colors)==null?void 0:z.disabledBackground)||"#F5F5F5",d=((U=(V=r==null?void 0:r.theme)==null?void 0:V.colors)==null?void 0:U.disabledText)||"#808080",f=((L=(I=r==null?void 0:r.theme)==null?void 0:I.colors)==null?void 0:L.disabled)||"#808080";return J("div",{style:{display:"inline-block"},children:J($d,{value:i,onChange:e,disabled:n,placeholder:s,size:"small",style:{minWidth:120,fontSize:"12px !important",height:"28px",borderRadius:"14px",border:`1.5px solid ${n?f:o}`,backgroundColor:n?l:"white",color:n?d:a,fontWeight:"500",transition:"all 0.2s ease"},className:"yuanbao-select",styles:{popup:{root:{fontSize:"12px",borderRadius:"8px"}}},options:t})})}function eS({value:i,eventsEmit:e,styles:t,status:r,onUpload:n,onVoice:s,uploadedFiles:a,onRemoveFile:o,senderConfig:l={},recommandQuestions:d=[],fileUploadStatus:f=[],disclaimer:_}={}){var xe;const{badgeCounts:w}=zT(),T=nt(null),k=l.switchs||[],[b,x]=Ne(()=>{const oe={};return k.forEach(ge=>{var Ee,Ce;ge.type==="switch"?oe[ge.name]=ge.defaultValue??!1:ge.type==="select"&&(oe[ge.name]=ge.defaultValue??((Ce=(Ee=ge.options)==null?void 0:Ee[0])==null?void 0:Ce.value)??"")}),oe});Ye(()=>{e&&e("sender:configChange",{all:b})},[b]);const[O,C]=Ne(i||"");Ye(()=>{C(i||"")},[i]);const A=()=>{const oe=T.current;if(oe){oe.style.height="auto";const Me=5*24+12*2,Ge=oe.scrollHeight;Ge<=Me?(oe.style.height=`${Ge}px`,oe.style.overflowY="hidden"):(oe.style.height=`${Me}px`,oe.style.overflowY="auto")}},z=oe=>{C(oe.target.value),e&&e("sender:change",oe.target.value),A()},V=oe=>{setTimeout(()=>{A()},0)},U=oe=>{if(oe.key==="Enter"){if(oe.ctrlKey||oe.metaKey){oe.preventDefault();const ge=T.current;if(!ge)return;const Ee=ge.selectionStart||0,Ce=ge.selectionEnd||0,Me=`${O.substring(0,Ee)}
283
+ ${O.substring(Ce)}`;C(Me),requestAnimationFrame(()=>{ge.selectionStart=ge.selectionEnd=Ee+1,A()});return}oe.shiftKey||(oe.preventDefault(),e&&e("sender:send"))}},I=()=>{window.dispatchEvent(new CustomEvent("aichat:right_set",{detail:{collapsed:!0}}))};Ye(()=>{A()},[O]),Ye(()=>{let oe;try{oe=typeof d=="string"?JSON.parse(d):d}catch{oe=[]}},[d]);const L=pt(()=>{if(d==null||d==="")return[];if(typeof d=="string")try{const oe=JSON.parse(d);return Array.isArray(oe)?oe:[]}catch{return[]}return Array.isArray(d)?d:[]},[d]),[v,y]=Ne(!1);Ye(()=>{if(!L||L.length===0){y(!1);return}y(!1),setTimeout(()=>{y(!0)},0)},[L]),Ye(()=>{if(!v)return;const oe=document.querySelectorAll(".recommand-question-btn");oe.forEach(ge=>{const Ee=ge;Ee.style.visibility="visible",Ee.style.opacity="0",Ee.style.transform="translateY(20px)"}),Ze.remove(oe),Ze({targets:oe,opacity:[0,1],translateY:[20,0],delay:Ze.stagger(120),duration:400,easing:"easeOutCubic",complete:()=>{oe.forEach(ge=>{const Ee=ge;Ee.removeAttribute("style"),Ee.style.color=le})}})},[v,L]);const M=pt(()=>f&&f.length>0?f:a||[],[f,a]),F=pt(()=>O&&O.trim().length>0,[O]),H=pt(()=>{const oe=O&&O.trim().length>0,ge=M&&M.length>0;return oe||ge},[O,M]),X=pt(()=>{const oe=H?[{icon:J(Wd,{size:20,color:"#4E5969",className:"group-hover:text-gray-700"}),name:"clear",tip:"\u6E05\u7A7A\u8F93\u5165\u548C\u6587\u4EF6"}]:[],ge=(l.actions||[]).map(Ee=>{const Ce=w[Ee.name],Me=Ce!==void 0?Ce:Ee.badgeCount;return{...Ee,badgeCount:Me}});return[...oe,...ge]},[H,l.actions,w]),G=(xe=t==null?void 0:t.theme)==null?void 0:xe.colors,te=(G==null?void 0:G.primary)||"#007bff",N=(G==null?void 0:G.text)||"#343a40",j=(G==null?void 0:G.background)||"#ffffff",Y=(G==null?void 0:G.border)||"#dee2e6",Q=(G==null?void 0:G.background)||"#ffffff",ee=(G==null?void 0:G.disabled)||"#808080",ue=(G==null?void 0:G.disabledBackground)||"#F5F5F5";G!=null&&G.error;const le=(G==null?void 0:G.disabledText)||"#808080",he="rgba(255, 255, 255, 0.9)";G!=null&&G.disabledText;const fe=(G==null?void 0:G.text)||"#000";Ye(()=>{const oe="sender-icon-active-style";let ge=document.getElementById(oe);ge||(ge=document.createElement("style"),ge.id=oe,document.head.appendChild(ge)),G!=null&&G.error,ge.textContent=`
284
+ .sender-icon-active {
285
+ color: #ffffff !important;
286
+ }
287
+ .sender-icon-active svg {
288
+ color: #ffffff !important;
289
+ }
290
+ /* lucide-react \u56FE\u6807\u4F7F\u7528 stroke\uFF0C\u786E\u4FDD\u6FC0\u6D3B\u65F6\u4E3A\u767D\u8272 */
291
+ .sender-icon-active svg path,
292
+ .sender-icon-active svg circle,
293
+ .sender-icon-active svg line,
294
+ .sender-icon-active svg polyline {
295
+ stroke: #ffffff !important;
296
+ fill: none !important;
297
+ }
298
+ `},[G==null?void 0:G.error]);const Fe="dynamic-placeholder-style";return Ye(()=>{const oe=document.getElementById(Fe)||document.createElement("style");oe.id=Fe,oe.innerHTML=`
299
+ .dynamic-placeholder::placeholder {
300
+ color: ${ee};
301
+ opacity: 1; /* Firefox */
302
+ }
303
+ .dynamic-placeholder:-ms-input-placeholder { /* Internet Explorer 10-11 */
304
+ color: ${ee};
305
+ }
306
+ .dynamic-placeholder::-ms-input-placeholder { /* Microsoft Edge */
307
+ color: ${ee};
308
+ }
309
+ .yuanbao-select .ant-select-selection-item {
310
+ font-size: 12px !important;
311
+ }
312
+ .yuanbao-select .ant-select-selection-placeholder {
313
+ font-size: 12px !important;
314
+ }
315
+ .sender-container-gradient {
316
+ background: linear-gradient(135deg, #3262FA 0%, #6C18FF 100%) !important;
317
+ }
318
+ /* \u6587\u4EF6\u663E\u793A\u533A\u57DF\u6EDA\u52A8\u6761\u6837\u5F0F - \u5B8C\u5168\u9690\u85CF\u6EDA\u52A8\u6761 */
319
+ .files-display-scroll::-webkit-scrollbar {
320
+ display: none; /* Chrome/Safari/Edge - \u5B8C\u5168\u9690\u85CF */
321
+ width: 0;
322
+ height: 0;
323
+ }
324
+ .files-display-scroll {
325
+ -ms-overflow-style: none; /* IE/Edge - \u9690\u85CF\u6EDA\u52A8\u6761 */
326
+ scrollbar-width: none; /* Firefox - \u9690\u85CF\u6EDA\u52A8\u6761 */
327
+ }
328
+ `,document.head.appendChild(oe)},[ee,Y,G]),Pe("div",{className:"absolute w-full bottom-0 z-20 pb-[env(safe-area-inset-bottom)] bg-transparent!",children:[J("div",{className:"absolute inset-0 bg-transparent! pointer-events-none"}),J("div",{className:"absolute inset-0 bg-transparent! pointer-events-none"}),Pe("div",{className:"relative mx-auto px-8",style:{maxWidth:1e3,width:"85%",boxSizing:"border-box"},children:[Pe("div",{className:"p-3",style:{width:"100%",boxSizing:"border-box"},children:[J("div",{className:"mb-3 flex flex-wrap gap-2 animate-fade-in-up",children:v&&L.map((oe,ge)=>J("button",{onClick:()=>{e&&e("sender:send_recommandQuestion",{content:oe,clearFn:()=>{e&&e("sender:clear")}})},className:"recommand-question-btn shadow-sm px-3 py-1.5 bg-white cursor-pointer text-xs rounded-full transition-all duration-200 ease-in-out hover:shadow-lg",style:{visibility:"hidden",transform:"translateY(20px)",backgroundColor:he,color:le,border:"none"},onMouseEnter:Ee=>{Ee.currentTarget.style.color=fe},onMouseOut:Ee=>{Ee.currentTarget.style.color=le},children:oe},ge))}),J("div",{className:"sender-container-gradient relative w-full rounded-[28px] transition-all duration-200",style:{padding:"1px",background:"transparent"},children:Pe("div",{className:"flex flex-col items-end w-full rounded-[28px] shadow-sm transition-all duration-200",style:{backgroundColor:Q,border:`0.5px solid ${Y}`,padding:"0 16px 12px 16px"},children:[M.length>0&&J("div",{className:"files-display-wrapper w-full mb-2 overflow-x-auto",style:{maxHeight:"120px",paddingTop:"12px"},children:J(YT,{styles:t,uploadedFiles:M,onRemoveFile:o||(()=>{}),eventsEmit:e})}),J("textarea",{ref:T,value:O,onChange:z,onPaste:V,onKeyDown:U,onFocus:I,rows:1,placeholder:"\u8F93\u5165\u95EE\u9898\u540E\u6309Enter\u53D1\u9001,Shift+Enter\u8FDB\u884C\u6362\u884C",className:`flex-1 w-full min-w-0 py-2 resize-none outline-none border-none min-h-[85px]
329
+ max-h-[180px] text-[14px] leading-[24px] dynamic-placeholder`,style:{backgroundColor:"transparent",color:N,whiteSpace:"pre-wrap"}}),Pe("div",{className:"flex items-center justify-between w-full ml-3 space-x-1.5 shrink-0 whitespace-nowrap",children:[J("div",{children:J("div",{className:"flex items-center gap-4",children:k.filter(oe=>oe.enabled!==!1).map(oe=>oe.type==="select"?Pe("div",{className:"flex items-center gap-2",children:[Pe("span",{className:"text-xs",style:{color:N},children:[oe.label,":"]}),J(ZT,{value:b[oe.name],onChange:ge=>{x(Ee=>({...Ee,[oe.name]:ge}))},options:oe.options||[],styles:t,disabled:!oe.enabled,placeholder:oe.label})]},oe.name):J(JT,{styles:t,checked:b[oe.name],disabled:!oe.enabled,onChange:ge=>{x(Ee=>({...Ee,[oe.name]:ge}))},icon:oe.icon,children:oe.label},oe.name))})}),Pe("div",{className:"flex items-center justify-end",children:[X.filter(oe=>oe.enabled!==!1).map((oe,ge)=>{const Ee=J("button",{type:"button",className:"relative w-8 h-8 flex items-center justify-center rounded-lg cursor-pointer group hover:bg-blue-50 active:bg-blue-100 transition-colors",style:{border:"none",background:"transparent",color:N,fontWeight:500,fontSize:15,outline:"none",padding:0,margin:0,transition:"background 0.2s"},onClick:()=>{oe.name==="clear"?e&&e("sender:clear"):e&&e(`sender:action_${oe.name}`)},children:oe.icon}),Ce=oe.tip?J(wo,{title:oe.tip,placement:"top",styles:{body:{backgroundColor:"#4E5969",color:"#ffffff",fontSize:"12px",padding:"6px 12px",borderRadius:"6px"},root:{maxWidth:"300px"}},children:Ee}):Ee;return oe.badgeCount===void 0?J(Qs.Fragment,{children:Ce},oe.name||ge):J(Hd,{count:oe.badgeCount,size:"small",style:{backgroundColor:te,color:j,fontWeight:500,fontSize:9,minWidth:16,height:16,lineHeight:"19px",borderRadius:9,marginLeft:8,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 5px"},offset:[-2,10],children:Ce},(oe.name||ge)+"-badge")}),l.actions&&J("div",{className:"ml-3 mr-3 h-5 w-px",style:{backgroundColor:Y}}),J("div",{className:`
330
+ relative w-[35px] h-8 flex items-center justify-center rounded-full group overflow-hidden shadow-sm
331
+ transition-all duration-200
332
+ ${r==="processing"?"animate-pulse":""}
333
+ `,style:{cursor:r==="processing"||F?"pointer":"not-allowed",background:r==="processing"?"#222222":F?`linear-gradient(to bottom right, ${te}, ${(G==null?void 0:G.primary)||"#0275d8"})`:ue},onClick:()=>{r==="processing"?e&&e("sender:stop",{}):F&&e&&e("sender:send")},title:r==="processing"?"\u505C\u6B62\u5F53\u524D\u5BF9\u8BDD":"\u53D1\u9001",children:J("div",{className:"relative flex items-center gap-x-1 font-medium",style:{color:!F&&r!=="processing"?le:"#ffffff"},children:r==="processing"?J(QT,{size:46,color:"#ffffff",circleColor:"#ffffff"}):J(wy,{size:20,className:F?"sender-icon-active":"",style:{color:F?"#ffffff":le,strokeWidth:2.5}})})})]})]})]})}),J("div",{className:"mt-2 pt-2 pb-3 px-1 flex items-center justify-between ",children:J("span",{className:"text-[10px]",style:{color:ee}})})]}),_&&J("div",{className:" absolute bottom-3 left-0 right-0 w-full text-xs text-center",children:J("div",{className:"text-xs text-center",style:{color:le},children:_})})]})]})}const tS={sm:"240px",md:"260px",lg:"280px"},iS={sm:"12px",md:"16px",lg:"20px"},rS={sm:"2px",md:"4px",lg:"8px"},nS={sm:"4px",md:"8px",lg:"16px"},sS={sm:"4px",md:"8px",lg:"16px"},aS={sm:"0 1px 2px #eee",md:"0 2px 8px #ddd",lg:"0 4px 16px #ccc"},oS={sm:"1.2",md:"1.5",lg:"2"};function uS(i){return{...i,size:iS[i.size]||i.size,radius:rS[i.radius]||i.radius,padding:nS[i.padding]||i.padding,margin:sS[i.margin]||i.margin,shadow:aS[i.shadow]||i.shadow,lineHeight:oS[i.lineHeight]||i.lineHeight,sidebar:tS[i.sidebar]||i.sidebar}}function iu(i,e){if(!e)return i;const t=Array.isArray(i)?[...i]:{...i};for(const r in e)if(e[r]!==void 0&&e[r]!==null&&Object.prototype.hasOwnProperty.call(e,r))if(r==="actions"&&Array.isArray(i[r])&&Array.isArray(e[r])){const n=new Map;i[r].forEach(s=>{s.name&&n.set(s.name,s)}),e[r].forEach(s=>{s.name&&n.set(s.name,s)}),t[r]=Array.from(n.values())}else typeof i[r]=="object"&&i[r]!==null&&!Array.isArray(i[r])&&typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])?t[r]=iu(i[r],e[r]):t[r]=e[r];return t}const lS=i=>ei.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},ei.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.6666C11.6819 14.6666 14.6667 11.6819 14.6667 7.99998C14.6667 4.31808 11.6819 1.33331 8 1.33331C4.3181 1.33331 1.33334 4.31808 1.33334 7.99998C1.33334 11.6819 4.3181 14.6666 8 14.6666Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M1.33334 8H14.6667",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.6666C9.47277 14.6666 10.6667 11.6819 10.6667 7.99998C10.6667 4.31808 9.47277 1.33331 8 1.33331C6.52724 1.33331 5.33334 4.31808 5.33334 7.99998C5.33334 11.6819 6.52724 14.6666 8 14.6666Z",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M3.28597 3.38068C4.4924 4.58711 6.15907 5.33331 8 5.33331C9.84097 5.33331 11.5076 4.58711 12.7141 3.38068",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M12.7141 12.6193C11.5076 11.4129 9.84097 10.6667 8 10.6667C6.15907 10.6667 4.4924 11.4129 3.28597 12.6193",stroke:"currentColor",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})),cS=i=>ei.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},ei.createElement("path",{d:"M1.73633 1.57642C2.53848 0.774265 3.74473 0.714862 4.87207 1.03052C6.02182 1.35245 7.24885 2.09683 8.3125 3.1604C9.37624 4.22414 10.1204 5.45195 10.4424 6.60181C10.758 7.72909 10.6986 8.93446 9.89648 9.73657C9.09439 10.5387 7.88901 10.5981 6.76172 10.2825C5.61186 9.96051 4.38405 9.21632 3.32031 8.15259C2.25674 7.08894 1.51236 5.86191 1.19043 4.71216C0.874775 3.58481 0.934176 2.37857 1.73633 1.57642Z",stroke:"#4E6EF2",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M6.76172 5.41479C7.88883 5.09929 9.09442 5.15888 9.89648 5.96069C10.6986 6.76284 10.758 7.96909 10.4424 9.09644C10.1204 10.2462 9.37617 11.4732 8.3125 12.5369C7.24882 13.6005 6.02187 14.3448 4.87207 14.6667C3.74472 14.9824 2.53848 14.923 1.73633 14.1208C0.934528 13.3188 0.874922 12.1132 1.19043 10.9861C1.51239 9.83623 2.25659 8.60841 3.32031 7.54468C4.38405 6.48096 5.61186 5.73675 6.76172 5.41479Z",stroke:"#4E6EF2",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M11.1282 1.03052C12.2553 0.715012 13.4609 0.774612 14.263 1.57642C15.0651 2.37857 15.1246 3.58481 14.8089 4.71216C14.4869 5.86196 13.7427 7.08892 12.679 8.15259C11.6153 9.21627 10.3884 9.96048 9.23859 10.2825C8.11124 10.5981 6.90499 10.5387 6.10284 9.73657C5.30106 8.9345 5.24144 7.72892 5.55695 6.60181C5.8789 5.45195 6.62311 4.22414 7.68683 3.1604C8.75056 2.09668 9.97838 1.35248 11.1282 1.03052Z",stroke:"#4E6EF2",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"}),ei.createElement("path",{d:"M6.10284 5.96069C6.90499 5.15855 8.11124 5.09914 9.23859 5.41479C10.3883 5.73673 11.6154 6.48111 12.679 7.54468C13.7427 8.60841 14.4869 9.83623 14.8089 10.9861C15.1245 12.1134 15.0651 13.3188 14.263 14.1208C13.4609 14.9229 12.2555 14.9823 11.1282 14.6667C9.97838 14.3448 8.75055 13.6006 7.68683 12.5369C6.62325 11.4732 5.87888 10.2462 5.55695 9.09644C5.24129 7.96909 5.3007 6.76284 6.10284 5.96069Z",stroke:"#4E6EF2",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round"})),Rd={actions:[{name:"upload",icon:J(Eo,{type:"wenda/shangchuanwenjian",color:"#000",size:20}),tip:"\u6587\u4EF6\u4E0A\u4F20"}],switchs:[{label:"\u8054\u7F51\u641C\u7D22",name:"netSearch",type:"switch",defaultValue:!1,enabled:!0,icon:J(lS,{width:16,height:16,className:"aichat-netsearch-icon",style:{color:"#4B8CF7"}})},{label:"\u6DF1\u5EA6\u601D\u8003",name:"reasoning",type:"switch",defaultValue:!0,enabled:!0,icon:J(cS,{width:16,height:16})}]};function dS({senderConfig:i,handleEventsEmit:e}){const[t,r]=Ne(""),[n,s]=Ne([]);Ye(()=>{console.log("uploadedFiles",n)},[n]);const a=()=>{r(""),n.forEach(T=>{T.preview&&T.type==="image"&&URL.revokeObjectURL(T.preview)}),console.log("=============1"),s([])},o=T=>{r(T)},l=T=>{console.log("Sending message:",T)},d=T=>T.type.startsWith("image")?"image":"document",f=T=>{const k=d(T),b={file:T,type:k};return k==="image"&&(b.preview=URL.createObjectURL(T)),b},_=T=>{if(T&&T.length>0){const k=Array.from(T),b=Xd(k,n,i);if(b.valid)console.log("=============3"),s([...k.map(x=>f(x))]);else{Kd(b);const x=k.filter(O=>!b.rejectedFiles.includes(O));x.length>0&&(console.log("=============2"),s([...x.map(O=>f(O))]))}}},w=T=>{console.log("=============4"),s(k=>k.filter((b,x)=>x!==T))};return Ye(()=>{e==null||e("fileManager:change",{uploadedFiles:n,senderConfig:i,setUploadedFiles:T=>{s([...T])}})},[n,i]),{uploadedFiles:n,inputValue:t,handleSendMessage:l,handleMessageChange:o,clearInput:a,handleUploadFiles:_,handleRemoveFile:w,setUploadedFiles:s}}const Md=[{id:bi(32)},{id:bi(32)}],AS=({scrollOld:i=!1,token:e,styles:t={},senderConfig:r={},disclaimer:n="\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u4E0D\u4EE3\u8868\u672C\u516C\u53F8\u89C2\u70B9\u3002",viewLimit:s})=>{const a=nt(null),o=nt(void 0),l=nt([]),d=nt(void 0),f=nt(void 0),_=nt(null),w=nt(new Map),[T,k]=Ne([]);Md.forEach(_e=>{w.current.set(_e.id,{current:_e.id})});const b=(_e,se)=>{[...w.current.values()].forEach(ne=>{const de=ne==null?void 0:ne.current;de&&typeof de[_e]=="function"&&de[_e](xe)})},[x,O]=Ne(()=>({uploadedFiles:[]})),[C,A]=Ne(Md),[z,V]=Ne([]),[U,I]=Ne(!1),[L,v]=Ne({}),[y,M]=Ne({}),F=Ud(),H=ms(ms($l,(F==null?void 0:F.theme)||{}),(t==null?void 0:t.theme)||{}),X=uS(H.space),G={...H,space:X,colors:{...H.colors,info:H.colors.info||"#0000FF",background:H.colors.background||"#ffffff",text:H.colors.text||"#343a40",border:H.colors.border||"#dee2e6",disabled:H.colors.disabled||"#808080",disabledBackground:H.colors.disabledBackground||"#F5F5F5",disabledText:H.colors.disabledText||"#808080"}},te=pt(()=>{const se=ms({theme:$l,mode:"light"},F||{});return ms(se,t||{})},[F,t]),N={...t,theme:G},[j,Y]=Ne([]),[Q,ee]=Ne(()=>iu(Rd,r));Ye(()=>{if(r){const _e=iu(Rd,r);ee(_e)}},[r]);const ue=(_e,se)=>{switch(console.log("Event emitted:",_e,se),_e){case"sender:action_upload":_.current&&_.current.click();break;case"fileChanges":O(se);break;case"fileManager:change":{typeof(se==null?void 0:se.setUploadedFiles)=="function"&&(f.current=se.setUploadedFiles,o.current=se.removeFile,d.current=se==null?void 0:se.senderConfig,l.current=Array.isArray(se==null?void 0:se.uploadedFiles)?se.uploadedFiles:[],Array.isArray(se==null?void 0:se.uploadedFiles)&&k(se.uploadedFiles));break}case"sender:stop":b("handleStopMessage");break;case"assistant:change":A(Se=>Se.map(ne=>ne.id===se.id?{...ne,configId:se.configId}:ne));break;case"sender:configChange":se&&se.all&&v(se.all);break;case"sender:change":le(se);break;case"sender:send":{b("handleSendMessage");break}}},{handleMessageChange:le,clearInput:he,inputValue:fe,handleUploadFiles:Fe,uploadedFiles:xe,handleRemoveFile:oe}=dS({senderConfig:r,handleEventsEmit:ue}),ge=_e=>{M(_e.all)},Ee=()=>{const _e=bi(32);w.current.set(_e,{current:_e});const se=new Set(C.map(de=>de.configId).filter(Boolean));let Se="";const ne=z.find(de=>!se.has(de.value));ne?Se=ne.value:z.length&&(Se=z[0].value),A(de=>[...de,{id:_e,configId:Se}])},Ce=_e=>{A(se=>{if(se.length<=2)return se;const Se=se.findIndex(qe=>qe.id===_e);if(Se===-1)return se;const ne=se[Se],de=w.current.get(ne.id),we=de==null?void 0:de.current;if(we&&typeof(we==null?void 0:we.unmount)=="function")try{we.unmount()}catch{}return w.current.delete(ne.id),[...se.slice(0,Se),...se.slice(Se+1)]})},Me=_e=>_e.map(se=>{const Se=JSON.parse(se.configJson);return{details:{model_name:Se.model_name||"",temperature:Se.temperature||"",max_tokens:Se.max_tokens||""},label:se.name,value:se.id}}),Ge=async()=>{try{const _e=await oT({token:e});if(_e.length){const se=Me(_e);V(se),A(Se=>Se.map((ne,de)=>{var we;return{...ne,configId:((we=se==null?void 0:se[de])==null?void 0:we.value)||""}})),I(!1)}}catch(_e){console.log("error",_e)}},ye=pt(()=>x.uploadedFiles||[],[x]);Vd({fileManagerData:{uploadedFiles:ye},styles:te,eventsEmit:ue});const be=_e=>{const se=_e.target.files;if(se&&se.length>0){console.log("[DEBUG] handleFileSelect \u89E6\u53D1",{filesCount:se.length,hasSetUploadedFilesRef:!!f.current,hasSenderConfig:!!d.current,dynamicSenderConfig:Q,dynamicSenderConfigKeys:Q?Object.keys(Q):[],senderConfigRef:d.current,senderConfigRefKeys:d.current?Object.keys(d.current):[]});const Se=Array.from(se);let ne=d.current;(!ne||ne.upload_size_limit===void 0&&ne.upload_number_limit===void 0&&(!ne.upload_file_type_limit||ne.upload_file_type_limit.length===0))&&(ne=Q);const de=l.current||[];console.log("[DEBUG] \u9A8C\u8BC1\u914D\u7F6E\u68C0\u67E5",{configSource:ne,upload_number_limit:ne==null?void 0:ne.upload_number_limit,upload_size_limit:ne==null?void 0:ne.upload_size_limit,existingFilesCount:de.length,newFilesCount:Se.length});const we=ne&&(ne.upload_size_limit!==void 0||ne.upload_number_limit!==void 0&&ne.upload_number_limit>0||ne.upload_file_type_limit&&ne.upload_file_type_limit.length>0);if(console.log("[DEBUG] \u914D\u7F6E\u68C0\u67E5\u7ED3\u679C",{hasUploadLimitConfig:we,upload_number_limit:ne==null?void 0:ne.upload_number_limit,upload_size_limit:ne==null?void 0:ne.upload_size_limit,upload_file_type_limit:ne==null?void 0:ne.upload_file_type_limit}),we){const qe={upload_size_limit:ne.upload_size_limit,upload_number_limit:ne.upload_number_limit,upload_file_type_limit:ne.upload_file_type_limit,upload_limit_message:ne.upload_limit_message};console.log("[DEBUG] \u6267\u884C\u6587\u4EF6\u9A8C\u8BC1",{uploadConfig:qe,existingFilesCount:de.length,newFilesCount:Se.length,totalCount:de.length+Se.length});const He=Xd(Se,de,qe);if(console.log("[DEBUG] \u9A8C\u8BC1\u7ED3\u679C",{valid:He.valid,errors:He.errors,rejectedFilesCount:He.rejectedFiles.length}),!He.valid){Kd(He);const bt=Se.filter(je=>!He.rejectedFiles.includes(je));if(bt.length===0){_.current&&(_.current.value="");return}Se.splice(0,Se.length,...bt)}}if(f.current){const qe=Se.map(He=>({file:He,type:He.type.startsWith("image/")?"image":"document",status:"pending",name:He.name}));console.log("[DEBUG] \u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",qe),f.current(qe)}else console.warn("[DEBUG] setUploadedFilesRef \u672A\u8BBE\u7F6E\uFF0C\u5EF6\u8FDF\u91CD\u8BD5"),setTimeout(()=>{if(f.current){const qe=Se.map(He=>({file:He,type:He.type.startsWith("image/")?"image":"document",status:"pending",name:He.name}));console.log("[DEBUG] \u5EF6\u8FDF\u540E\u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",qe),f.current(qe)}else console.error("[DEBUG] \u5EF6\u8FDF\u540E setUploadedFilesRef \u4ECD\u672A\u8BBE\u7F6E")},100)}_.current&&(_.current.value="")},Te=pt(()=>{const _e=C.map(se=>{var Se;return(Se=se==null?void 0:se.appStatus)==null?void 0:Se.sender}).filter(Boolean);return console.log("chatItems",C),_e.includes("error")?"error":_e.includes("uploading")?"uploading":_e.includes("processing")?"processing":"ready"},[C]);return Ye(()=>{console.log("senderStatus",Te)},[Te]),Ye(()=>{I(!0),Ge()},[]),Pe("div",{style:{display:"flex",gap:"20px",height:"100%",boxSizing:"border-box",flexDirection:"column",position:"relative"},className:"selfScrollBar",ref:a,children:[Pe("div",{style:{display:"flex",gap:"20px",height:"calc(100% - 195px)",overflowX:"auto"},children:[J("input",{ref:_,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.txt,.md,.json,.csv,.zip,.rar,.7z",style:{display:"none"},onChange:be}),C.map((_e,se)=>{const Se=w.current.get(_e.id);return J(gT,{index:se,ref:Se,item:_e,scrollOld:i,token:e,styles:t,status:Te,inputValue:fe,uploadedFiles:xe,senderSwitchValues:L,clearInput:he,configLoading:U,showRemoveIcon:(C==null?void 0:C.length)>2,assistantList:z.filter(ne=>ne.value===_e.configId||C.every(de=>de.configId!==ne.value)),emitEvent:ue,onRemove:Ce,senderConfig:Q,normalizedStyles:te,setChatItems:A},_e.id)})]}),Pe("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"end"},children:[J(eS,{value:fe,status:Te,styles:N,recommandQuestions:[],eventsEmit:(_e,se)=>{ue(_e,se)},uploadedFiles:xe,fileUploadStatus:j,onUpload:Fe,onRemoveFile:oe,senderConfig:r,onSenderConfigChange:ge,disclaimer:n}),J("div",{className:"flex absolute text-[12px] cursor-pointer z-20",style:{left:"24px",bottom:"150px"},children:J(Hd,{count:C.length,size:"small",color:"#1677ff",children:J(uy,{icon:J(Ey,{className:"w-3"}),onClick:Ee,type:"link",disabled:C.length>=(s||10),size:"small",children:"\u6DFB\u52A0\u52A9\u624B"})})})]})]})};export{AS as ChatCompareComponent,AS as default};